Topic: Bounds for a texture overlay ?

Hello, I am trying to display an texture overlay over a specific region of an OLMap using the TilesetOverlayExample.cs, but I don’t understand how I can set the bounds so that it matches the map, as this is not a "fullworld" overlay.

I found in this topic https://forum.infinity-code.com/viewtop … 6419#p6419 a script that contains bounds for lat and lng, but it seems that it doesn’t work (TilesetOverlayExample2.cs)

Maybe I am wrong somewhere ?

Best regards, Philippe

Re: Bounds for a texture overlay ?

Hello.

I just tested this example and it works well on my side.
Please explain in detail what exactly you are doing and what is not working.
I think screenshots here will be very helpful.

Kind Regards,
Infinity Code Team.

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

Re: Bounds for a texture overlay ?

Hello, thanks for the answer, I solved the issue !
It was because I used elevations, so the texture overlay was only visible with low zoom levels, when elevation were not used. So my question is : anyway to display the texture over a 3D OLMap ?
Philippe

Re: Bounds for a texture overlay ?

This example will not work with elevations.
When you use elevations you need to split your overlay texture into tiles (using MapTiler for example) and use this way:
https://infinity-code.com/atlas/online- … ample.html

Kind Regards,
Infinity Code Team.

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

Re: Bounds for a texture overlay ?

Thanks Alex, I will try, but for now as it works with a single texture, I prefer to disable the elevation.
I display a drawed spline (generated with DrawText) and when the overlay is displayed too, the spline remains behind. Is there a way to show the spline over the overlay ?
Here a 7 seconds video : https://youtu.be/IgR49Ibw3qs

Is there a way to manage the thickness of such a a drawed spline when the zoom level is changed ? I can draw it again everytime the zoom is changed, but maybe there is faster way ?

Best regards, Phil

Re: Bounds for a texture overlay ?

You can adjust the drawing order using the Z Offset shader.
https://docs.unity3d.com/Manual/SL-Offset.html

Set the desired OnlineMapsDrawingLine.width or OnlineMapsDrawingPoly.borderWidth, depending on whether it's a line or a polygon, and invoke a map redraw.
https://infinity-code.com/doxygen/onlin … 840ed4c5aa
https://infinity-code.com/doxygen/onlin … 1c8ee80456

Kind Regards,
Infinity Code Team.

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

Re: Bounds for a texture overlay ?

Hello,

Alex Vertax wrote:

You can adjust the drawing order using the Z Offset shader.
https://docs.unity3d.com/Manual/SL-Offset.html

I absolutely don't know anything about shaders, so I added these lines to the TilesetDrawingElement shader
(the shader used by the drawed line)
______________________
            Pass

        {
            // Sets the depth offset for this geometry so that the GPU draws this geometry closer to the camera
            // You would typically do this to avoid z-fighting
            Offset - 1, 1

            // The rest of the code that defines the Pass goes here.
        }
_______________

It works fine in the editor, but when I try to build I get these 2 errors :

Shader error in '': Parse error: syntax error, unexpected '-', expecting TVAL_VARREF or TVAL_NUMBER at line 45

Error building Player: Shader error in '': Parse error: syntax error, unexpected '-', expecting TVAL_VARREF or TVAL_NUMBER at line 45

I get the same error message in the inspector.
Ths modified shader is attached.

Alex Vertax wrote:

Set the desired OnlineMapsDrawingLine.width or OnlineMapsDrawingPoly.borderWidth, depending on whether it's a line or a polygon, and invoke a map redraw.
https://infinity-code.com/doxygen/onlin … 840ed4c5aa
https://infinity-code.com/doxygen/onlin … 1c8ee80456

I found a workaround calculating the thickness with the zoom level and drawing each time the zoom is changed.

Best regards, Philippe

Re: Bounds for a texture overlay ?

The package contains TilesetDrawingElementZTestAlways and TilesetDrawingElementZOffset.
Just use select one of them in Tileset / Material & Shaders / Drawing Shader.

Kind Regards,
Infinity Code Team.

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

Re: Bounds for a texture overlay ?

Alex Vertax wrote:

The package contains TilesetDrawingElementZTestAlways and TilesetDrawingElementZOffset.
Just use select one of them in Tileset / Material & Shaders / Drawing Shader.

Hello, the same with both shaders, the overlay is still over - and masking - the drawing element (tested with a map without elevation).

Re: Bounds for a texture overlay ?

Hmm... interesting.

This can be done in this way:

using UnityEngine;

public class SetRenderQueueOffset : MonoBehaviour
{
    public int renderQueueOffset = 100;

    private void Start()
    {
        foreach (OnlineMapsDrawingElement el in OnlineMapsDrawingElementManager.instance)
        {
            el.renderQueueOffset = renderQueueOffset;
        }
        OnlineMapsDrawingElementManager.OnAddItem += OnAddItem;
    }

    private void OnAddItem(OnlineMapsDrawingElement element)
    {
        element.renderQueueOffset = renderQueueOffset;
    }
}

On my side this way works well.
The overlay and drawing element used a TilesetDrawingElement shader.

Kind Regards,
Infinity Code Team.

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