<?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: CGA Export meshes order in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-export-meshes-order/m-p/1331883#M11182</link>
    <description>&lt;P&gt;The solution I went with was sorting them myself in Unity later by distance.&lt;/P&gt;&lt;P&gt;By using python in CityEngine, first I found start segment of the road and set special attribute roadStart.&lt;BR /&gt;I don't know if there is a better way, but to find start of the road I randomly selected a segment, got its first node by using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ce.getObjectsFrom(currentCheckSegment, ce.isGraphNode)[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then from all segments I found another segment that uses that node as node [1]:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ce.getObjectsFrom(segment, ce.isGraphNode)[1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When there were no more matches, I marked the segment as start of the road and removed all segments that were checked from next searches in case there are other roads.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In .cga rule on the roadStart segment I built the first node with different rule MarkerStart and rest as MarkerVertical, to have its name later in Unity post-processing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;case roadStart == "yes": 
			split(v,unitSpace,0){ '0.1 : NIL | 
								  0.1 : split(u, unitSpace, 0) { 2 : NIL
								  							   | ~0.1 : [MarkerStart(sidewalkSide)]
															   | ~4 : NIL
															   | {~0.1 : [MarkerVertical(sidewalkSide)] | ~4 : NIL}*
															   | ~0.1 : [MarkerVertical(sidewalkSide)]
															   | 2 : NIL }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After exporting from CityEngine and importing the model in Unity, I found object that was called MarkerStart, found all objects named MarkerVertical and sorted them by distance from eachother. As the road in my uses never makes more than 90 degree turn, sorting by distances is more than sufficient.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 09:26:55 GMT</pubDate>
    <dc:creator>AdamChełstowski</dc:creator>
    <dc:date>2023-09-25T09:26:55Z</dc:date>
    <item>
      <title>CGA Export meshes order</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-export-meshes-order/m-p/1328633#M11179</link>
      <description>&lt;P&gt;My current goal is to create a series of points that are next to the road segments, both from left and right side. To accomplish this I tried using special CGA rule on the road and sidewalks that creates these points, then export to the FBX in order to post-process them in Unity.&lt;/P&gt;&lt;P&gt;I also need to specify if the markers are on the left side of the road, or the right side (which was easily done by using different rule for both left and right markers), giving the result as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdamChestowski_1-1694691971786.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80662i15D6A92C07DB9530/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdamChestowski_1-1694691971786.png" alt="AdamChestowski_1-1694691971786.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem I am having, is the created meshes order. In the generated fbx file when testing in Unity, it seems it orders them sometimes ok, sometimes a bit random? (ML - Marker Left, MR - Marker Right)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdamChestowski_2-1694692421749.png" style="width: 391px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80663iBC5C62F7C1287889/image-dimensions/391x283?v=v2" width="391" height="283" role="button" title="AdamChestowski_2-1694692421749.png" alt="AdamChestowski_2-1694692421749.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdamChestowski_3-1694692595739.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80664i5B663C669AE0911F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdamChestowski_3-1694692595739.png" alt="AdamChestowski_3-1694692595739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any way to order those markers, so that they would start from 0 at UV - U0? Or Order them in any way so they won't be suddenly 0 in the middle of the exported road?&lt;BR /&gt;&lt;BR /&gt;I am attaching very simple project to replicate my issue, using CityEngine 2021.0.7316.&lt;BR /&gt;In order to export markers I also used the MeshGranularity option as "Do not merge any meshes"&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 12:04:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/cga-export-meshes-order/m-p/1328633#M11179</guid>
      <dc:creator>AdamChełstowski</dc:creator>
      <dc:date>2023-09-14T12:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: CGA Export meshes order</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/cga-export-meshes-order/m-p/1331883#M11182</link>
      <description>&lt;P&gt;The solution I went with was sorting them myself in Unity later by distance.&lt;/P&gt;&lt;P&gt;By using python in CityEngine, first I found start segment of the road and set special attribute roadStart.&lt;BR /&gt;I don't know if there is a better way, but to find start of the road I randomly selected a segment, got its first node by using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ce.getObjectsFrom(currentCheckSegment, ce.isGraphNode)[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then from all segments I found another segment that uses that node as node [1]:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ce.getObjectsFrom(segment, ce.isGraphNode)[1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When there were no more matches, I marked the segment as start of the road and removed all segments that were checked from next searches in case there are other roads.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In .cga rule on the roadStart segment I built the first node with different rule MarkerStart and rest as MarkerVertical, to have its name later in Unity post-processing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;case roadStart == "yes": 
			split(v,unitSpace,0){ '0.1 : NIL | 
								  0.1 : split(u, unitSpace, 0) { 2 : NIL
								  							   | ~0.1 : [MarkerStart(sidewalkSide)]
															   | ~4 : NIL
															   | {~0.1 : [MarkerVertical(sidewalkSide)] | ~4 : NIL}*
															   | ~0.1 : [MarkerVertical(sidewalkSide)]
															   | 2 : NIL }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After exporting from CityEngine and importing the model in Unity, I found object that was called MarkerStart, found all objects named MarkerVertical and sorted them by distance from eachother. As the road in my uses never makes more than 90 degree turn, sorting by distances is more than sufficient.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 09:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/cga-export-meshes-order/m-p/1331883#M11182</guid>
      <dc:creator>AdamChełstowski</dc:creator>
      <dc:date>2023-09-25T09:26:55Z</dc:date>
    </item>
  </channel>
</rss>

