[VTM] Line offset in shader

46 views
Skip to first unread message

Andrey Novikov

unread,
Apr 13, 2020, 12:33:16 PM4/13/20
to Mapsforge & VTM
There is a desperate need to implement line offsets to be able to map such features like cycleway:left= cycleway:right= and other one-sided features.

This is how it is implemented in Mapbox:

But I am completely dunno in OpenGL. May be someone can implement it? @Gustl22?

Karsten T.

unread,
Dec 17, 2020, 3:17:26 AM12/17/20
to Mapsforge & VTM
I also really would like to have this feature, but I don't know where to start. Are there some documents that describe how vtm draws things or are there only comments in the code? If I would try to add such a feature, which classes should I take a look at?

Andrey Novikov

unread,
Mar 9, 2021, 8:47:39 AMMar 9
to Mapsforge & VTM
This part of library is (almost) unmaintained. There are no any documents and original author (of opensciencemap) does not participate. What I know so far:

Each theme instruction primitive drawing is controlled by its own bucket, they can be found in org.oscim.render.bucket package. Line drawing is controlled by one of two buckets: LineBucket and LineTexBucket. First one is used for simple solid color or stippled lines, second one - for textured or array-dashed lines (because array-dash is converted to bitmap texture). Line outlines are ugly implemented by simply drawing lines with outline color underneath lines with main color. This means that outlined lines can not be semi-transparent for example.

Each line bucket is supplemented by GLSL shader file which can be found in assets/shaders. Files contain both vertex shader and fragment shader separated by '$' symbol. These files contain outdated and unused parts of code with little comments. Simple line shader files also have two separate versions for orthogonal and slanted map views. The later has '_proj' suffix.
Message has been deleted

Emux

unread,
Mar 11, 2021, 1:14:15 PMMar 11
to mapsfo...@googlegroups.com
VTM is an open source library.


Some users may have their own separate Mapsforge / VTM repositories,
implement features and not contribute them back to the community.
(there are examples in issues list)

And it has happened in the past with Mapsforge,
resulting in the fragmentation of the community.

Other users are more generous and contribute useful features.
e.g. a recent pull request after forum discussion


Instead of complaining to maintainers to implement something their app,
they can study the code and contribute, after discussing it here in the forum.

And not make the repository a museum of requests,
which wait for someone else to implement them ...

Our top priority is maintain the existing code and shaders
for compatibility / performance for current users and apps.


You can create new clean shaders and extend existing classes
to implement new rules in themes, etc.


--
Emux

Karsten T.

unread,
Mar 12, 2021, 10:46:29 AMMar 12
to Mapsforge & VTM
This part of library is (almost) unmaintained. There are no any documents and original author (of opensciencemap) does not participate. What I know so far:

Each theme instruction primitive drawing is controlled by its own bucket, they can be found in org.oscim.render.bucket package. Line drawing is controlled by one of two buckets: LineBucket and LineTexBucket. First one is used for simple solid color or stippled lines, second one - for textured or array-dashed lines (because array-dash is converted to bitmap texture). Line outlines are ugly implemented by simply drawing lines with outline color underneath lines with main color. This means that outlined lines can not be semi-transparent for example.

Each line bucket is supplemented by GLSL shader file which can be found in assets/shaders. Files contain both vertex shader and fragment shader separated by '$' symbol. These files contain outdated and unused parts of code with little comments. Simple line shader files also have two separate versions for orthogonal and slanted map views. The later has '_proj' suffix.
 
this is a good starting point. i won't be able to participate in the next months, but this is a feature i really would like to see
Reply all
Reply to author
Forward
0 new messages