Please sort this bug in the toon shader project

Please refer to the shader chunk migration notes to help with updating chunk code: Shader Chunk Migrations | Learn PlayCanvas

In this case, the function signature was changed for engine/lightDiffuseLambert.js at main · playcanvas/engine · GitHub

So we need to update the shader chunk from

uniform sampler2D texture_ramp;

float getLightDiffuse() {
    float light = max(dot(dNormalW, -dLightDirNormW), 0.0);
    return texture2D(texture_ramp, vec2(light, 0.0)).g;
}

to

uniform sampler2D texture_ramp;

float getLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {
    float light = max(dot(worldNormal, -lightDirNorm), 0.0);
    return texture2D(texture_ramp, vec2(light, 0.0)).g;
}

Fixed fork: https://playcanvas.com/project/1063707/overview/f-toon-shader-with-skinning

1 Like