Closed itsdouges closed 1 year ago
Heya! Currently setup material will overrides the function if it already exists which isn't ideal. The solution would be to compose it, something like:
if (material.onBeforeCompile) { const previousOnBeforeCompile = material.onBeforeCompile; const newOnBeforeCompile = (shader, renderer) => { // csm logic previousOnBeforeCompile(shader, renderer); }; material.onBeforeCompile = newOnBeforeCompile; }
For context this is set because I'm using https://github.com/FarazzShaikh/THREE-CustomShaderMaterial/ which sets it and allows you to re-use standard three materials with custom shaders.
Thank you. Fixed in v3.1.1.
Heya! Currently setup material will overrides the function if it already exists which isn't ideal. The solution would be to compose it, something like:
For context this is set because I'm using https://github.com/FarazzShaikh/THREE-CustomShaderMaterial/ which sets it and allows you to re-use standard three materials with custom shaders.