Hello,
I have a static model of a building (converted to a shape to be able to texture it using cga)
while texturing buildings on non-flat terrain, I often encounter a problem as on picture that the windows are (partially) burried under ground:
I would like to fix this problem so that it looks more realistic. The possible solutions that I can think of are:
solution A: (better) - to be able to detect the highest point where terrain intersects a face and from that point make a horizontal line so that I subdivide this face into two subfaces and then place a non-window texture at bottom where the windows might get buried under ground and place a window texture at the top of face
solution B: subdivide this face into regular grid and then check if each subface intersects with terrain.
If so, then put non-widnow texture, otherwise place widnow texture. this looks like a worse solution because it produces lots of useless polygons
so can cityEngine detect if a face collides with a terrain and detect an exact position where it collides using cga/python?
so far I only found occlusion query functions but looks like they work only between shapes and not between shapes and terrains
or If there is a better way how to texture static models of buildings (not extruded using footprints) so that their windows don't collide with terrain please let me know
thanks,
Mark
AFAIK you can't query the raster. You could however create a fine triangular mesh and project it onto the terrain. That way you could use the occlusion query with the terrain height - the accuracy of this would depend on your triangle size.
As for the query itself, it doesn't report the touching height. To save polygons, you could do incremental querying. For example, if you have a wall with four floors you'd first check if the whole wall is touching the ground at all (maybe add a little offset from the bottom or else it'll always trigger). If it returns a positive, divide it (floorcount/2) and check again with the separate parts. The parts that don't touch won't need further splitting.
Thanks for help, it worked! it produces more useless polygons but I guess that's the downside...
Is it possible to "merge" the polygons that have same textures? to save performance and allow better texturing (because of bigger polygons)..
I tried cleanupGeometry(all, 1) or reduceGeometry(1) but none of them seems to work
CGA is unfortunately one-way. I think you could try a two-pass method using python, looking something like this:
Hi LR,
Read this discussion that is helpful for me. I wonder if I can query the inserted OBJ model?
Because I saw the fine triangular mesh created could be queried, I tried my case it seems the model to be ignored..
Any suggestion about it? Thank you.
CHEN
Rightclick on the OBJ and import it through the dialog. Uncheck the "import as static model" option, then apply the rule to it.
Thanks for your reply.
I mean obj model which is imported by CGA rule using i (insert operation).
i try to detect intersection between the new shape (new building) and existing building. for this building i use the obj model created by sketchup. just give it a scope and i() it. then new shape can't query it.
is there something i should do to obj model before i() it?
CHEN
Looks like this is not possible, generated models aren't triggered by the OBJ, only the other way around.