How to texture the roof of a rotated house with a north-aligned image?

817
4
04-26-2018 05:34 AM
LR
by
Occasional Contributor III

I have square textures cut from an aerial image that I need to apply to various roofs. For the cutout shape I used the bounding boxes of the footprints, so I have the roof image and whatever's around. I aligned the scope to world and use sx and sz as sizes, so theoretically the roof texture should line up nicely with the roof and the rest of the image would not be visible. Unfortunately the image's skewed no matter how I rotate it. Any way to get this to work?

Tags (3)
0 Kudos
4 Replies
ThomasFuchs
Esri Regular Contributor

Hi L R

Thank you for your question.

You need to setup the projection along the world axis. The section Global Texture Projection in the help for the CGA setupProjection operation—Esri CityEngine | ArcGIS Desktop gives a practical example:

attr buildingheight= 20
  
const textureWidth = 586
const textureHeight = 442  
  
offsetx = convert(x, scope, world, pos, 0, 0, 0) -
             (convert(x, scope, world, pos, 0, 0, 0) % textureWidth)

offsetz = convert(z, scope, world, pos, 0, 0, 0) -
             (convert(z, scope, world, pos, 0, 0, 0) % textureHeight)
   
Lot-->
   set(trim.vertical, false)
   extrude(buildingheight)
   comp(f){top :  Roof | side : Facade}
 
Roof-->
   setupProjection(0, world.xz, textureWidth, textureHeight, -offsetx, offsetz)
   projectUV(0)
   scaleUV(0, 1, -1)
   set(material.colormap, "test_0102_ortho.jpg")‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
LR
by
Occasional Contributor III

Forgot to mention: I wanted to avoid offsets/image sampling if possible because they don't work in ArcGIS Pro.

The above method works in CE, I just had to shuffle the sizing and offset down to the roof part.

Also the reason why I'm using cut out images instead of a single aerial image is because Multipatch export exports the whole image per roof, creating gigantic datasets.

0 Kudos
ThomasFuchs
Esri Regular Contributor

From CityEngine 2017.1 on, the multipatch exporter is preventing this overhead:
CityEngine 2017.1 release notes—Esri CityEngine | ArcGIS Desktop

The File GeoDatabase (FileGDB) exporter has been improved by cropping textures to the actually used regions. This reduces file size and loading time in many cases.
LR
by
Occasional Contributor III

It looks like the pre-cropped images method blurs the texture less than the global one. See images below..

  1. a 4000x4000 terrain, with a 4000x4000 texture. Because the cell size is 0.5, this equals a X/Z size of 2000 in the scene
  2. a circle textured with the global method. Texture scale and offset equal the terrain's values in the scene (w/h=2000)
  3. same circle, textured by clipping the texture to its bounding box first and then applying the clipped image by using the building's scope and x/z position

Good to know the aerials get cropped now. Many roofs end up pretty funky looking when opened in ArcScene 10.5, though. However, they do look as expected in Pro. FME also displays them correctly.

 

0 Kudos