Ray-caster: tidy up sphere shading
This commit is contained in:
parent
2ef0fdd3e2
commit
87763fc458
@ -166,10 +166,9 @@ fn main() {
|
|||||||
// vector with respect to the coordinates of the impact
|
// vector with respect to the coordinates of the impact
|
||||||
// point. i calculated it in my head and decided that
|
// point. i calculated it in my head and decided that
|
||||||
// the result looked good enough for now
|
// 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, light_dir);
|
||||||
float incidence = dot(normal_front, light_dir);
|
|
||||||
float illum = mix(0.4, 1.0, max(incidence, 0.0));
|
float illum = mix(0.4, 1.0, max(incidence, 0.0));
|
||||||
return taggedFrag(vec4(illum * base_color, opacity), -pt.z);
|
return taggedFrag(vec4(illum * base_color, opacity), -pt.z);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user