fixes transparent refelctions
This commit is contained in:
parent
dc66ae4b3d
commit
c07e8a3061
3 changed files with 9 additions and 9 deletions
Binary file not shown.
|
@ -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) {
|
if (!result.has_hit && result.has_transparent_hit) {
|
||||||
// did we stop because nothing could be seen through the object?
|
// 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 (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.has_hit = true;
|
||||||
}
|
result.color_mul = color_mul_transparent;
|
||||||
|
}
|
||||||
result.end_pos = end_pos_transparent;
|
result.end_pos = end_pos_transparent;
|
||||||
result.end_color = end_color_transparent;
|
result.end_color = end_color_transparent;
|
||||||
result.end_volume = end_volume_transparent;
|
result.end_volume = end_volume_transparent;
|
||||||
result.end_facing = end_facing_transparent;
|
result.end_facing = end_facing_transparent;
|
||||||
result.end_raster = end_raster_transparent;
|
result.end_raster = end_raster_transparent;
|
||||||
result.color_mul = color_mul_transparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -83,19 +83,19 @@ impl Scene {
|
||||||
let shade = (rng.gen_range(0..25) as f32) / 100.0;
|
let shade = (rng.gen_range(0..25) as f32) / 100.0;
|
||||||
let cube = Cube {
|
let cube = Cube {
|
||||||
pos: vec3(10.0, 10.0, 10.0),
|
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),
|
tex_coord: vec2(0.0, 0.0),
|
||||||
transparent: false,
|
transparent: true,
|
||||||
roughness: 0,
|
roughness: 32,
|
||||||
};
|
};
|
||||||
oct_tree.set_cube(cube.clone());
|
oct_tree.set_cube(cube.clone());
|
||||||
|
|
||||||
let cube = Cube {
|
let cube = Cube {
|
||||||
pos: vec3(10.0, 10.0, 9.0),
|
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),
|
tex_coord: vec2(0.0, 0.0),
|
||||||
transparent: false,
|
transparent: true,
|
||||||
roughness: 0,
|
roughness: 32,
|
||||||
};
|
};
|
||||||
oct_tree.set_cube(cube.clone());
|
oct_tree.set_cube(cube.clone());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue