Skip to content

Mesh Transparency

App: apps/mesh_transparency/

Shows the per-mesh render state you can set on a procedurally-built Mesh: an opaque red quad in back, with two translucent panes (green, blue) in front. Where a pane overlaps the red quad you see red through it, and where the panes overlap each other they blend too.

Terminal window
% ./plume3d mesh_transparency

or

Terminal window
% ./../plume3d .
  • Builds three quads with Graphics.newMesh(...); the translucent ones carry a vertex alpha of 0.5.
  • greenGlass.blendMode = "alpha" and blueGlass.blendMode = "alpha" — src-alpha blending. The engine draws opaque geometry first, then blends the translucent meshes back-to-front (no depth write), so they layer correctly regardless of submission order.
  • blueGlass.doubleSided = true — convenience for cullMode = "none". Set cullMode = "back" on a consistently-wound mesh to draw it single-sided.
  • The triangle shader outputs the vertex colour’s alpha, so per-vertex alpha < 1 becomes visible translucency once blendMode is "alpha".

Imported .blend materials set blendMode / cullMode automatically from the material’s transparency and back-face-culling settings — this example is the procedural counterpart.

  • GraphicsloadShader, newMesh, drawMesh.
  • MeshblendMode, cullMode, doubleSided.