Quick answer: Enable Z-buffer in Project Properties (Advanced section), set each 3D Shape’s Z-elevation, and put transparent shapes on a separate layer drawn after opaque ones.
A pseudo-3D scene with 3D Shapes (cubes, prisms) has cubes overlapping each other incorrectly — a back cube draws on top of a front one. Switching the event-sheet order changes which is on top, suggesting 2D draw order rather than depth-aware rendering.
Z-Buffer Is Off by Default
Construct 3’s 3D Shape object exists in a project that may still be configured as 2D. Without enabling the Z-buffer:
- Shapes render in the order they appear in the instance list.
- Z-elevation affects position but not occlusion.
- Overlapping shapes show whichever drew last, regardless of depth.
The Fix
- Open Project Properties.
- Expand the Advanced section.
- Find Z-buffer. Set to On.
- Save and preview. Overlapping cubes now occlude correctly based on their Z-elevations.
Setting Z-Elevation
Each 3D Shape instance has a Z-elevation property. On the layout, place cubes at known elevations:
// Event sheet
On start of layout:
Cube1 Set Z-elevation to 0
Cube2 Set Z-elevation to 100
Cube2 is 100 units higher (or deeper, depending on your camera orientation). With Z-buffer on, the front-most cube draws first; the back cube gets clipped where it’s occluded.
Transparency Special Case
Z-buffer is binary — a pixel either occludes or doesn’t. Transparent or alpha-blended shapes need to draw back-to-front for blend math to be correct. Mix opaque and transparent:
- Put opaque shapes on a layer (e.g., “World”).
- Put transparent shapes on a higher layer (e.g., “Glass”).
- Both layers can use Z-buffer.
- Within the transparent layer, sort by Z-elevation each frame:
Every tick:
For each GlassShape ordered by Z-elevation descending:
Move to top of layer
Back glass shapes draw first, front ones draw on top, blending mathematically correctly.
Camera Direction Matters
Construct’s 3D Camera object has an “Up” vector and look-at target. Higher Z-elevation means closer to the camera by default (Z+ points toward viewer). Flip via the camera if your art has Z- as up. Affects all Z-buffer comparisons.
Verifying
Build a test scene with three colored cubes at Z=0, 100, 200. The Z=200 cube should occlude the Z=100, which should occlude the Z=0 from a standard camera looking down +Z. Toggle Z-buffer off in Project Properties — the order should now follow event-sheet order. Toggle it back on; depth-correct again.
“Z-buffer makes 3D real. Without it, you have layered 2D pretending to be 3D — and the layers will sort wrong.”
For 3D scenes, set Z-buffer on at project start — no reason to keep it off after you start using 3D Shapes.