CYOS's WebGPU Phong shader may be incorrect

I tried the CYOS WebGPU shader.
https://cyos.babylonjs.com/
However, the execution result of WebGPU’s Phong shader seems to be too bright compared to WebGL2.

When I checked the code, it seems that specComp2 is being calculated, but it is not being used. I think that’s probably the cause.

// Specular
let angleW = normalize(viewDirectionW + lightVectorW);
let specComp = max(0., dot(vNormalW, angleW));
let specComp2 = pow(specComp, max(1., 64.)) * 2.;

//fragmentOutputs.color = vec4(color * ndl + vec3(specComp), 1.);
fragmentOutputs.color = vec4(color * ndl + vec3(specComp2), 1.);

The settings I tried are below.
TEMPLATES: Phong
MESHES: Sphere
3D API: WebGPU

Yup it is a bug I ll push a PR ASAP for @RaananW to deploy :slight_smile:

Fix is here fix webgpu phong shader · BabylonJS/CYOS@22b7d78 · GitHub

3 Likes

Thank you for the quick correction.
I checked the others, and it seems that there is a similar problem with “Wave”.

The same PR will fix it as the fragment is shared but thanks for your feedback @cx20 !!!

1 Like

just to update - deployed and working correctly

1 Like

I have confirmed that the shader is fixed.

BTW, I noticed another problem with CYOS.
I would appreciate it if you could check this as well.