[VTM] Line offset in shader

105 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 AM3/9/21
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
Message has been deleted

Karsten T.

unread,
Mar 12, 2021, 10:46:29 AM3/12/21
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