From 59a15a0580191595656fc808ec99e2d6e48c32c0 Mon Sep 17 00:00:00 2001 From: Ivan 'provod' Avdeev Date: Fri, 12 Nov 2021 09:13:03 -0800 Subject: [PATCH] rtx: do not kill bounces too early fixes dark roughness blots --- ref_vk/shaders/ray.rgen | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ref_vk/shaders/ray.rgen b/ref_vk/shaders/ray.rgen index 2c41c1bb..063e7e73 100644 --- a/ref_vk/shaders/ray.rgen +++ b/ref_vk/shaders/ray.rgen @@ -12,6 +12,7 @@ const float shadow_offset_fudge = .1; const float pdf_culling_threshold = 100.; const float color_factor = 600.; const float color_culling_threshold = 600./color_factor; +const float throughput_threshold = 1e-3; layout (constant_id = 4) const float LIGHT_GRID_CELL_SIZE = 256.; layout (constant_id = 5) const uint MAX_LIGHT_CLUSTERS = 32768; @@ -404,6 +405,7 @@ void main() { material.baseColor = payload_opaque.base_color; material.metalness = 0.f; // TODO material.emissive = payload_opaque.emissive; + //material.roughness = uintToFloat01(xxhash32(uvec3(floor(payload_opaque.hit_pos_t.xyz/64.)))); //payload_opaque.roughness; material.roughness = payload_opaque.roughness; if (bounce == 0) { //brdfType == SPECULAR_TYPE) @@ -475,7 +477,7 @@ void main() { } throughput *= brdfWeight; - if (dot(throughput, throughput) < color_culling_threshold) + if (dot(throughput, throughput) < throughput_threshold) break; origin = payload_opaque.hit_pos_t.xyz;