Ray-caster: dim the interior layers of spheres

This seems to weaken the intersection disk illusion.
This commit is contained in:
Aaron Fenyes 2024-09-02 15:15:18 -07:00
parent f148552964
commit a4236a34df

View File

@ -46,6 +46,7 @@ uniform bool debug_mode;
const float focal_slope = 0.3; const float focal_slope = 0.3;
const vec3 light_dir = normalize(vec3(2., 2., 1.)); const vec3 light_dir = normalize(vec3(2., 2., 1.));
const float ixn_threshold = 0.005; const float ixn_threshold = 0.005;
const float INTERIOR_DIMMING = 0.7;
// --- sRGB --- // --- sRGB ---
@ -143,6 +144,7 @@ void main() {
vec2 hit_depths = sphere_cast(sphere_list[id], dir); vec2 hit_depths = sphere_cast(sphere_list[id], dir);
// insertion-sort the fragments we hit into the fragment list // insertion-sort the fragments we hit into the fragment list
float dimming = 1.;
for (int side = 0; side < 2; ++side) { for (int side = 0; side < 2; ++side) {
float hit_z = -hit_depths[side]; float hit_z = -hit_depths[side];
if (0. > hit_z) { if (0. > hit_z) {
@ -154,7 +156,7 @@ void main() {
frags[layer] = sphere_shading( frags[layer] = sphere_shading(
sphere_list[id], sphere_list[id],
hit_depths[side] * dir, hit_depths[side] * dir,
color_list[id], dimming * color_list[id],
id id
); );
} }
@ -167,6 +169,7 @@ void main() {
} }
} }
layer_cnt = min(layer_cnt + 1, LAYER_MAX); layer_cnt = min(layer_cnt + 1, LAYER_MAX);
dimming = INTERIOR_DIMMING;
} }
} }
} }