CityEngine + Metropolitan Pack = Fantastic Cities?

2525
5
08-21-2013 05:54 PM
WinterT
New Contributor
Can CityEngine import complex models like the ones provided in the Element 3D Metropolitan Pack found here? https://www.videocopilot.net/products/3d/metropolitan/
I would like to import these models into CityEngine and export the result for use in a game engine. Either as individual parts of one solid mesh, either way would work for me. The models provided in this pack come in Obj, Fbx, C4d, and Max. I tried importing detailed objs with the 2010 version but it never worked, they never would appear in the scene and no obj import screen like the one shown in the tutorial video here ever popped up. http://video.arcgis.com/watch/1771/tutorial-5-import-initial-shapes @6:25.

Any ideas if CityEngine could handle these types of models?
Tags (2)
0 Kudos
5 Replies
MatthiasBuehler1
Frequent Contributor II
Hi,


Yes, that should work.

Have a look at the insert operation i() and the sciFi city example we have.

The Obj and Dae file formats are our 3d asset file formats, so you should be able to instanciate as many of those buildings in your specific urban layouts. I don't see any problems there.

matt
0 Kudos
WinterT
New Contributor
Hi,


Yes, that should work.

Have a look at the insert operation i() and the sciFi city example we have.

The Obj and Dae file formats are our 3d asset file formats, so you should be able to instanciate as many of those buildings in your specific urban layouts. I don't see any problems there.

matt


Could you elaborate a bit on the operation i() and the scifi city example or provide me with links to them. I can't seem to find any tutorial on the i() operation and all searches for the scifi city lead me to nothing to help explain how to import premade 3d buildings.
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi,

sure ! :)

here's the example : http://resources.arcgis.com/en/communities/city-engine/01w90000000r000000.htm#s=0&n=30&d=1&md=cte-ce...

download the 'Example Instance City 2012'.

i() inserts an asset in the current scope. basically that way, you create instances of assets in CityEngine. this example shows how instead of modeling all buildings procedurally, you can also use premodeled buildings and insert them according to their best-fitting ratio or size in the scope of a shape.

the same methodology is used to e.g. distribute trees on point marker shapes.


maybe start with the following code on 1 shape :
( copy 1 obj file in the assets folder .. )

buildingAsset = "assets/skyscraper_1.obj"

Lot -->
     alignScopeToAxes(y)
    s(0,0,0)
    i(buildingAsset)
    Building.



let me know if there's more questions, ok ?

have fun !

Matt
0 Kudos
WinterT
New Contributor
Hi,

sure ! :)

here's the example : http://resources.arcgis.com/en/communities/city-engine/01w90000000r000000.htm#s=0&n=30&d=1&md=cte-ce...

download the 'Example Instance City 2012'.

i() inserts an asset in the current scope. basically that way, you create instances of assets in CityEngine. this example shows how instead of modeling all buildings procedurally, you can also use premodeled buildings and insert them according to their best-fitting ratio or size in the scope of a shape.

the same methodology is used to e.g. distribute trees on point marker shapes.


maybe start with the following code on 1 shape :
( copy 1 obj file in the assets folder .. )

buildingAsset = "assets/skyscraper_1.obj"

Lot -->
     alignScopeToAxes(y)
    s(0,0,0)
    i(buildingAsset)
    Building.



let me know if there's more questions, ok ?

have fun !

Matt


That worked like a charm, thank you so much! The i() is really handy. I adapted that code to work for 6 different buildings by adding this line.
attr buildingAsset = assetApproxSize("*/assets/*.obj", "xz", 6)

Lot -->
    
    alignScopeToAxes(y)
    s(0,0,0)
    i(buildingAsset)
    Building


Now it does populate the 6 building options I just have to figure out how to make them properly fit into the lots and align themselves so it doesn't look so messy. The Instance City example cga file had quite a few errors and I couldn't get it to run so I can't quite figure out how they solved that issue. Since I'm new to cga I can't even tell whats valid or not with their code. I'm just guessing but I think it had something to do with alignScopeToGeometry and alignScopeToAxes not sure how though.

Instance City Code below:
/**
 * File:    instance_city_on_ground.cga
 * Created: 5 May 2010 09:21:09 GMT
 * Author:  andi
 */

version "2011.1"

# select one of the best 3 fitting building asset
attr scifiasset = assetApproxSize("*/assets/scifi_building_*.obj", "xz", 3)
 
# RULES ###########

###################################
# Buildings
#

@StartRule 
Lot -->  
 Ground
 convexify comp(f){all : alignScopeToGeometry(yUp,0,longest) innerRect Footprint }

LotCorner --> Ground
LotInner --> Lot


Footprint --> 
 alignScopeToAxes(y) 
 Building

 
Building --> 
 i(scifiasset)
 # specularity
 set(material.specular.r,70) # for the looks in the CityEngine we add some over-exagerated specularity (otherwise the model is too dark for opengl...)
 set(material.specular.g,70)
 set(material.specular.b,70)  
 set(material.specularmap,"assets/scifi_texture_refl_2k.jpg")
 set(material.shininess,20)
 # bump
 set(material.bumpmap,"assets/scifi_texture_bump_2k.jpg")
 set(material.bumpValue, -.1) 
 # opacity
 set(material.opacitymap,"assets/scifi_texture_opacity_2k.jpg")
 # reflectivity
 set(material.reflectivity, 2.3)


Ground -->
 setupProjection(0,world.xz,300,2048) projectUV(0)
 texture("scifi_texture_ground.jpg")
 # specularity
 set(material.specular.r,10) # for the looks in the CityEngine we add some over-exagerated specularity (otherwise the model is too dark for opengl...)
 set(material.specular.g,10)
 set(material.specular.b,10)  
 set(material.specularmap,"scifi_texture_ground.jpg")
 set(material.shininess,15)
 # bump
 set(material.bumpmap,"assets/scifi_texture_ground.jpg")
 set(material.bumpValue, -.25) 
 # reflectivity
 set(material.reflectivity, 1.2) 



###################################
# Streets
#

Street --> StreetTex
Sidewalk --> comp(f) {all: split(y) { 2 : StreetLine | ~1: Ground } } 
Crossing --> StreetTex

Junction --> Crossing
JunctionEntry --> Street

StreetTex --> 
 setupProjection(0.0, scope.xz, 600, 300)
 texture("assets/scifi_texture_street_dark.jpg") projectUV(0.0)
 # specularity
 set(material.specular.r,20) # for the looks in the CityEngine we add some over-exagerated specularity (otherwise the model is too dark for opengl...)
 set(material.specular.g,20)
 set(material.specular.b,20)  
 #set(material.specularmap,"assets/scifi_texture_street_dark.jpg")
 set(material.shininess,60)
 # reflectivity
 set(material.reflectivity, .3)
  
StreetLine --> 
 setupProjection(0.0, world.xz, 900, 150) texture("scifi_texture_street_bright.jpg") projectUV(0.0) 

0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi !


Before starting to code CGA, watch the tutorial videos. Esp. tutos 1,2,6.

Watch also the stuff you find in the FAQ thread :

http://forums.arcgis.com/threads/64843-CityEngine-Collection-RESOURCES-FAQ-HELP

Ok ?

m.
0 Kudos