Select to view content in your preferred language

Random Textures on Multipatch Buildings

3276
6
Jump to solution
09-23-2013 05:17 AM
KareenBröker
Emerging Contributor
Hello,
I am using ESRI CityEngine 2012.1. I am new to ESRI CityEngine and I could use some help to apply a random texture, e.g. roof texture (Pantile_*.tga), to buildings imported from an ESRI Multipatch file.

I have found two similar threads on this forum
(http://forums.arcgis.com/threads/71808-Random-texture and http://forums.arcgis.com/threads/81351-Texture-random-and-depending-on),
but unfortunately I still cannot quiet figure it out: All the buildings get the same roof texture???


version "2012.1"  texPath = "assets/roofs/" const textureIndex = rint(rand(0, 2))  @StartRule Lot -->  cleanupGeometry(all, 0.1) Houses   Houses -->  alignScopeToAxes()  comp(f){    vertical: Facade |    aslant: Roof    }   Roof -->  alignScopeToGeometry(zUp, any, world.lowest)  setupProjection(0, scope.xy, 3, 3, 1)  projectUV(0)  texture ( texPath + "Pantile_" + textureIndex + ".tga" )



So I hope that someone can give me some additional tips.
Thank you!

Best regards,
Kareen
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Deactivated User
Hi,

I thought the scenario was a bit different, but that's ok .. 🙂

In your case, you need to do Shape > Separate Faces. This will 'explode' all polygons. You then need to select all shapes which belong to 1 building and Shape > Combine Faces again. Basically creating n new shapes from that 1 shape, where n = number of buildings.

So this can be done manually in CityEngine, but that's a pain.

Easier would be to pre-process the data and create 1 shape per building, maybe based on some building ID attibute, ok ?

This should solve your issue.

Matt

View solution in original post

0 Kudos
6 Replies
MatthiasBuehler1
Deactivated User
Hi,

maybe they all share the same 'seed' value. Check the shape's info tab in the Inspector.

or simple Shapes > Reset Seed.

let me know if this helps.

( note : if the shapes share the same seed, they may all get the same 'random value', thus the same texture )

ok ?
0 Kudos
KareenBröker
Emerging Contributor
Thank you for your answer, Matthias!

In the shape�??s info tab in the Inspector it says: �??Random Seed: -217278�?� and there is one OID.

I tried the function �??Shapes -> Reset Seed�?� (which runs the CGA rule again).
But I still get the same result. The textures are still not chosen randomly�?�
0 Kudos
MatthiasBuehler1
Deactivated User
hmm.


how many shapes to you have, on which you create buildings ?

a const() value is evaluated exactly once PER SHAPE.

so if all your buildings are constructed on the same shape, all will get the same textures. (there's ways around this too)

lemme know. (maybe post a screenshot too )

m.
0 Kudos
KareenBröker
Emerging Contributor
This is what I am doing prior applying the CGA rule:

I start with SOSI vector data, a common Norwegian geospatial interchange format that defines building footprints and other building information.
Then I use a tool called Xfactor+ which can read these SOSI files and generate building models based on them.
Then I export these buildings (polygons) as one MultiPatch / File GDB which I import in CityEngine in order to add textures to the buildings.

Enclosed please find a screenshot of the scene in CityEngine.

It seems that I only have one shape for all the buildings in the scene. But you mentioned there is a way around this, too? 🙂
0 Kudos
MatthiasBuehler1
Deactivated User
Hi,

I thought the scenario was a bit different, but that's ok .. 🙂

In your case, you need to do Shape > Separate Faces. This will 'explode' all polygons. You then need to select all shapes which belong to 1 building and Shape > Combine Faces again. Basically creating n new shapes from that 1 shape, where n = number of buildings.

So this can be done manually in CityEngine, but that's a pain.

Easier would be to pre-process the data and create 1 shape per building, maybe based on some building ID attibute, ok ?

This should solve your issue.

Matt
0 Kudos
KareenBröker
Emerging Contributor
Yes, that solves the issue. Thank you for helping me, Matt! 🙂
0 Kudos