reordering of diffuse calls for usage of cycle counting/limiting
This commit is contained in:
parent
1ecd1c7403
commit
709c2f0569
2 changed files with 9 additions and 4 deletions
shaders
Binary file not shown.
|
@ -395,7 +395,7 @@ void main() {
|
|||
vec3 clamped_pos = clamp_to_volume(fragVolumeStart, origPosition);
|
||||
uvec4 color_roughness = sample_color_from_scene_info(fragVolumeStart, fragRasterPos, facing);
|
||||
vec3 orig_color_sample = vec3(float(color_roughness.x) / 255.0, float(color_roughness.y) / 255.0, float(color_roughness.z) / 255.0);
|
||||
vec3 color_sum = diffuse_tracing(fragVolumeStart, fragRasterPos, clamped_pos, facing);
|
||||
vec3 color_sum;
|
||||
|
||||
uint orig_neighbor = sample_neighbor_from_scene_info(fragVolumeStart, fragRasterPos, facing);
|
||||
if (orig_neighbor != 0) {
|
||||
|
@ -403,13 +403,18 @@ void main() {
|
|||
Tracing t = trace_ray(fragVolumeStart, ubo.camera_pos, clamped_pos - ubo.camera_pos, 100.0, 0, 20);
|
||||
float opacity = float(color_roughness.w) / 255.0;
|
||||
if (t.has_hit) {
|
||||
color_sum = opacity * color_sum + (1.0 - opacity) * diffuse_tracing(t.end_volume, t.end_raster, t.end_pos, t.end_facing) * orig_color_sample;
|
||||
vec3 color_seen_through = diffuse_tracing(t.end_volume, t.end_raster, t.end_pos, t.end_facing) * orig_color_sample;
|
||||
vec3 color_direct = diffuse_tracing(fragVolumeStart, fragRasterPos, clamped_pos, facing);
|
||||
color_sum = opacity * color_direct + (1.0 - opacity) * color_seen_through;
|
||||
}
|
||||
else {
|
||||
// Todo: hit sky box
|
||||
color_sum = opacity * color_sum + (1.0 - opacity) * vec3(0.0, 0.0, 0.0);
|
||||
vec3 color_direct = diffuse_tracing(fragVolumeStart, fragRasterPos, clamped_pos, facing);
|
||||
color_sum = opacity * color_direct + (1.0 - opacity) * vec3(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
color_sum = diffuse_tracing(fragVolumeStart, fragRasterPos, clamped_pos, facing);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue