I need to change vertexShader of PBRMaterial to achieve some vertex animation, I plan to add a vector2 uniform into the PBRMaterial. But I didn’t find any way like onBeforeCompile in threejs,
Did I have to copy the PBRMaterial Class into a new .ts as a new material type then change it?
Wishing your reply!!!
PS:question 2: what is the PushMaterial, I find that skymaterial is extends from pushmaterial, I copy a skybox from a unity plugin, it is very cool!!! I am serious that why skymaterial extends from pushMaterial, what is the “push” meaning?
About the first, you can rely we have strings you can actually replace in the shader, but nothing can guarantee long term works.
I would recommend relying on our Node Material to do such customization.
@Evgeni_Popov may have an example for the first one.
About the second question, a push material is meant to know when changes happens to recompile if needed. It is not necessary for small shaders without a lot of variations.
Thank you very much!!!
I find PBRCustomMaterial can change vertex/fragment shader, it is easy to use!!!