<?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: Texturing lots with the terrain texture? in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401737#M5531</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://www.geoplanit.co.uk/?p=470" rel="nofollow noopener noreferrer" target="_blank"&gt;This &lt;/A&gt;&lt;SPAN&gt;might be what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# dimension of the satellite map
const mapdimension_x = 1134.181 #change this to satellite image details
const mapdimension_z = 939.650 #change this to satellite image details
# offset of the satellite map
const mapoffset_x = 597694.521 #change this to satellite image details
const mapoffset_z = -3560369.907 #change this to satellite image details
Lot--&amp;gt;
extrude(rand(3,15)) Mass
Mass --&amp;gt;
# split building mass into roof and side faces
comp(f){top : Roof | side : Facade}
Roof --&amp;gt; Rooftex
Rooftex --&amp;gt; 
setupProjection(0, world.xz, mapdimension_x, mapdimension_z) 
set(material.colormap, "maps/SATELLITEIMAGENAME.jpg") #change this 
projectUV(0) 
translateUV(0, -mapoffset_x/mapdimension_x, -mapoffset_z/mapdimension_z) 
scaleUV(0,1,-1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thibault&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:18:57 GMT</pubDate>
    <dc:creator>ThibaultThibault1</dc:creator>
    <dc:date>2021-12-11T18:18:57Z</dc:date>
    <item>
      <title>Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401734#M5528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to do this? In dense urban areas, it's great to have textures for various shapes but in the case where the lot covers a nice expanse of land, it is sometimes more economical to just texture that lot with the imagery and let it be flat. I wouldn't mind leaving the terrain mesh exposed in those areas but in large databases the streets z-fight with the terrain so in those cases it is better to just texture the lots. Are there any rules for such a thing?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 19:10:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401734#M5528</guid>
      <dc:creator>NicoleMiller</dc:creator>
      <dc:date>2013-07-29T19:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401735#M5529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sure !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just change the values to your terrain's values ( select terrain layer, check values in Inspector. ) Note that CityEngine is yUp, not zUp as ArcGIS )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;satelliteImage = "maps/mySatellitePic.jpg" satelliteImageData(data) =&amp;nbsp; case data == "SX"&amp;nbsp;&amp;nbsp; : 1000&amp;nbsp; case data == "SZ"&amp;nbsp;&amp;nbsp; : 1000&amp;nbsp; case data == "OX"&amp;nbsp;&amp;nbsp; : 1000&amp;nbsp; case data == "OZ"&amp;nbsp;&amp;nbsp; : -1000&amp;nbsp; else : 1&amp;nbsp; setupProjection(0,world.xz,satelliteImageData("SX"), -satelliteImageData("SZ"), satelliteImageData("OX"), satelliteImageData("OZ")) projectUV(0) texture(satelliteImage)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;let me know if this works ..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 07:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401735#M5529</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2013-07-31T07:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401736#M5530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It says Mismatched Token (setupProjection)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I looked up setupProjection in the help file, it seems like uvSet, axesSelector, texWidth, texHeight, widthOffset and heighOffset were assigned. I am not sure what it doesn't like when trying to create this rule.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 19:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401736#M5530</guid>
      <dc:creator>NicoleMiller</dc:creator>
      <dc:date>2013-07-31T19:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401737#M5531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://www.geoplanit.co.uk/?p=470" rel="nofollow noopener noreferrer" target="_blank"&gt;This &lt;/A&gt;&lt;SPAN&gt;might be what you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# dimension of the satellite map
const mapdimension_x = 1134.181 #change this to satellite image details
const mapdimension_z = 939.650 #change this to satellite image details
# offset of the satellite map
const mapoffset_x = 597694.521 #change this to satellite image details
const mapoffset_z = -3560369.907 #change this to satellite image details
Lot--&amp;gt;
extrude(rand(3,15)) Mass
Mass --&amp;gt;
# split building mass into roof and side faces
comp(f){top : Roof | side : Facade}
Roof --&amp;gt; Rooftex
Rooftex --&amp;gt; 
setupProjection(0, world.xz, mapdimension_x, mapdimension_z) 
set(material.colormap, "maps/SATELLITEIMAGENAME.jpg") #change this 
projectUV(0) 
translateUV(0, -mapoffset_x/mapdimension_x, -mapoffset_z/mapdimension_z) 
scaleUV(0,1,-1)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thibault&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:18:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401737#M5531</guid>
      <dc:creator>ThibaultThibault1</dc:creator>
      <dc:date>2021-12-11T18:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401738#M5532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The thing I posted is a 'newer', more clean version of what Thibault also posted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Though the code posted only contains the code to texture the shape. So I'm not sure if you did not add the rest of the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you see in my code, the actual Rule is not defined ..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;E.g. Roof --&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know ..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 11:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401738#M5532</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2013-08-02T11:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401739#M5533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying your code Matthias, but I don't understand where to put the code ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add it to a rule in my cga file I get an error "No Viable Alt (satelliteImage)".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add it to the "Layer Attributes" of the "Lot" Layer (in my base "Building" Layer) I get 2 erros.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code I found is to be used in a CGA file. It looks like that in mine :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;version "2012.1"

const terrain_dimension_x = 2195.5
const terrain_dimension_z = 2034.5
const terrain_offset_x = 711075.750
const terrain_offset_z = -6654980.750

attr HAUTEUR = 0 #Mapped to an object attribute imported from the file GDB

@StartRule
Building --&amp;gt;
 extrude(HAUTEUR)
 comp(f) { top : Roof | side : Facade }

Roof --&amp;gt;
 setupProjection(0, world.xz, terrain_dimension_x, terrain_dimension_z)
 set(material.colormap, "texture/ortho16s.tif")
 projectUV(0)
 translateUV(0, -terrain_offset_x /terrain_dimension_x, -terrain_offset_z /terrain_dimension_z)
 scaleUV(0, 1, -1)

Facade --&amp;gt; ...&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401739#M5533</guid>
      <dc:creator>ThibaultThibault1</dc:creator>
      <dc:date>2021-12-11T18:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401740#M5534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, the code goes in a CGA file, not in the terrain layer. You want to texture a part of the model which is created based on a shape.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the code should look like :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
satelliteImage = "maps/mySatellitePic.jpg"
satelliteImageData(data) =
 case data == "SX"&amp;nbsp;&amp;nbsp; : 1000
 case data == "SZ"&amp;nbsp;&amp;nbsp; : 1000
 case data == "OX"&amp;nbsp;&amp;nbsp; : 1000
 case data == "OZ"&amp;nbsp;&amp;nbsp; : -1000
 else : 1

@StartRule
Building --&amp;gt;
 extrude(HAUTEUR)
 comp(f) { top : Roof | side : Facade }

Roof --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; setupProjection(0,world.xz,satelliteImageData("SX"), -satelliteImageData("SZ"),satelliteImageData("OX"),satelliteImageData("OZ"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; projectUV(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; texture(satelliteImage)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Roof.
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, edit the 4 values with the values you find in your actual terrain layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry that this was unclear. All start is hard .. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401740#M5534</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2021-12-11T18:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Texturing lots with the terrain texture?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401741#M5535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It works great, your version of the code is shorter and clearer (I struggled to get the translation right in the previous code I used).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your quick reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thibault&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 14:15:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/texturing-lots-with-the-terrain-texture/m-p/401741#M5535</guid>
      <dc:creator>ThibaultThibault1</dc:creator>
      <dc:date>2013-08-02T14:15:54Z</dc:date>
    </item>
  </channel>
</rss>

