fixes edge see through

This commit is contained in:
zomseffen 2025-03-14 15:50:01 +01:00
parent 839907c8a7
commit 90b16a3d5c
2 changed files with 6 additions and 14 deletions

Binary file not shown.

View file

@ -372,11 +372,6 @@ Tracing trace_ray(uint volume_start, vec3 starting_pos, vec3 start_direction, fl
}
}
}
/*if (iteration_num == max_iterations) {
end_color_transparent = uvec4(0, 0, 255, 255);
result.end_color = uvec4(0, 0, 255, 255);
result.color_mul = vec3(0.0, 0.0, 1.0);
}*/
result.end_factor = min(min(x_factor, y_factor), z_factor);
result.end_cycle = iteration_num;
@ -428,9 +423,6 @@ vec3 get_lighting_color(uint volume_start, vec3 starting_pos, vec4 orig_color_sa
Tracing result = trace_ray(volume_start, starting_pos, light_direction, max_factor, false);
// add result, if there is a hit the null vector will be added
color_sum += float(!result.has_hit) * result.color_mul * max(dot(normal, normalize(light_direction)), 0.0) * (orig_color_sample.xyz * light_color) / (length(light_direction) * length(light_direction));
/*if (scene_info.infos[light_index] == 1) {
color_sum = float(!result.has_hit) * result.color_mul;
}*/
light_num += 1;
if (light_num >= max_num_lights) {
@ -473,13 +465,13 @@ vec3 clamp_to_volume(uint volume_start, vec3 position) {
float volume_pos_z = uintBitsToFloat(scene_info.infos[volume_start + 2]);
float volume_scale = uintBitsToFloat(scene_info.infos[volume_start + array_descr_offset + color_array_offset - 1]);
float high_x_border = volume_pos_x + float(scene_info.infos[volume_start + 3]) * volume_scale - 0.5 * volume_scale;
float high_y_border = volume_pos_y + float(scene_info.infos[volume_start + 4]) * volume_scale - 0.5 * volume_scale;
float high_z_border = volume_pos_z + float(scene_info.infos[volume_start + 5]) * volume_scale - 0.5 * volume_scale;
float high_x_border = volume_pos_x + float(scene_info.infos[volume_start + 3]) * volume_scale - 0.501 * volume_scale;
float high_y_border = volume_pos_y + float(scene_info.infos[volume_start + 4]) * volume_scale - 0.501 * volume_scale;
float high_z_border = volume_pos_z + float(scene_info.infos[volume_start + 5]) * volume_scale - 0.501 * volume_scale;
float low_x_border = float(volume_pos_x) - 0.5 * volume_scale;
float low_y_border = float(volume_pos_y) - 0.5 * volume_scale;
float low_z_border = float(volume_pos_z) - 0.5 * volume_scale;
float low_x_border = float(volume_pos_x) - 0.501 * volume_scale;
float low_y_border = float(volume_pos_y) - 0.501 * volume_scale;
float low_z_border = float(volume_pos_z) - 0.501 * volume_scale;
return vec3(min(max(position.x, low_x_border), high_x_border), min(max(position.y, low_y_border), high_y_border), min(max(position.z, low_z_border), high_z_border));
}