Select to view content in your preferred language

Is there a way to prevent overlapping transparency display errors?

1806
2
03-11-2016 01:14 PM
LR
by
Frequent Contributor

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)

blocks.gif

Tags (2)
0 Kudos
2 Replies
CherylLau
Esri Regular Contributor

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. }*

CherylLau
Esri Regular Contributor

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. } }*