<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Outline shader for buildings]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=926</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=926&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Outline shader for buildings.]]></description>
		<lastBuildDate>Thu, 01 Nov 2018 10:26:42 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4140#p4140</link>
			<description><![CDATA[<p>Thanks, this works perfect!</p>]]></description>
			<author><![CDATA[null@example.com (Tim Reniers)]]></author>
			<pubDate>Thu, 01 Nov 2018 10:26:42 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4140#p4140</guid>
		</item>
		<item>
			<title><![CDATA[Re: Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4136#p4136</link>
			<description><![CDATA[<p>Something like that:<br /><a href="https://ibb.co/haJfdL"><span class="postimg"><img src="https://thumb.ibb.co/haJfdL/img1.png" alt="https://thumb.ibb.co/haJfdL/img1.png" /></span></a></p><div class="codebox"><pre><code>using UnityEngine;

public class FixBuildingUV : MonoBehaviour
{
    private void Start()
    {
        OnlineMapsBuildings.instance.OnBuildingCreated += OnBuildingCreated;
    }

    private void OnBuildingCreated(OnlineMapsBuildingBase building)
    {
        Renderer r = building.GetComponent&lt;Renderer&gt;();
        foreach (Material sharedMaterial in r.sharedMaterials) sharedMaterial.mainTextureScale = Vector2.one;

        MeshFilter meshFilter = building.GetComponent&lt;MeshFilter&gt;();
        Mesh mesh = meshFilter.sharedMesh;

        Vector2[] uv = mesh.uv;
        int[] ts = mesh.GetTriangles(0);

        for (int i = 0; i &lt; ts.Length; i += 6)
        {
            uv[ts[i + 2]] = Vector2.zero;
            uv[ts[i + 4]] = Vector2.right;
            uv[ts[i]] = Vector2.up;
            uv[ts[i + 1]] = Vector2.one;
        }

        mesh.uv = uv;
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 31 Oct 2018 16:57:42 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4136#p4136</guid>
		</item>
		<item>
			<title><![CDATA[Re: Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4134#p4134</link>
			<description><![CDATA[<p>Here I the texture is use.</p>]]></description>
			<author><![CDATA[null@example.com (Tim Reniers)]]></author>
			<pubDate>Wed, 31 Oct 2018 12:29:00 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4134#p4134</guid>
		</item>
		<item>
			<title><![CDATA[Re: Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4133#p4133</link>
			<description><![CDATA[<p>Thankyou for your answer.</p><p>Some free outline shaders do indeed work. But the result of those shaders is not what I&#039;m looking for because those shaders do not draw all the edges of an object at all time. What I try to achieve with my shader is that it gives the edges of an object/building a color and that it makes the rest of the object transparent, something comparable to a wireframe but then only draw the edges.</p><p>I&#039;m currently doing it by putting a texture onto the cube and changing its color of the texture if I want to. You can find my shader in the attachments. If you put this shader onto a material with the texture I will provide and use this material as roof and wall materials, you can see what it does (make sure the tile size of x and y of the texture inside the material is 1).</p><p>Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (Tim Reniers)]]></author>
			<pubDate>Wed, 31 Oct 2018 12:27:54 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4133#p4133</guid>
		</item>
		<item>
			<title><![CDATA[Re: Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4124#p4124</link>
			<description><![CDATA[<p>Hello.</p><p>I just tested some free outline shaders from the Asset Store and it works fine.<br />Most likely your shader is based on UV. I&#039;m right?<br />For a cube, each side has UV (0; 0) - (1; 1).<br />For a building, UV.x is stretched to the full length of the building.<br />So, for your shader you need to reassign UV for each point of the mesh.<br />This is most conveniently to make after the mesh of the building has been created (OnlineMapsBuildings.OnBuildingCreated)<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsBuildings.html#ab7bf6d7e6752f31dc2c93f72246c0d9e.">http://infinity-code.com/doxygen/online … 2246c0d9e.</a></p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 30 Oct 2018 16:47:44 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4124#p4124</guid>
		</item>
		<item>
			<title><![CDATA[Outline shader for buildings]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4121#p4121</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;m trying to make an outline effect on the buildings with a shader. It works perfectly fine on a cube but when I add the roof and wall materials (with the same shader as used on the cube) on the buildings script it does not seem to work. I don&#039;t really know how the buildings are created and how the materials are added to the buildings but it seems that a building and a cube have a comparable mesh so I don&#039;t know why it&#039;s not working.</p><p>Is there anyone that has done this before or knows how the materials/meshes/textures work with adding them to the buildings?</p><p>(Cube is on the left, one of the generated buildings is on the right. As you can see not all the edges are filled with the material like with the cube.)</p><p>Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (Tim Reniers)]]></author>
			<pubDate>Tue, 30 Oct 2018 13:53:04 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4121#p4121</guid>
		</item>
	</channel>
</rss>
