Skip to content

Commit f7401a5

Browse files
authored
Fix nested dielectrics (#248)
1 parent 57e3d42 commit f7401a5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/Falcor/RenderPasses/Shared/PathTracer/InteriorListHelpers.slang

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,18 @@ float computeRelativeIoR(InteriorList interiorList, uint materialID, bool enteri
114114
if (entering)
115115
{
116116
float toIoR = gScene.materials[materialID].IoR;
117+
float fromIoR = 1.f;
117118
uint topMaterialID = interiorList.getTopMaterialID();
118-
float fromIoR = topMaterialID == kNoMaterial ? 1.f : gScene.materials[topMaterialID].IoR;
119+
if (topMaterialID != kNoMaterial) fromIoR = gScene.materials[topMaterialID].IoR;
119120
return fromIoR / toIoR;
120121
}
121122
else
122123
{
123124
float fromIoR = gScene.materials[materialID].IoR;
125+
float toIoR = 1.f;
124126
uint topMaterialID = interiorList.getTopMaterialID();
125127
if (topMaterialID == materialID) topMaterialID = interiorList.getNextMaterialID();
126-
float toIoR = topMaterialID == kNoMaterial ? 1.f : gScene.materials[topMaterialID].IoR;
128+
if (topMaterialID != kNoMaterial) toIoR = gScene.materials[topMaterialID].IoR;
127129
return fromIoR / toIoR;
128130
}
129131
}

0 commit comments

Comments
 (0)