Insert a Tree on a texture

581
2
03-13-2021 12:37 PM
JOELBEALE
New Contributor

Hi City Engine Community,

I am new to cga coding and I am trying to do something simple.

I am looking to apply a texture to a lot and insert a tree or multiple trees on top of the texture.

Here is what I have now:

Lot -->
primitiveQuad(1920,1080)
comp(f) {top:SATimage}

SATimage-->
texture("images/Satellite Imagery/Test Test/sattest.png")


Generate-->
alignScopeToAxes(y)
s(0,0,0)
t(x,z,y)
i(Tree)

________________________________________________

For some reason the tree either doesn't insert or the texture doesn't work. I cant get both to work at the same time.

Is there anyone that could help me with this coding?

Tags (3)
0 Kudos
2 Replies
DevinLavigne
Occasional Contributor III

You can call your Generate rule from your Lot. I think the cleanest way to would be to put it on top and I would give it a more distinct/memorable name. The code below should work and will scatter 100 trees.

Lot -->
InsertTrees
primitiveQuad(1920,1080)
comp(f) {top:alignScopeToAxes(y) SATimage | all: NIL}

SATimage-->
texture("images/Satellite Imagery/Test Test/sattest.png")

InsertTrees-->
scatter(surface, 100, uniform){PlantTree}

PlantTree-->
i(Tree)

 

0 Kudos
JOELBEALE
New Contributor

When I saw your post I was surprised. I cant believe Mr. Lavigne replied to my post! I've admired your work ever since I discovered City Engine. You have a very impressive background with CE and your CGA coding skills are amazing. I have been persistent on learning how to code in City Engine and have been reading the online manual. The code above that you wrote really helped, I was stuck and was frustrated that I couldn't come to figure out how to insert a tree or an object on top of a texture. I really want to become an Urban Planner like you and have been interested in working for Houseal Lavigne Associates. I am a detail oriented Industrial Designer who is determined.

Below is my portfolio:

https://www.coroflot.com/creativeintuition/Joel-Beale-Portfolio-2020

 

0 Kudos