<?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 Occlusion function inconsistencies in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/occlusion-function-inconsistencies/m-p/454914#M6217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I am trying to use the Occlusion function to detect if the edges of two&amp;nbsp;&lt;SPAN&gt;procedurally&amp;nbsp;created&lt;/SPAN&gt; objects touch.&lt;/P&gt;&lt;P&gt;A simple example I made for a cube worked flawlessly, then I moved to my actual objects.&lt;/P&gt;&lt;P&gt;The query I am using for the cylinder-like object is just an extrusion and for the developing upside-down cone is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;@StartRule
Lot--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;extrude(0.2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;center(xz)
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f) {bottom : Root}
 
Root--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case(scope.sx &amp;gt; 0.5):
&amp;nbsp;&amp;nbsp;&amp;nbsp;s('0.97, '0.97, 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;center(xy)
&amp;nbsp;&amp;nbsp;&amp;nbsp;color(0,0.4,0.7) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;extrude(0.5)Facades
&amp;nbsp;&amp;nbsp;&amp;nbsp;X
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f){top : Root}
&amp;nbsp;&amp;nbsp;&amp;nbsp;else: NIL

Facades--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f){side:OcclusionDetection | bottom:OcclusionDetection | top:OcclusionDetection}
 
OcclusionDetection --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case overlaps (inter):
&amp;nbsp;&amp;nbsp;&amp;nbsp;color("#ff0000")
&amp;nbsp;&amp;nbsp;&amp;nbsp;X
&amp;nbsp;&amp;nbsp;&amp;nbsp;else: color("#c3ff00")&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;/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;P&gt;&lt;/P&gt;&lt;P&gt;The result is on the image:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/368411_OcclusionQuery.jpg" style="width: 620px; height: 402px;" /&gt;&lt;/P&gt;&lt;P&gt;Image assessment:&lt;/P&gt;&lt;P&gt;1. there is a "ghost" touch, 2. this is my aim accomplished and 3. that interaction is not registered this time (although earlier it was registering). I move&amp;nbsp;around the yellow-green object to make it re-render and register the overlaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inconsistent behaviour of the occlusion function. The script worked fine the first time I compiled it and after a minute it stopped working. By not working I mean, registering all the time that there is no overlap or having a problem to display the &lt;EM&gt;OcclusionDetection &lt;/EM&gt;colours&amp;nbsp;on-top of the &lt;EM&gt;Root&lt;/EM&gt; colour. It took a lot of time fiddling&amp;nbsp;around with it, although practically staying the same, to make it work again.All these in addition&amp;nbsp;to the issues 1 and 3 from the picture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there a way to improve my script and make&amp;nbsp;it work consistently?&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;The City Engine version used is 2015.2, on a Win 10 system, with Intel Core i5 M520, 6GB RAM, GT320M, SSD&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:17:31 GMT</pubDate>
    <dc:creator>GeorgiosAnastasiou</dc:creator>
    <dc:date>2021-12-11T20:17:31Z</dc:date>
    <item>
      <title>Occlusion function inconsistencies</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/occlusion-function-inconsistencies/m-p/454914#M6217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I am trying to use the Occlusion function to detect if the edges of two&amp;nbsp;&lt;SPAN&gt;procedurally&amp;nbsp;created&lt;/SPAN&gt; objects touch.&lt;/P&gt;&lt;P&gt;A simple example I made for a cube worked flawlessly, then I moved to my actual objects.&lt;/P&gt;&lt;P&gt;The query I am using for the cylinder-like object is just an extrusion and for the developing upside-down cone is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;@StartRule
Lot--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;extrude(0.2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;center(xz)
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f) {bottom : Root}
 
Root--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case(scope.sx &amp;gt; 0.5):
&amp;nbsp;&amp;nbsp;&amp;nbsp;s('0.97, '0.97, 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;center(xy)
&amp;nbsp;&amp;nbsp;&amp;nbsp;color(0,0.4,0.7) 
&amp;nbsp;&amp;nbsp;&amp;nbsp;extrude(0.5)Facades
&amp;nbsp;&amp;nbsp;&amp;nbsp;X
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f){top : Root}
&amp;nbsp;&amp;nbsp;&amp;nbsp;else: NIL

Facades--&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;comp(f){side:OcclusionDetection | bottom:OcclusionDetection | top:OcclusionDetection}
 
OcclusionDetection --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case overlaps (inter):
&amp;nbsp;&amp;nbsp;&amp;nbsp;color("#ff0000")
&amp;nbsp;&amp;nbsp;&amp;nbsp;X
&amp;nbsp;&amp;nbsp;&amp;nbsp;else: color("#c3ff00")&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;/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;P&gt;&lt;/P&gt;&lt;P&gt;The result is on the image:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/368411_OcclusionQuery.jpg" style="width: 620px; height: 402px;" /&gt;&lt;/P&gt;&lt;P&gt;Image assessment:&lt;/P&gt;&lt;P&gt;1. there is a "ghost" touch, 2. this is my aim accomplished and 3. that interaction is not registered this time (although earlier it was registering). I move&amp;nbsp;around the yellow-green object to make it re-render and register the overlaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inconsistent behaviour of the occlusion function. The script worked fine the first time I compiled it and after a minute it stopped working. By not working I mean, registering all the time that there is no overlap or having a problem to display the &lt;EM&gt;OcclusionDetection &lt;/EM&gt;colours&amp;nbsp;on-top of the &lt;EM&gt;Root&lt;/EM&gt; colour. It took a lot of time fiddling&amp;nbsp;around with it, although practically staying the same, to make it work again.All these in addition&amp;nbsp;to the issues 1 and 3 from the picture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there a way to improve my script and make&amp;nbsp;it work consistently?&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;The City Engine version used is 2015.2, on a Win 10 system, with Intel Core i5 M520, 6GB RAM, GT320M, SSD&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:17:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/occlusion-function-inconsistencies/m-p/454914#M6217</guid>
      <dc:creator>GeorgiosAnastasiou</dc:creator>
      <dc:date>2021-12-11T20:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Occlusion function inconsistencies</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/occlusion-function-inconsistencies/m-p/454915#M6218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you move the cylinder, then the cylinder regenerates, but the other objects in your scene are not regenerating.&amp;nbsp; This might be why the occlusion is not detected in 3.&amp;nbsp; If there was a something triggering occlusion in region 1 before and then this shape got moved, then this might also explain why region 1 remains red.&amp;nbsp; If you move the yellow-red vertical object that is performing the occlusion queries, then it gets regenerated and should show the correct colors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Root rule, there is a line that says: X.&amp;nbsp; This creates a terminal shape (meaning, it creates geometry that is displayed) with the blue color defined 2 lines before.&amp;nbsp; Then, in the OcclusionDetection rule, the case creates either a red shape or a yellow shape.&amp;nbsp; The red and yellow shapes are placed in the same spot as the blue shapes, so they fight each other to be rendered.&amp;nbsp; This is why it is hard to see the red and yellow colors.&amp;nbsp; If you take out the X in the Root rule, then you will have only red or yellow faces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since we have fixed some occlusion bugs since 2015.2 and added new features to occlusion queries (labels), I would recommend upgrading to the latest version (currently 2017.0).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Sep 2017 16:56:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/occlusion-function-inconsistencies/m-p/454915#M6218</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2017-09-29T16:56:47Z</dc:date>
    </item>
  </channel>
</rss>

