From a011d1fa937105c528e28c5414648bab046b1b1a Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Aug 2024 08:08:11 -0700 Subject: [PATCH] Fix direct emitter hits when emitter sampling is enabled and prevent normal emitter when using emitter sampling is enabled. --- chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java b/chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java index 3a0299d01..b876e46f0 100644 --- a/chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java +++ b/chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java @@ -228,7 +228,7 @@ private static boolean doDiffuseReflection(Ray ray, Ray next, Material currentMa Vector3 emittance = new Vector3(); Vector4 indirectEmitterColor = new Vector4(0, 0, 0, 0); - if (scene.emittersEnabled && (!scene.isPreventNormalEmitterWithSampling() || scene.getEmitterSamplingStrategy() == EmitterSamplingStrategy.NONE || ray.depth == 0) && currentMat.emittance > Ray.EPSILON) { + if (scene.emittersEnabled && (!scene.isPreventNormalEmitterWithSampling() || scene.getEmitterSamplingStrategy() == EmitterSamplingStrategy.NONE || ray.depth == 1) && currentMat.emittance > Ray.EPSILON) { // Quadratic emittance mapping, so a pixel that's 50% darker will emit only 25% as much light // This is arbitrary but gives pretty good results in most cases.