With WebGL2, we can let one FragmentShader output multiple textures ( MRT ). But this needs write all the codes in one FragmentShader.
If I do need seperate the FragmentShader codes to multiple files, for reasons such as modulization or port other’s project to three.js. Can I run VertexShader just once and then output it’s variables(varyings) to multiple FragmentShaders?
For example, base.vert output vertexPosition to base.frag and position.frag?
No. A shader program is a combination of a single vertex and fragment shader. Meaning you need two programs (base.vert + base.frag and base.vert + position.frag).