pex-renderer
pex-renderer copied to clipboard
Custom frag shader throws an error
Error: Program: ERROR: Input of fragment shader 'vNormalWorld' not written by vertex shader ERROR:
Is it because we reuse that material in depth prepass?
As long as the material.vert.js or an overriding custom shader declare and set vNormalWorld, this shouldn't happen (default behaviour is vNormalWorld = normalize(vec3(uInverseViewMatrix * vec4(vNormalView, 0.0)));)
It happens in depth prepass. I think the solution is to not allow custom depth shader
vert: DEPTH_PASS_VERT, // vert: material.vert || DEPTH_PASS_VERT,
frag: DEPTH_PRE_PASS_FRAG // frag: material.frag || DEPTH_PRE_PASS_FRAG
or split customisation into:
material.set({
materialFrag: ``
prePassFrag: ``
})
etc