1 (edited by victors.cv 2023-11-26 00:57:52)

Topic: Markers as filters to draw map

Hello everyone, hope you are all doing fine!

I want to make something similar to the Bouncing Circle example, but instead of creating drawing polys around the markers, I want to use the markers as filters to render the other map elements.

In other words, I want a blank map (custom texture) that only draws real map data around markers. Picture it as candles (markers) in the dark (custom texture). Like in Bouncing Circle example, rendered area should respect the map zoom and multiple filter markers should be supported.

What would be the best approach to achieve this? Any help in this matter will be much appreciated.

Thanks in advance,

Victor

Re: Markers as filters to draw map

Hello.

I think the best way to achieve this is to make a custom shader that will store the world positions of the markers (and update them when the map is moved) and draw the map only within a certain radius of the marker.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Markers as filters to draw map

Thank you Alex!

So I'll create a new shader an add it as a final step to the tileset rendering, through inheritance of the MonoBehaviour responsible for rendering (OnlineMapsTileSetControl). Extend controller class and leave the original shaders intact. WDYT?

I'm not that experienced with shader programming but I'll give it a try nevertheless. If it works, I'll be happy to share it to complement the examples repo.

Re: Markers as filters to draw map

You do not need to modify or inherit Tileset.
Just specify your shader in the Tileset / Materials & Shaders / Tileset Shader field.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by victors.cv 2023-11-26 23:38:51)

Re: Markers as filters to draw map

Got it. Any hint on how to pass multiple markers positions + radius to the custom shader? Because with the built-in Properties I'm not sure I'm able to.

Or would I need to provide a dynamically built texture to be used as a mask? Could this compromise performance?

Re: Markers as filters to draw map

Make a float array in the shader that looks like [m1.x, m1.z, m2.x, m2.z, ... etc] and pass it to the shader.
https://stackoverflow.com/questions/450 … properties
In the shader, make a loop that will go through all the world positions of the markers, and calculate the texture color.
Actually it will be a fairly uncomplicated shader that will have good performance.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.