POST
|
Hi! I am trying to use the Occlusion function to detect if the edges of two procedurally created objects touch. A simple example I made for a cube worked flawlessly, then I moved to my actual objects. The query I am using for the cylinder-like object is just an extrusion and for the developing upside-down cone is this: @StartRule
Lot-->
extrude(0.2)
center(xz)
comp(f) {bottom : Root}
Root-->
case(scope.sx > 0.5):
s('0.97, '0.97, 0)
center(xy)
color(0,0.4,0.7)
extrude(0.5)Facades
X
comp(f){top : Root}
else: NIL
Facades-->
comp(f){side:OcclusionDetection | bottom:OcclusionDetection | top:OcclusionDetection}
OcclusionDetection -->
case overlaps (inter):
color("#ff0000")
X
else: color("#c3ff00") The result is on the image: Image assessment: 1. there is a "ghost" touch, 2. this is my aim accomplished and 3. that interaction is not registered this time (although earlier it was registering). I move around the yellow-green object to make it re-render and register the overlaps. Problem: Inconsistent behaviour of the occlusion function. The script worked fine the first time I compiled it and after a minute it stopped working. By not working I mean, registering all the time that there is no overlap or having a problem to display the OcclusionDetection colours on-top of the Root colour. It took a lot of time fiddling around with it, although practically staying the same, to make it work again.All these in addition to the issues 1 and 3 from the picture. Is there a way to improve my script and make it work consistently? (The City Engine version used is 2015.2, on a Win 10 system, with Intel Core i5 M520, 6GB RAM, GT320M, SSD)
... View more
08-24-2017
07:06 AM
|
0
|
1
|
467
|
POST
|
That was very useful, and by following the log in CGA console I understood exactly how it works. I found exactly what I needed: the "set" operation to change the attribute inside the function, and the exponential growth of the value, in this case by using the "pow" (power) operation. Thank you very much Z R!
... View more
07-07-2016
08:01 AM
|
0
|
0
|
639
|
POST
|
for example in this case, you can apply it in any footprint and see the shape: attr Factor = 0.97 attr Depth = 0.01 attr Stop = 0.1 Lot--> extrude(Depth) center(xyz) X comp(f) {top : Levels} Levels--> case(scope.sx > Stop) : s('Factor, 'Factor, 0) center(xy) extrude(Depth-0.02) X comp(f){top : Levels} else: NIL The target is in each repetition the attribute "Factor" to be smaller than the previous one. So, the higher the floor, the smaller the size becomes exponentially. Edit: it should work as I want it with attr Depth = 0.1
... View more
07-05-2016
09:52 AM
|
0
|
0
|
639
|
POST
|
In a CGA rule I have a repeating function that needs to be changing the set attribute value exponentially and not proportionally as I have it now. One way to do it could be by setting an attribute inside the function (like in python), but it is not supported. What would be a way of doing that?
... View more
07-05-2016
09:38 AM
|
1
|
3
|
2574
|
Title | Kudos | Posted |
---|---|---|
1 | 07-05-2016 09:38 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|