An experimental and learning project for rendering OSM data with some nice effects. The first effect I tried to implement was a kind of watercolor effect. See details below. Another effect is inspired by Piet Mondrien. And finally just black and white.
The - especially the OpenGL / GLSL part - is not really well optimized. There is a lot of space for improvement. For example, I copy the texture back and forth between GPU and CPU for every single step of the algorithm. The textures could instead be kept on the GPU and used from there (somehow...).
One of the challanges was to create polygons for the landsmass and ocean so that I can render them independently with different textures.
I developed an algorithm that turns coastlines into polygons. The algorithm is inspired by this presentation (in German only) and this description.
You can find my document with my considerartions here (sorry, but some notes are in German).
For each layer of the OSM data (buildings, highways, greenland, etc.) bascially do this:\
- Render the osm data for that layer in black on white background
- Blur the result of 1)
- Overlay the result of 2) with a noise texture to create "wobbly" shape outlines. With watercolor you also have these lines when you apply the watercolor to paper.
- Now overlay result of 3) with the watercolor texture (e.g. brown for buildings) Now I want to create a darker area towards the boundaries of the shapes.
- Invert the result of 3) (now it's white on black background)
- Blur the result of 5) (now you have a gradient within the layer shapes)
- Mask result of 5) with 6) to just get the blurred outlines within the shapes
- Combine result of 4) with 7) to get the watercolor effect texture for the layer
- In the end combine all results of 8) from all layers to one final composition
You can play with the alpha values when combining / blending, with the noise texture and with other shader parameters, too.
TBD