rtx: slightly improve (decrease) acne

how: we do not need to add emissive when doing diffuse gi bounce, as contribution from these lights will be computed in computeLighting.
They only need to be sampled for specular bounce.

The rest of the acne should be mitigated by denoiser i think.

Fix #51
This commit is contained in:
Ivan 'provod' Avdeev 2021-09-11 11:42:06 -07:00 committed by Ivan Avdeev
parent 5ce91209ce
commit 7f1e6c8256
1 changed files with 3 additions and 3 deletions

View File

@ -238,6 +238,7 @@ void main() {
payload.t_offset = .0;
payload.pixel_cone_spread_angle = push_constants.pixel_cone_spread_angle;
int brdfType = SPECULAR_TYPE;
for (int bounce = 0; bounce < push_constants.bounces; ++bounce) {
// TODO early exit based on throughput being too small
@ -269,7 +270,8 @@ void main() {
material.emissive = payload.emissive;
material.roughness = payload.roughness;
C += throughput * payload.emissive;
if (brdfType == SPECULAR_TYPE)
C += throughput * payload.emissive;
// Decide whether ray continues through, or relfects
if (rand01() > payload.reflection) {
@ -284,11 +286,9 @@ void main() {
if (bounce == push_constants.bounces - 1)
break;
vec3 shadingNormal = payload.normal;
vec3 geometryNormal = payload.normal;
vec3 V = -direction;
int brdfType;
if (material.metalness == 1.0f && material.roughness == 0.0f) {
// Fast path for mirrors
brdfType = SPECULAR_TYPE;