<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Shadows on Insert Object with Mirror Operation in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445136#M6082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, this is a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing you could do is use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;setNormals()&lt;/SPAN&gt; or &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;softenNormals()&lt;/SPAN&gt; to recalculate the vertex normals, but this is not exactly what you want because it won't let you keep the original normals in the inserted object.&amp;nbsp; It might, however, provide a better approximation to the vertex normals so that the lighting doesn't look so strange, or it might not look any better.&amp;nbsp; The other caveat is that depending on the geometry connectivity, it may or may not need a &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;cleanupGeometry()&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-set-normals.htm" title="https://doc.arcgis.com/en/cityengine/latest/cga/cga-set-normals.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;setNormals operation—CGA | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-soften-normals.htm" title="https://doc.arcgis.com/en/cityengine/latest/cga/cga-soften-normals.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;softenNormals operation—CGA | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One hacky workaround to keep the original vertex normals would be to resize the object in the negative direction and then translate it.&amp;nbsp; If the number of axes you invert is odd, then you need to also add a &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;reverseNormals&lt;/SPAN&gt; (if even, you don't need the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;reverseNormals&lt;/SPAN&gt;).&amp;nbsp; Here is the case to mirror something in &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;x&lt;/SPAN&gt; only.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;s('-1,'1,'1)
t('-1,0,0)
reverseNormals‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:53:35 GMT</pubDate>
    <dc:creator>CherylLau</dc:creator>
    <dc:date>2021-12-11T19:53:35Z</dc:date>
    <item>
      <title>Shadows on Insert Object with Mirror Operation</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445135#M6081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RE:&amp;nbsp; Shadows on Insert Object with Mirror Operation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this is a bug or a misapplication of the rule, but when I run a mirror operation on an insert object it puts the shadows on before the mirror flip so they are facing upside down.&amp;nbsp; &amp;nbsp;I could easily fix this problem by flipping the object in my modeling application and having two versions (left,right).&amp;nbsp; I could easily ignore the issue too given it doesn't effect the aesthetic in this case that much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what I want to know is,&amp;nbsp;is this a bug or did I use the operation wrong or is there another operation that does this better?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See image below:&amp;nbsp; jhook on left is the original insert object form and has proper shadows but also uses the mirror flip (true,false,true).&amp;nbsp; While, the object on the right &lt;SPAN style="text-decoration: underline;"&gt;needs&lt;/SPAN&gt; to have a mirror flip to be the correct form of the stream restoration intervention (if I am going to use a single insert object).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit #1:&amp;nbsp; So its not the shadows or AO, I can turn those off and it still has this dark side showing.&amp;nbsp; I tried a reverseNormals at the end and that did nothing.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="485398" alt="CityEngine Stream Restoration Image - for question" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/485398_Stream Restoration Concept #10.png" /&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;JHookSpace(Right)--&amp;gt;
	s('1,'1,'1)
	t(0,-1.1,3)
	r(0,10,0)
	color(RockColor)
	i("BWAssets/StreamRestoration_Textures/jhook.fbx")												
	mirror(true,false,false)
							
JHookSpace(Left)--&amp;gt;
	s('1,'1,'1)
	t(0,-1.1,-3)
	r(0,-10,0)
	color(RockColor)
	i("BWAssets/StreamRestoration_Textures/jhook.fbx")												
	mirror(true,false,true)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445135#M6081</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T19:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Shadows on Insert Object with Mirror Operation</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445136#M6082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, this is a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing you could do is use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;setNormals()&lt;/SPAN&gt; or &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;softenNormals()&lt;/SPAN&gt; to recalculate the vertex normals, but this is not exactly what you want because it won't let you keep the original normals in the inserted object.&amp;nbsp; It might, however, provide a better approximation to the vertex normals so that the lighting doesn't look so strange, or it might not look any better.&amp;nbsp; The other caveat is that depending on the geometry connectivity, it may or may not need a &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;cleanupGeometry()&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-set-normals.htm" title="https://doc.arcgis.com/en/cityengine/latest/cga/cga-set-normals.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;setNormals operation—CGA | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-soften-normals.htm" title="https://doc.arcgis.com/en/cityengine/latest/cga/cga-soften-normals.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;softenNormals operation—CGA | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One hacky workaround to keep the original vertex normals would be to resize the object in the negative direction and then translate it.&amp;nbsp; If the number of axes you invert is odd, then you need to also add a &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;reverseNormals&lt;/SPAN&gt; (if even, you don't need the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;reverseNormals&lt;/SPAN&gt;).&amp;nbsp; Here is the case to mirror something in &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;x&lt;/SPAN&gt; only.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;s('-1,'1,'1)
t('-1,0,0)
reverseNormals‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445136#M6082</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2021-12-11T19:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shadows on Insert Object with Mirror Operation</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445137#M6083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cheryl!&amp;nbsp; I appreciate your time and expertise!&amp;nbsp; I will try your suggestions next time I have this issue and let you know how they go.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up using the Rotate operation to rotate 180 on the z axis (actually 182), but at first it rotated my object outside my "JHookSpace".&amp;nbsp; &amp;nbsp;So I had to Translate the object back&amp;nbsp;on the x-axis by the distance of the "JHookLength" (which I set as an attribute for adjusting the JHook x and z scales) .&amp;nbsp; The "dark side" doesn't appear for me using these operations instead.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;JHookSpace(Right)--&amp;gt;
	s('1,'1,'1)
	t(JHookLength,2.5,0)
	r(0,-10,182)
	color(RockColor)
	i("BWAssets/StreamRestoration_Textures/jhook.fbx")&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I did not run a cleanupGeometry or softenNormals on these Insert objects yet and that would definitely be a good suggestion regardless of my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!!&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/shadows-on-insert-object-with-mirror-operation/m-p/445137#M6083</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T19:53:38Z</dc:date>
    </item>
  </channel>
</rss>

