Ray-caster: tidy up sphere shading

This commit is contained in:
Aaron Fenyes 2024-08-24 00:08:22 -07:00
parent 2ef0fdd3e2
commit 87763fc458

View File

@ -166,10 +166,9 @@ fn main() {
// vector with respect to the coordinates of the impact
// point. i calculated it in my head and decided that
// the result looked good enough for now
vec3 normal_front = normalize(-v.sp + 2.*v.lt.s*pt);
vec3 normal = normalize(-v.sp + 2.*v.lt.s*pt);
vec3 color;
float incidence = dot(normal_front, light_dir);
float incidence = dot(normal, light_dir);
float illum = mix(0.4, 1.0, max(incidence, 0.0));
return taggedFrag(vec4(illum * base_color, opacity), -pt.z);
}