Hello guys,
I am trying to replicate this shader effect from this playground https://www.babylonjs-playground.com/#CY5DJ2#23
on this playground https://playground.babylonjs.com/#800AGH#12
but the effect is not showing on the body of the car
if you can just explain to me what’s happening so i can fix it.
2 Likes
Yes im facing the same issue did you find any solution for that ??
2 Likes
slin
May 8, 2023, 4:19pm
3
There are several issues.
You didn’t create skyebox mesh.
I didn’t look into why the paintedColor computation doesn’t work well for this car model. But it seems paintColor.rgb values are large. After adding the envColor, the result RBG value is >= 1.0. Thus only showing the white color. The following helps to show the env reflection.
gl_FragColor = envColor * fEnvContribution + vec4(paintColor * 0.2, 1.0);
2 Likes
slin
May 8, 2023, 5:21pm
5
Ok, now I figure out:
worldNormal
needs to be normalized.
I added normalization in the vertex shader when initiating the worldNormal
varying before passing it to frag shader.
worldNormal = normalize(mat3( worldView[ 0 ].xyz, worldView[ 1 ].xyz, worldView[ 2 ].xyz ) * normal);
3 Likes
thank you so much for the help.
do you have any idea why the edges of the model have white noise glitching?
door edges
if you zoom in a little you can see white noise on the edges
slin
May 8, 2023, 6:15pm
10
It is how it looks on my browser. I don’t see white noise like what you have.
thats weird
anw thank you so much for your time
1 Like