uGlassPartition / uGlassDepth — the per-fragment depth partition of the emissive
data around refract_data glass (spec MESH_PHYSICAL_MATERIALS §3.4, Phase 3).
A glass mesh that refracts the data must draw AFTER it, and the emissive layers write
no depth (additive mode has the depth test off altogether), so nothing in the
hardware can tell a point in front of the glass from one behind it: the glass would
paint over both. The refraction split therefore renders the glass's front-face depth
first (post-processing/post-processing-manager/refraction-split.ts) and every data
fragment classifies ITSELF against that texture:
where 1.0 is the cleared depth, i.e. "no refracting glass covers this pixel". Pass A
keeps the fragments that are NOT in front (behind the glass, or under no glass at all)
and the glass refracts exactly that image; pass C, after the glass, keeps only the
fragments in front, so they land crisp on top. Both predicates come from the one
inFront test, which is what makes the two passes a partition: every data fragment is
drawn exactly once. The mode is a runtime uniform, never a define — it flips several
times per frame and must not recompile anything.
Every Luxar data material (points / quad lines / capsule lines / gsplats / house mesh,
GLSL and TSL) declares the pair. The pick materials deliberately do NOT: picking must
see all the data, and it runs while the mode is 0 anyway. Duck-typed on
material.uniforms like density-drop.ts, so one helper serves ShaderMaterial
uniform records and the TSL materials' proxyIUniform records alike.
The depth texture is ONE module-level object: every material binds it once at
construction, and the split's glass-depth render target is created WITH it, so no
material ever needs a rebind (a TSL graph rebuild would otherwise be required) and a
frame that never runs the split samples a texture that is simply never read (the
uniform branch is dead at mode 0).
uGlassPartition/uGlassDepth— the per-fragment depth partition of the emissive data aroundrefract_dataglass (spec MESH_PHYSICAL_MATERIALS §3.4, Phase 3).A glass mesh that refracts the data must draw AFTER it, and the emissive layers write no depth (additive mode has the depth test off altogether), so nothing in the hardware can tell a point in front of the glass from one behind it: the glass would paint over both. The refraction split therefore renders the glass's front-face depth first (
post-processing/post-processing-manager/refraction-split.ts) and every data fragment classifies ITSELF against that texture:where
1.0is the cleared depth, i.e. "no refracting glass covers this pixel". Pass A keeps the fragments that are NOT in front (behind the glass, or under no glass at all) and the glass refracts exactly that image; pass C, after the glass, keeps only the fragments in front, so they land crisp on top. Both predicates come from the oneinFronttest, which is what makes the two passes a partition: every data fragment is drawn exactly once. The mode is a runtime uniform, never a define — it flips several times per frame and must not recompile anything.Every Luxar data material (points / quad lines / capsule lines / gsplats / house mesh, GLSL and TSL) declares the pair. The pick materials deliberately do NOT: picking must see all the data, and it runs while the mode is 0 anyway. Duck-typed on
material.uniformslikedensity-drop.ts, so one helper servesShaderMaterialuniform records and the TSL materials'proxyIUniformrecords alike.The depth texture is ONE module-level object: every material binds it once at construction, and the split's glass-depth render target is created WITH it, so no material ever needs a rebind (a TSL graph rebuild would otherwise be required) and a frame that never runs the split samples a texture that is simply never read (the uniform branch is dead at mode 0).