fixes double neighbor assignement and cubes inside of empty volumes after skipping to grow

This commit is contained in:
zomseffen 2025-02-26 12:31:58 +01:00
parent 5353f28acd
commit 457d3e2d6b
7 changed files with 165 additions and 105 deletions

View file

@ -281,7 +281,7 @@ Tracing trace_ray(uint volume_start, vec3 starting_pos, vec3 start_direction, fl
uint next_neighbor = sample_neighbor_from_scene_info(volume_index, uvec2(u, v), hit_facing);
uvec4 color_sample = sample_color_from_scene_info(volume_index, uvec2(u, v), hit_facing);
if (color_sample == uvec4(0, 0, 0, 0)) {
if (color_sample.xyz == uvec3(0, 0, 0)) {
// not a color hit, so check neighbor
if (next_neighbor != 0) {
volume_index = next_neighbor;
@ -290,6 +290,8 @@ Tracing trace_ray(uint volume_start, vec3 starting_pos, vec3 start_direction, fl
volume_pos_z = scene_info.infos[volume_index + 2];
} else {
// neighbor miss
end_color_transparent = uvec4(255, 0, 0, 255);
result.end_color = uvec4(255, 0, 0, 255);
break;
}
} else {
@ -377,7 +379,7 @@ vec3 get_lighting_color(uint volume_start, vec3 starting_pos, vec4 orig_color_sa
uint light_num = 0;
// initialize color
vec3 color_sum = vec3(0.0, 0.0, 0.0) + (orig_color_sample.xyz * 0.01);
vec3 color_sum = vec3(0.0, 0.0, 0.0) + (orig_color_sample.xyz * 0.005);
uint max_iterations = max_num_lights * max_iterations_per_light;
uint iteration = 0;