<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Bounds for a texture overlay ?]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2050&amp;type=atom" />
	<updated>2022-10-25T16:47:25Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2050</id>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8700#p8700" />
			<content type="html"><![CDATA[<p>Hmm... interesting.</p><p>This can be done in this way:<br /></p><div class="codebox"><pre><code>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;
    }
}</code></pre></div><p>On my side this way works well.<br />The overlay and drawing element used a TilesetDrawingElement shader.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-25T16:47:25Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8700#p8700</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8698#p8698" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>The package contains TilesetDrawingElementZTestAlways and TilesetDrawingElementZOffset.<br />Just use select one of them in Tileset / Material &amp; Shaders / Drawing Shader.</p></blockquote></div><p>Hello, the same with both shaders, the overlay is still over - and masking - the drawing element (tested with a map without elevation).</p>]]></content>
			<author>
				<name><![CDATA[philzmz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=606</uri>
			</author>
			<updated>2022-10-25T16:04:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8698#p8698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8697#p8697" />
			<content type="html"><![CDATA[<p>The package contains TilesetDrawingElementZTestAlways and TilesetDrawingElementZOffset.<br />Just use select one of them in Tileset / Material &amp; Shaders / Drawing Shader.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-25T09:18:19Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8697#p8697</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8695#p8695" />
			<content type="html"><![CDATA[<p>Hello,</p><div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>You can adjust the drawing order using the Z Offset shader.<br /><a href="https://docs.unity3d.com/Manual/SL-Offset.html">https://docs.unity3d.com/Manual/SL-Offset.html</a></p></blockquote></div><p>I absolutely don&#039;t know anything about shaders, so I added these lines to the TilesetDrawingElement shader <br />(the shader used by the drawed line)<br />______________________<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pass</p><p>&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Sets the depth offset for this geometry so that the GPU draws this geometry closer to the camera<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // You would typically do this to avoid z-fighting<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Offset - 1, 1</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // The rest of the code that defines the Pass goes here.<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />_______________</p><p>It works fine in the editor, but when I try to build I get these 2 errors :</p><p>Shader error in &#039;&#039;: Parse error: syntax error, unexpected &#039;-&#039;, expecting TVAL_VARREF or TVAL_NUMBER at line 45</p><p>Error building Player: Shader error in &#039;&#039;: Parse error: syntax error, unexpected &#039;-&#039;, expecting TVAL_VARREF or TVAL_NUMBER at line 45</p><p>I get the same error message in the inspector.<br />Ths modified shader is attached.</p><div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Set the desired OnlineMapsDrawingLine.width or OnlineMapsDrawingPoly.borderWidth, depending on whether it&#039;s a line or a polygon, and invoke a map redraw.<br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsDrawingLine.html#a5b1bd790eb30c32208063b840ed4c5aa">https://infinity-code.com/doxygen/onlin … 840ed4c5aa</a><br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsDrawingPoly.html#aa3d012bd6369de9d147ade1c8ee80456">https://infinity-code.com/doxygen/onlin … 1c8ee80456</a></p></blockquote></div><p>I found a workaround calculating the thickness with the zoom level and drawing each time the zoom is changed.</p><p>Best regards, Philippe</p>]]></content>
			<author>
				<name><![CDATA[philzmz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=606</uri>
			</author>
			<updated>2022-10-24T21:51:52Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8695#p8695</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8691#p8691" />
			<content type="html"><![CDATA[<p>You can adjust the drawing order using the Z Offset shader.<br /><a href="https://docs.unity3d.com/Manual/SL-Offset.html">https://docs.unity3d.com/Manual/SL-Offset.html</a></p><p>Set the desired OnlineMapsDrawingLine.width or OnlineMapsDrawingPoly.borderWidth, depending on whether it&#039;s a line or a polygon, and invoke a map redraw.<br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsDrawingLine.html#a5b1bd790eb30c32208063b840ed4c5aa">https://infinity-code.com/doxygen/onlin … 840ed4c5aa</a><br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsDrawingPoly.html#aa3d012bd6369de9d147ade1c8ee80456">https://infinity-code.com/doxygen/onlin … 1c8ee80456</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-24T09:15:08Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8691#p8691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8686#p8686" />
			<content type="html"><![CDATA[<p>Thanks Alex, I will try, but for now as it works with a single texture, I prefer to disable the elevation.<br />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 ?<br />Here a 7 seconds video : <a href="https://youtu.be/IgR49Ibw3qs">https://youtu.be/IgR49Ibw3qs</a></p><p>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 ?</p><p>Best regards, Phil</p>]]></content>
			<author>
				<name><![CDATA[philzmz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=606</uri>
			</author>
			<updated>2022-10-23T17:25:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8686#p8686</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8683#p8683" />
			<content type="html"><![CDATA[<p>This example will not work with elevations.<br />When you use elevations you need to split your overlay texture into tiles (using MapTiler for example) and use this way:<br /><a href="https://infinity-code.com/atlas/online-maps/pages/TilesetMapTilerOverlayExample.html">https://infinity-code.com/atlas/online- … ample.html</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-23T11:44:40Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8683#p8683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8681#p8681" />
			<content type="html"><![CDATA[<p>Hello, thanks for the answer, I solved the issue !<br />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 ?<br />Philippe</p>]]></content>
			<author>
				<name><![CDATA[philzmz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=606</uri>
			</author>
			<updated>2022-10-22T18:56:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8681#p8681</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8677#p8677" />
			<content type="html"><![CDATA[<p>Hello.</p><p>I just tested this example and it works well on my side.<br />Please explain in detail what exactly you are doing and what is not working.<br />I think screenshots here will be very helpful.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-21T19:19:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8677#p8677</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bounds for a texture overlay ?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8672#p8672" />
			<content type="html"><![CDATA[<p>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 &quot;fullworld&quot; overlay.</p><p>I found in this topic <a href="https://forum.infinity-code.com/viewtopic.php?pid=6419#p6419">https://forum.infinity-code.com/viewtop … 6419#p6419</a> a script that contains bounds for lat and lng, but it seems that it doesn’t work (TilesetOverlayExample2.cs)</p><p>Maybe I am wrong somewhere ?</p><p>Best regards, Philippe</p>]]></content>
			<author>
				<name><![CDATA[philzmz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=606</uri>
			</author>
			<updated>2022-10-21T16:28:44Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8672#p8672</id>
		</entry>
</feed>
