Fix diffuse reflection
This commit is contained in:
parent
946617f988
commit
b69ebd80e9
|
|
@ -113,7 +113,8 @@ fn trace_fragment(in: Varying) -> vec3f {
|
|||
let normal = (pos - s.center) / s.radius;
|
||||
if (all(s.emit_color == vec3(0.))) {
|
||||
color *= s.reflect_color;
|
||||
let diffuse = normal + rand_sphere();
|
||||
let sp = rand_sphere();
|
||||
let diffuse = sign(dot(sp, normal)) * sp;
|
||||
let specular = reflect(ray, normal);
|
||||
ray = normalize(mix(diffuse, specular, s.glossiness));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user