AnsweredAssumed Answered

Cityengine crashes when handling customized models

Question asked by shakespace on Apr 5, 2018
Latest reply on Apr 6, 2018 by shakespace

I have more tree questions to ask..... so I try to create about 28000 trees with customized tree models. Those models are ranging from 7mb-60mb each. As much as I try to reduce model sizes by using reduceGeometry options, cityengine still crashes every time.... Even I reduce tree number to about 1500, cityengine still freezes.... Not sure if I should reduce model size in other 3d modeling software? if so, which software should I use, or if this is something I solve in cityengine? 

 

Here is part of my code:

 

//this is only a partial list of trees. my code has more records than this.

getMix="Balsam_Fir;126;13.716;3.3528;0.123;Balsam_Fir;115;9.144;3.048;0.033;Balsam_Fir;113;8.5344;3.048;0.003;Balsam_Fir;113;8.5344;3.048;0.003;Balsam_Fir;247;53.6448;4.572;0.42;" 

 

 

@StartRule

PlantMix -->
Ground_Cover.GroundCover
PlantMix(_getMix)

 

PlantMix(mix) -->
case mix != "":

 


print (listFirst(mix))
print (float(listItem(mix,1)))
print (float(listItem(mix,2)))
print (float(listItem(mix,3)))
print (float(listItem(mix,4)))
print (float(listItem(mix,5)))

 

DistributePlant(listFirst(mix),float(listItem(mix,1))/2,float(listItem(mix,2)),float(listItem(mix,3)),float(listItem(mix,4)),float(listItem(mix,5)))

 

PlantMix(listRange(mix,6,1000)) 
else:
NIL


DistributePlant(plant,number,height,radius,contagion,ageClass) -->
20%:scatter(surface, number, gaussian,center,(1-contagion)*500){ TREE(plant,height,radius, ageClass) }
20%:scatter(surface, number, gaussian,left,(1-contagion)*500){ TREE(plant,height,radius,ageClass) }
20%:scatter(surface, number, gaussian,right,(1-contagion)*500){ TREE(plant,height,radius,ageClass) }
20%:scatter(surface, number, gaussian,front,(1-contagion)*500){ TREE(plant,height,radius,ageClass) }
else:scatter(surface, number, gaussian,back,(1-contagion)*500){ TREE(plant,height,radius,ageClass) }


NIL

 

TREE(plant,height,radius,ageClass) -->

 

//examples of how I generate tree, I have many more code following similar structure to generate trees

 

//how I use my customized model to generate tree
case plant == "Quaking_Aspen":
25%:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/" + plant +"/"+"EU52_1.obj" )
reduceGeometry(0.3)
translate(rel, object, 0, -2, 0)
Tree.


25%:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Quaking_Aspen1/SH10_1.obj" )

 

reduceGeometry(0.3)
Tree.


25%:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Quaking_Aspen1/SH10_2.obj" )
reduceGeometry(0.3)
Tree.


25%:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Quaking_Aspen1/SH10_3.obj" )
cleanupGeometry(all, 0.03)
// reduceGeometry(0.3)
Tree.
else:
NIL

 

 

//how I use my customized model 

case plant == "Bur_Oak":

case ageClass==3:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Turkey_Oak/ML16a.obj" )
//cleanupGeometry(all, 0.01)
reduceGeometry(0.3)
Tree.

case ageClass==2:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Turkey_Oak/ML16m.obj" )
// cleanupGeometry(all, 0.01)
reduceGeometry(0.3)
Tree.

else:
alignScopeToAxes(y)
r(0,rand(0,360),0)
setPivot(yzx,0)
center(xz)
s(radius,radius,height)
i("assets/Plants/Turkey_Oak/ML16y.obj" )
// cleanupGeometry(all, 0.01)
reduceGeometry(0.3)
Tree.

Outcomes