I am creating 3D textured models for a college campus with over 200 buildings. I need to create one building with its corresponding texture, in the other words one building uses one texture. I searched the CityEngine samples and most samples use a random method to randomly pick up a texture for a façade, which I cannot apply the random method to my project as we are creating realistic settings. I also tried some Python codes but do not work well.
Is there any method in CGA or Python can figure out the issue of one building applying one texture for over 200 buildings? Thanks.
This sounds like you need an attribute in your buildings dataset containing "texture names" or "building names" that matches your texture images. Then you could write the CGA code to match the building to the texture. Can you give some more information?
1. Are your buildings originally 2D GIS data (such as footprint polygons)?
2. Are you generating these buildings with CGA rules...or are they from some other 3D object import?
3. Did you write a CGA rule, or are you using a downloaded rule?
3. Are your texture images you wish to use for an entire building face (walls, windows, etc) or are you applying general textures (solid brick, solid vinyl, concrete, etc) and creating the windows separately withing the rule?
Thanks for your reply. I have footprints’ attribute table that contacts texture names and building names. I think your solution is correct and I am looking for the connection between texture names and building names. Can you provide the sample code?
The following is my answers to your questions.
Ok...so it seems you have a couple of options here.
1. If you have an attribute in the footprints data that has the texture names...you can create (in the CGA code) one variable that references the folder that has the texture images (i am assuming jpg) and another variable that represents the texture name..then you can connect that CGA texture name attribute to the footprint texture name attribute.
Then connect the attributes here...
2. If you want to use the "building names" from your footprint attributes....you will possibly need to rename your texture images to match the building names
for example...it your building name is "building1"----rename the texture image for that building "building1.jpg". Then use the following code..
Then follow the "connect the attributes" section above to connect your building name attribute to your CGA attribute (I called it "BuildingTexture_From_Attribute_Table") and then the rule should put the appropriate texture to the building.
I hope this helps. Let me know how it goes.
R: One Building with one texture
Thank you for providing the solution. I use the first method and it works.
I am happy to see my buildings with different textures. I knew the
Attribute Connection Editor for the real Height, which is the numerical
value. I did not know before it can connect with string type of value. That
is great! I can put more attributes stored in attribute table.
Thanks,
Helen
P.S. I cannot log into the account and send my reply. So I email you.