Before we start the code I used here came from a GIS mapping tutorial from CityEngine, I can’t seem to find the original page after them being merged with ESRI but you can see a cached copy of the page here.
First let us get some satellite imagery, I suggest you use an extract from an existing satellite imagery from your GIS. If you are taking the imagery from elsewhere you don’t need to follow all these steps…
- In ArcGIS — Draw a box using the Draw toolbar
- In ArcGIS — Select the underlying imagery in the Table of Contents right-click and select “Data –> Export Data”. Depending on what your are doing and the size of imagery you want you may want to use JPG and the settings below have worked for me. I suggest you experiment for the best results. I also suggest you export straight to the maps directory in your CityEngine project
- In CityEngine — Drag and drop from your maps directory into your CityEngine scene, it should come in under any data you already have. If it doesn’t check that in the Scene window the map layer does not have the eye crossed out also ensure that the show/hide map layers button is clicked.
- In CityEngine — Create a new rule file and copy this code in (be sure to change the relevant parts to your settings).
# 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--> extrude(rand(3,15)) Mass Mass --> # split building mass into roof and side faces comp(f){top : Roof | side : Facade} Roof --> Rooftex Rooftex --> 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)
- In CityEngine — To get the x-size and x-offset numbers select the map layer in the Scene window (default location bottom left) and look at the Layer tab in the Inspector window (default right), copy these numbers to the const variables at the beginning of the rule file.
- In CityEngine — Now apply that rule (after changes to your shapes/lots) and generate your model!
Hi
I was planning to make a before after of an irregular area. Is it possible in the newer version of CityEngine?
PS: Have you a more detailed document of how to implement a model based on a satelite image?
Regards
Ezequias Rocha
Hi
I was planning to make a before after of an irregular area (not a square). Is it possible in the newer version of CityEngine?
PS: Have you a more detailed document of how to implement a model based on a satelite image?
Regards
Ezequias Rocha
This was awesomely useful!
Thanks and Cheers,
Don
very well idea ..I was planning to make a before after of an irregular area. Is it possible in the newer version of City Engine?can you tell me how i can do this,plz give me more details about it.
To do a ‘before and after’ of an area you can simplying put a toggle (i.e. true or false statement) in you rule file for different scenarios. Or just duplicate the layer.
Hi Elliot, your code is indeed very useful! However I have encountered spillover texturing to the facade as I would want the roof only to be textured. Any idea how to solve this? Appreciate your help. Thanks
Thanks! Depending on the data you are using, you need to use the component slip operation and only apply the texture rule to the ‘top’ :
comp(f) { top : TOPTEXTURE | side : color(“#0000ff”) Side }
Hope this helps!
Hello great post I’m new to the esri software cityengine is there anyway I can get remote training for my project?
I don’t currently do remote CityEngine training, however we are planning to introduce it in the near future. Contact us directly at info@garsdaledesign.co.uk
very thanks mr Elliot Hartley . your code is indeed very useful.
Thanks, great help,
Now can you give some idea to texture facades/wall from oblique images
You’re welcome, the best guidance is actually in the help file here search for ‘texture’ and at the bottom of the help is example code.
Hi Elliot,
is there an option to get a better resolution?
Greetings and thanks for the code!
Hi and thanks for reading, I think what you’re referring to is the viewport display resolution. This code used on satellite imagery you’ve downloaded will look fuzzy I think in the viewport. What you can do, if you really need a higher res in the viewport (exports are unaffected) is to go to Edit–>Preferences–>Procedural Runtime under the heading ‘Rendering’ and change the max texture height and width (default is 2048). It’s all to do with textures being stored in memory for display so obviously it has to be managed so you can make lots of large cities 🙂 Hope that helped!
Comments are closed.