🎓 Three.js Layering Demo

Explore how depth testing, transparency, render order, and blending modes interact. All three planes are visible below - experiment with the controls!

Tip: Try the preset scenarios to see common configurations and mistakes.

⚙️ Rendering Controls - All Three Planes

Default
Standard transparent setup
✓ Correct Transparency
Proper back-to-front ordering
✗ Wrong Order (Common Mistake)
depthWrite=true causes artifacts
Glow Effect
Additive blending demonstration
No Depth Test
Shows why depth testing matters
All Opaque
Standard PBR materials

🔴 Red Plane (Front, z=1)

0.7
0

🟢 Green Plane (Middle, z=0)

0.7
0

🔵 Blue Plane (Back, z=-1)

0.7
0

📚 Understanding the Settings

Material Type

Basic: No lighting calculations, fastest performance. Color appears the same from all angles.

Standard: Physically-based rendering (PBR) with realistic lighting. Responds to lights in the scene.

Shader: Custom GLSL shader with gradient alpha effect. Full control but more complex.

Opacity

Controls how transparent the object is, from 0.0 (fully transparent/invisible) to 1.0 (fully opaque/solid).

Note: Must have "Transparent" checked for opacity to work.

Render Order

Controls the drawing sequence. Objects with higher values render after (on top of) objects with lower values.

Blending Mode

Normal: Standard alpha blending - colors mix based on opacity.

Additive: Colors add together, creating bright glowing effects. Great for light, fire, particles.

Subtractive: Colors subtract - creates darkening effects.

Multiply: Colors multiply - always darkens, useful for shadows.

Transparent

Must be checked to enable alpha blending. Without this, opacity has no effect.

Unchecked: Object is fully opaque regardless of opacity setting.

Depth Test

When checked, the GPU tests if a fragment is closer than what's already rendered before drawing it.

Use case for unchecked: UI elements, overlays, special effects that should ignore 3D space.

Depth Write

When checked, rendering updates the depth buffer, blocking objects behind it.

⚠️ Common mistake: Having depthWrite=true on transparent objects causes rendering artifacts where objects behind don't blend properly.

🎯 Recommended Settings

Standard Opaque Object:

Standard Transparent Object:

💡 Tips