pex-renderer icon indicating copy to clipboard operation
pex-renderer copied to clipboard

Custom frag shader throws an error

Open vorg opened this issue 6 years ago • 2 comments

Error: Program: ERROR: Input of fragment shader 'vNormalWorld' not written by vertex shader ERROR:

Is it because we reuse that material in depth prepass?

vorg avatar Mar 07 '19 03:03 vorg

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)));)

dmnsgn avatar Mar 12 '19 16:03 dmnsgn

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

vorg avatar Sep 23 '19 23:09 vorg