Skip to content

Commit 63c77d4

Browse files
authored
Only sample analytic lights when they are present (#249)
1 parent f7401a5 commit 63c77d4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Source/RenderPasses/MinimalPathTracer/MinimalPathTracer.rt.slang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ float3 evalDirectAnalytic(const ShadingData sd, float3 rayOrigin, inout SampleGe
209209
{
210210
// Pick one of the analytic light sources randomly with equal probability.
211211
const uint lightCount = gScene.getLightCount();
212+
if (lightCount == 0) return float3(0);
213+
212214
const uint lightIndex = min(uint(sampleNext1D(sg) * lightCount), lightCount - 1);
213215
float invPdf = lightCount; // Light selection pdf = 1.0 / lightCount.
214216

0 commit comments

Comments
 (0)