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?
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")
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.
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.
It looks like the pre-cropped images method blurs the texture less than the global one. See images below..
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.