Make any stock Three.js material or user-authored material OIT-compatible by
patching its shaders at compile time (via onBeforeCompile) to include the OIT
logic, and attaching the per-pass variant machinery.
Works with lit built-in materials (which provide vViewPosition) and with
materials lacking it (e.g. LineBasicMaterial), in which case vViewPosition is
injected automatically. All injected code is guarded by #ifdef USE_OIT, so the
base program is unchanged outside the OIT pipeline.
Note: targets materials compiled by Three.js (built-ins, ShaderMaterial). Raw
RawShaderMaterial (no Three.js shader prelude) is not auto-patched.
Make any stock Three.js material or user-authored material OIT-compatible by patching its shaders at compile time (via
onBeforeCompile) to include the OIT logic, and attaching the per-pass variant machinery.Works with lit built-in materials (which provide
vViewPosition) and with materials lacking it (e.g.LineBasicMaterial), in which casevViewPositionis injected automatically. All injected code is guarded by#ifdef USE_OIT, so the base program is unchanged outside the OIT pipeline.Note: targets materials compiled by Three.js (built-ins,
ShaderMaterial). RawRawShaderMaterial(no Three.js shader prelude) is not auto-patched.