fixes transparent refelctions

This commit is contained in:
zomseffen 2025-02-05 17:51:17 +01:00
parent dc66ae4b3d
commit c07e8a3061
3 changed files with 9 additions and 9 deletions
shaders
src/scene

Binary file not shown.

View file

@ -355,15 +355,15 @@ Tracing trace_ray(uint volume_start, vec3 starting_pos, vec3 start_direction, fl
if (!result.has_hit && result.has_transparent_hit) {
// did we stop because nothing could be seen through the object?
if (max(result.color_mul.x, max(result.color_mul.y, result.color_mul.z)) < 0.1) {
// if so count it as a hit
// if so count it as a hit and recover the pre transparent color multiplier
result.has_hit = true;
}
result.color_mul = color_mul_transparent;
}
result.end_pos = end_pos_transparent;
result.end_color = end_color_transparent;
result.end_volume = end_volume_transparent;
result.end_facing = end_facing_transparent;
result.end_raster = end_raster_transparent;
result.color_mul = color_mul_transparent;
}
return result;

View file

@ -83,19 +83,19 @@ impl Scene {
let shade = (rng.gen_range(0..25) as f32) / 100.0;
let cube = Cube {
pos: vec3(10.0, 10.0, 10.0),
color: vec3(1.0, 1.0, 1.0),
color: vec3(1.0, 0.0, 0.0),
tex_coord: vec2(0.0, 0.0),
transparent: false,
roughness: 0,
transparent: true,
roughness: 32,
};
oct_tree.set_cube(cube.clone());
let cube = Cube {
pos: vec3(10.0, 10.0, 9.0),
color: vec3(1.0, 1.0, 1.0),
color: vec3(1.0, 0.0, 0.0),
tex_coord: vec2(0.0, 0.0),
transparent: false,
roughness: 0,
transparent: true,
roughness: 32,
};
oct_tree.set_cube(cube.clone());