Three.js How to modify a material shader multiple times

I have a mesh with MeshNormalMaterial.
Now I want to change the shader of this material according to my needs. I thought of using onBeforeCompile to modify this shader, but I have already used onBeforeCompile to complete other functions.
My expected result is to change the shader based on the shader modified by onbeforeCompile.
Is there any way to do this

You may find this thread on chainable-onBeforeCompile uniforms useful

Thank you so much,this seems to slove my problem.

1 Like