<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Load and overlay images over tiles with zoom scale and color fade]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2321&amp;type=atom" />
	<updated>2024-12-30T07:50:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2321</id>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9749#p9749" />
			<content type="html"><![CDATA[<p>If you have an amount number of textures, you cannot use the shader way.<br />In that case you need to use this way:<br /><a href="https://forum.infinity-code.com/viewtopic.php?pid=6419#p6419">https://forum.infinity-code.com/viewtop … 6419#p6419</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-12-30T07:50:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9749#p9749</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9748#p9748" />
			<content type="html"><![CDATA[<p>Thanks Alex.</p><p>You mean like the TilesetWithOverlay7.shader example for 7 property block from _OverlayTex? <br />See Thread: <a href="https://forum.infinity-code.com/viewtopic.php?id=2185">https://forum.infinity-code.com/viewtopic.php?id=2185</a></p><p>In my case I have an unknown amount of textures which I need to placed as an overlay over those tiles (Lon, Lat) as it already works with this examples you provided? </p><p>I hope this makes it clearer. Thanks again for all your help.</p>]]></content>
			<author>
				<name><![CDATA[A1]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=3164</uri>
			</author>
			<updated>2024-12-29T20:15:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9748#p9748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9747#p9747" />
			<content type="html"><![CDATA[<p>You need to modify both the shader and the script.<br />In the shader you need to copy-paste the property block from _OverlayTex and below, with new names.<br />Add the use of the new properties to the surf method.<br />Then modify the script to use the new properties.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-12-28T21:00:54Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9747#p9747</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9745#p9745" />
			<content type="html"><![CDATA[<p>Hi Alex,</p><p>I was just wondering what you meant with &quot;The second example that uses shaders is actually for a single texture, but this can be modified for multiple textures.&quot;</p><p>A. To directly modifiy the shader for multiple textures?<br />or<br />B. Modify the script to user multiple textures with the shader?</p><p>And is there an example for that?</p><p>Many thanks!</p>]]></content>
			<author>
				<name><![CDATA[A1]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=3164</uri>
			</author>
			<updated>2024-12-27T03:53:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9745#p9745</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9697#p9697" />
			<content type="html"><![CDATA[<p>You need to modify the shader to add color support. Something like:<br /></p><div class="codebox"><pre><code>Shader &quot;Infinity Code/Online Maps/Tileset With Overlay&quot; 
{
    Properties 
    {
        _Color(&quot;Main Color&quot;, Color) = (1,1,1,1)
        _MainTex(&quot;Base (RGB) Trans (A)&quot;, 2D) = &quot;white&quot; {}
        _OverlayBackTex(&quot;Overlay Back Texture&quot;, 2D) = &quot;black&quot; {}
        _OverlayBackAlpha(&quot;Overlay Back Alpha&quot;, Range(0, 1)) = 1
        _TrafficTex(&quot;Traffic Texture&quot;, 2D) = &quot;black&quot; {}
        _OverlayFrontTex(&quot;Overlay Front Texture&quot;, 2D) = &quot;black&quot; {}
        _OverlayFrontAlpha(&quot;Overlay Front Alpha&quot;, Range(0, 1)) = 1
        
        _OverlayTex(&quot;Overlay Texture&quot;, 2D) = &quot;black&quot; {}
        _OverlayColor(&quot;Overlay Color&quot;, Color) = (1,1,1,1)
        _OverlayAlpha(&quot;Overlay Alpha&quot;, Range(0, 1)) = 1
        _OverlayTL(&quot;Overlay Top Left&quot;, Vector) = (0, 0, 0, 0)
        _OverlayBR(&quot;Overlay Bottom Right&quot;, Vector) = (1, 1, 0, 0)
    }

    SubShader 
    {
        Tags {&quot;Queue&quot;=&quot;AlphaTest-300&quot; &quot;IgnoreProjector&quot;=&quot;True&quot; &quot;RenderType&quot;=&quot;TransparentCutout&quot;}
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert alphatest:_Cutoff 

        sampler2D _MainTex;
        sampler2D _OverlayBackTex;
        half _OverlayBackAlpha;
        sampler2D _TrafficTex;
        sampler2D _OverlayFrontTex;
        half _OverlayFrontAlpha;
        fixed4 _Color;

        sampler2D _OverlayTex;
        fixed4 _OverlayColor;
        half _OverlayAlpha;
        float4 _OverlayTL;
        float4 _OverlayBR;

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_OverlayBackTex;
            float2 uv_TrafficTex;
            float2 uv_OverlayFrontTex;
            float3 worldPos;
        };

        void surf(Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex);

            fixed4 t = tex2D(_OverlayBackTex, IN.uv_OverlayBackTex);
            fixed3 ct = lerp(c.rgb, t.rgb, t.a * _OverlayBackAlpha);

            t = tex2D(_TrafficTex, IN.uv_TrafficTex);
            ct = lerp(ct, t.rgb, t.a);

            t = tex2D(_OverlayFrontTex, IN.uv_OverlayFrontTex);
            ct = lerp(ct, t.rgb, t.a * _OverlayFrontAlpha);

            ct = ct * _Color;
            
            o.Albedo = ct;
            o.Alpha = c.a * _Color.a;

            float3 wp = IN.worldPos;
            
            float uvx = (wp.x - _OverlayTL.x) / (_OverlayBR.x - _OverlayTL.x);
            float uvy = (wp.z - _OverlayBR.z) / (_OverlayTL.z - _OverlayBR.z);

            if (uvx &gt;= 0 &amp;&amp; uvx &lt;= 1 &amp;&amp; uvy &gt;= 0 &amp;&amp; uvy &lt;= 1)
            {
                t = tex2D(_OverlayTex, float2(uvx, uvy));
                fixed3 ct2 = lerp(t.rgb, _OverlayColor.rgb, _OverlayColor.a);
                o.Albedo = lerp(ct, ct2, t.a * _OverlayAlpha);
            }
        }
        ENDCG
    }

    Fallback &quot;Transparent/Cutout/Diffuse&quot;
}</code></pre></div><p>P.S. I haven&#039;t tested this change in the shader, but it&#039;s very likely to work.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-11-01T17:47:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9697#p9697</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9695#p9695" />
			<content type="html"><![CDATA[<p>Thanks Alex.</p><p>With those examples I am not able to change the colors at the moment, but the alpha update works. </p><p>I have tried with TilesetWithOverlay.shader and TilesetWithOverlay2.shader:</p><p>&nbsp; &nbsp; &nbsp;tilesetOverlay.material.SetColor(&quot;_Color&quot;, color);<br />&nbsp; &nbsp; &nbsp;tilesetOverlay.material.SetColor(&quot;_OverlayColor&quot;, color);</p><p>Any suggestions?</p>]]></content>
			<author>
				<name><![CDATA[A1]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=3164</uri>
			</author>
			<updated>2024-11-01T10:31:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9695#p9695</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9677#p9677" />
			<content type="html"><![CDATA[<p>Hi.</p><p>Examples:<br /><a href="https://forum.infinity-code.com/viewtopic.php?pid=9223#p9223">https://forum.infinity-code.com/viewtop … 9223#p9223</a><br /><a href="https://forum.infinity-code.com/viewtopic.php?id=2142">https://forum.infinity-code.com/viewtopic.php?id=2142</a></p><p>The second example that uses shaders is actually for a single texture, but this can be modified for multiple textures.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-10-18T19:58:21Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9677#p9677</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Load and overlay images over tiles with zoom scale and color fade]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9676#p9676" />
			<content type="html"><![CDATA[<p>Hi Alex,</p><p>I am not sure if there is an example or solution for this requirements.</p><p>1. We need to load multiple images and overlay those images over tiles (1 degree long and lat).<br />2. Those need to also zoom in and out accordingly when we zoom the map in and out.<br />3. And finally we need be able to change color and fade the alpha value as well.</p><p>Is all this possible?</p><p>Thanks again!</p>]]></content>
			<author>
				<name><![CDATA[A1]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=3164</uri>
			</author>
			<updated>2024-10-17T23:55:06Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9676#p9676</id>
		</entry>
</feed>
