Atlaslog
Atlaslog / Field Notes / three.js rendering
Field note · three.js rendering

Stacked transparent glass renders as solid slabs

Quick answer

With transparent: true and opacity 0.4 the glass panes still occlude everything behind them, so the interior or the next facade never shows through. Transparent meshes keep depthWrite enabled and are sorted per object, not per face.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: three.js
Symptom
Checklist
  1. Set depthWrite: false on the glass material and see whether the rear surface appears.
  2. Temporarily set transparent: false and opacity 1 to confirm geometry and winding.
  3. Try side: THREE.DoubleSide to rule out back-face culling.
  4. Check whether the glass is one mesh with many faces, which per-object sorting cannot order.
Fix

Use MeshPhysicalMaterial with depthWrite: false, side: THREE.DoubleSide, transmission 0.6 and renderOrder 10, or assign renderOrder 100 - i per layer so distant panes draw first; use alphaTest 0.5 with transparent: false for cut-out foliage.

Code
var glassMat = new THREE.MeshPhysicalMaterial({
  color: 0x9fc6e8,
  transparent: true,
  opacity: 0.35,
  roughness: 0.1,
  metalness: 0,
  depthWrite: false,        // 关键
  side: THREE.DoubleSide,
  transmission: 0.6
});
glassMat.renderOrder = 10;   // 数值大的后画
glassLayers.forEach(function (mesh, i) {
  mesh.material.depthWrite = false;
  mesh.renderOrder = 100 - i;   // 远景先画
});
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). Stacked transparent glass renders as solid slabs. https://www.jingweizhi.com/en/cookbook/three-material-transparent.html (accessed 2026-11-03).