whitted: fixed the transparent shadows with a nasty hack
authorJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 9 Dec 2020 00:49:31 +0000 (02:49 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 9 Dec 2020 00:49:31 +0000 (02:49 +0200)
sdr/whitted.p.glsl

index 80b6bc9..3fa4308 100644 (file)
@@ -143,7 +143,7 @@ vec3 shade(in vec3 ro, in vec3 rd, in HitPoint hit)
        vec3 norm = faceforward(hit.norm, rd, hit.norm);
        vec3 ldir = light_pos - hit.pos;
 
-       vec3 amb = hit.mtl.diffuse * 0.02;
+       vec3 amb = hit.mtl.diffuse * 0.01;
 
        isect_scene(hit.pos + norm * 0.01, ldir, shadow_hit);
 
@@ -192,7 +192,7 @@ bool isect_scene(in vec3 ro, in vec3 rd, out HitPoint hit_res)
                        nearest.mtl = mtl_glass;
                }
                if(hit.dist < 1.0) {
-                       opacity *= mtl_glass.refr;
+                       opacity *= mtl_glass.refr * 0.25;       // XXX hack quarter the refr, fresnel would reduce it drastically
                }
        }