Importing Terrain and applying textures to roofs

4390
13
Jump to solution
07-30-2012 03:28 PM
JoanneO_Brien
Occasional Contributor
Hi
So this is two topics that are related:

1) The first is I'm having issues importing terrain and texture. Are there some clear instructions somewhere on how to do this correctly? The issue for me I think is exporting it from ArcGIS. I have a DEM in ArcGIS and an aerial image for my texture file. I read somewhere that the aerial images don't display properly if the file size is too large, which I suspect might be an issue for me. I also read that the aerial image and the DEM file need to be the same extent? So what size is deemed too large and how do I crop and export to a suitable area for it to display in CityEngine?

2) When I finally succeed in bringing in the aerial image I'd like to be able to use the photograph as a texture layer for my roof's, how is this achieved?

3) I also have in my shapefile attributes the building heights, but these heights are in relation to the sealevel, so I'm hoping that when the DEM model is imported correctly I can use this to produce the correct heights of the buildings, would this be the case?

Hope that all makes sense!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor
hi !

1]
this thread may help you
http://forums.arcgis.com/threads/54072-textures-raster-files-concepts-in-CityEngine-ArcGIS

let me know if there's more questions which remain.


2]

use this code : of course, use your specific values and file name and edit the code to texture the roofs instead of the lots. 🙂

you find the actual size and offset values in the Inspector when you select the terrain layer.

attr satellitePicture = "maps/mySatellitePicture.jpg"  attr sizeX   = 6121.562 attr sizeZ   = 6121.562 attr offsetX  = 492498.385 attr offsetZ  = -28242.388  Lot -->  setupProjection(0,world.xz,sizeX, -sizeZ, offsetX, offsetZ)  projectUV(0)  texture(satellitePicture)


3]

when you have an object attribute with the sea level, then you'll just import the shapes and leave them on height = 0. then, in CGA, initialize an attribute with the same name as the object attribute and point all attribute values to the object attribute with the connection editor. use this to translate the shape up first, before you extrude the building. in other words, that translation in height is now a part of the way the model is being built instead of moving the static (imported) shape to the correct height.

e.g.
attr heightAboveSeaLevel = 0 # initialize the attr  Lot -->     alignScopeToAxes(y)     t(0,heightAboveSeaLevel ,0)     Continue.




hope this makes sense. let me know.

View solution in original post

0 Kudos
13 Replies
MatthiasBuehler1
Frequent Contributor
hi !

1]
this thread may help you
http://forums.arcgis.com/threads/54072-textures-raster-files-concepts-in-CityEngine-ArcGIS

let me know if there's more questions which remain.


2]

use this code : of course, use your specific values and file name and edit the code to texture the roofs instead of the lots. 🙂

you find the actual size and offset values in the Inspector when you select the terrain layer.

attr satellitePicture = "maps/mySatellitePicture.jpg"  attr sizeX   = 6121.562 attr sizeZ   = 6121.562 attr offsetX  = 492498.385 attr offsetZ  = -28242.388  Lot -->  setupProjection(0,world.xz,sizeX, -sizeZ, offsetX, offsetZ)  projectUV(0)  texture(satellitePicture)


3]

when you have an object attribute with the sea level, then you'll just import the shapes and leave them on height = 0. then, in CGA, initialize an attribute with the same name as the object attribute and point all attribute values to the object attribute with the connection editor. use this to translate the shape up first, before you extrude the building. in other words, that translation in height is now a part of the way the model is being built instead of moving the static (imported) shape to the correct height.

e.g.
attr heightAboveSeaLevel = 0 # initialize the attr  Lot -->     alignScopeToAxes(y)     t(0,heightAboveSeaLevel ,0)     Continue.




hope this makes sense. let me know.
0 Kudos
JoanneO_Brien
Occasional Contributor
Hi!

1) Thanks a lot, as I suspected my images were too large to be imported properly, but have cut down the area and size for success!

2) am still getting to that one... 🙂

3) Still having problems with this, so the code you gave me works fine but am having an issue now that my buildings are floating above the imported terrain (see attached image), how do I get it to align correctly onto the terrain?
0 Kudos
JoanneO_Brien
Occasional Contributor
Actually I have a slightly more serious issue than floating buildings. So I looked more closely at my height data, and originally I'd thought it was the height + 10m as it'd come from ortho images, but taking off the 10m's left some buildings floating and some buried in the ground. I realised that infact the data has been fully taken from sealevel so if I leave the landparcels at sealevel and extrude the buildings then the heights from the terrain and textures look fine but because the base of the buildings is extruded beneath the terrain I'm going to have trouble applying rules to the buildings as the ground floor will not be visible. I'll attach images to explain better:
            -   The first image is the buildings where I'd taken 10m away from the height, so some are floating and some arn't.
            -   The Second shows the buildings with the base at sea level and poking through the terrain layer.
            -   The third is the buildings seen above the terrain at the height's I'd like them to be!

Is there a way add a function into my rule file to take the difference between the sealevel and the terrain off my height to extrude all the buildings correctly?

In other news the textures being added to the roof worked fine!
0 Kudos
MatthiasBuehler1
Frequent Contributor
you could also just select all footprints and use the align function.

in the Shapes menu, align the shapes to the terrain. don't use the project option, you want to have the footprints flat. play a little with the options.

once the shapes are in place, there's also a function where you then can align the terrain back to the shapes.

this should work. 🙂
0 Kudos
JoanneO_Brien
Occasional Contributor
Hi

thanks that worked really well for alighning the building footprints to the terrain, but I still have a problem with the height. My data is represented as height of building from sealevel rather than from the terrain so is it possible for city Engine to work out the height of land from sealevel so that I can create a function which says:

             buildingHeightAboveSealevel = buildingHeight - terrainHeight

where terrainHeight is the parameter I need CityEngine to first be able to calculate for me before I can calculate the buildingHeightAboveSealevel.
0 Kudos
JoanneO_Brien
Occasional Contributor
I was having a think about this a bit more and was wondering if there was a way to reference the elevation attribute in the terrain layer the same way we would for a shapefile attribute? That way I'd just need to tell my parcel to subtract the elevation attribute in the terrain layer from the height attribute in the shapefile layer to give the parcel's actual height.
0 Kudos
MatthiasBuehler1
Frequent Contributor
not perfectly sure if I understand correctly.


what you can do is query the height above zero at the very beginning of the model creation for use in CGA. would that help you ?
0 Kudos
JoanneO_Brien
Occasional Contributor
Hmm that could be useful, how would you do that?

I ended up having to do a long complex process in ArcGIS to gather actual heights for most of the buildings but a couple of them have still come out wrong so would be interesting to see if another method would work better.
0 Kudos
MatthiasBuehler1
Frequent Contributor
With the convert() function, you can get the height of the street shape�??s scope directly in world coordinates.

heightOverTerrain = convert(y,scope,world,pos,scope.sx*0.5,scope.sy*0.5,scope.sz*0.5)-elevation
( note the sx,sy,sz * 0.5 is the offset of the sampled point towards the center of the scope, thus the height sampled is calculated in the �??middle�??. )

of course, this is just a simplification.

�??elevation�?? is an attr which is derived from the terrain map layer.

Let me know if this already helps you further or need an example. convert() is quite complex and not easily to understand.
0 Kudos