Inconsistent translucency on optimised geometry

Hello. I want to create a wireframe-style cube with pickable, translucent sides. Here’s what I do:

  • Create 6 nodes, each consisting of a quad, translucent material, and a line mesh around the border (for the wireframe effect)
  • Translate and rotate the six faces to form a cube
  • Optimise the geometry to create a single cube node (so I can scale the cube without worrying about compensating for each face node’s rotation)
  • Add the cube to the transparent bucket

When I load the game, half the time the cube is fully translucent and works perfectly:

But sometimes it looks like this:

Note that in the latter case, I’ve not changed anything - the game has just been reloaded.

Any ideas? I can post code if needed.

  • Optimise the geometry to create a single cube node (so I can scale the cube without worrying about compensating for each face node’s rotation)
    dont do this, as the renderer needs in this case to render the individual quads in specific order. If batched it has not anymore controll over this.

Just add a secondary node over your node and scale this, then you should be free of issues with scaling.

1 Like

It’s down to render order, if the brown cube has already been drawn then the white lines won’t be drawn because the z buffer shows them there.

Turning off depth writing on the brown material will help, but might have other consequences.

  1. Use a cube object not 6 quads.

  2. Turn off depth writing

1 Like

Evidently, my method was wrong in several ways, and also overly complicated.

I now create two meshes - a Box and a WireBox - at the same position and attach them to the same node.

The Box handles the transparency, the WireBox gives it the proper wireframe effect, the node can be scaled easily, and the cube can be picked correctly.

Thanks for the help.