See gif below. I split a shape in a grid pattern, extrude the red opaque blocks and top them off with the transparent blue ones. However this randomly causes some darker blue patches, even without updating the seed. Can I somehow prevent this?
(Drop the attached rule on a ~50x50 shape to test)
This is a known issue with rendering multiple layers of transparent objects (due to CityEngine not z-sorting transparent objects on rendering).
I'm not sure if there's a workaround for this. But, to reduce the strange coloring inside the water, you could use the touches() method to decide which face is an inside or outside face and then only show the outside faces. It doesn't fully solve the problem though.
SplitWaterZ -->
case touches() :
NIL
else :
split(y) { ~5 : Y. }*
Or, you could use some hacks to create a whole box for the water (Shell rule) and then draw in the wireframe lines in the code.
Lot -->
Shell
split(x) { ~5 : SplitX }*
SplitZ -->
extrude(rint(rand(1,3))*5)
print(scope.sy)
set(tempvar, scope.sy)
color("#FF9999")
comp(f){ side : SplitGroundZ
| top : Top. }
Shell -->
extrude(25)
s(scope.sx - 0.01, '1, scope.sz - 0.01)
center(xz)
color(0, 0, 1, 0.15)
BlueShell.
WireframeX
WireframeY
WireframeZ
WireframeX -->
split(x) { 5 : comp(e) { all : Line. } }*
WireframeY -->
split(y) { 5 : comp(e) { all : Line. } }*
WireframeZ -->
split(z) { 5 : comp(e) { all : Line. } }*