Skip to content

Commit 027b1b2

Browse files
slight variable and function rename
1 parent 17fe8ee commit 027b1b2

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

examples_tests/42.FragmentShaderPathTracer/common.glsl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ vec3 BSDFNode_getReflectance(in BSDFNode node, in float VdotH)
242242
return albedoOrRealIoR;
243243
}
244244

245-
float BSDFNode_getMISWeight(in BSDFNode bsdf)
245+
float BSDFNode_getNEESkipProb(in BSDFNode bsdf)
246246
{
247-
const float alpha = BSDFNode_getRoughness(bsdf);
248-
const bool notDiffuse = BSDFNode_isNotDiffuse(bsdf);
249-
const float DIFFUSE_MIS_NEE_PROB = 1.0;
250-
return (notDiffuse ? (1.0-alpha*alpha):1.0)*DIFFUSE_MIS_NEE_PROB;
247+
if (BSDFNode_isNotDiffuse(bsdf))
248+
{
249+
const float alpha = BSDFNode_getRoughness(bsdf);
250+
return alpha*alpha;
251+
}
252+
return 0.0;
251253
}
252254

253255
#include <nbl/builtin/glsl/colorspace/EOTF.glsl>

examples_tests/42.FragmentShaderPathTracer/litBySphere.frag

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ bool closestHitProgram(in uint depth, in uint _sample, inout Ray_t ray, inout nb
137137
const float monochromeEta = dot(throughputCIE_Y,BSDFNode_getEta(bsdf)[0])/(throughputCIE_Y.r+throughputCIE_Y.g+throughputCIE_Y.b);
138138

139139
// do NEE
140-
const float neeProbability = BSDFNode_getMISWeight(bsdf);
140+
const float neeSkipProbability = BSDFNode_getNEESkipProb(bsdf);
141141
float rcpChoiceProb;
142-
if (!nbl_glsl_partitionRandVariable(neeProbability,epsilon[0].z,rcpChoiceProb))
142+
if (nbl_glsl_partitionRandVariable(neeSkipProbability,epsilon[0].z,rcpChoiceProb))
143143
{
144144
vec3 neeContrib; float lightPdf, t;
145145
nbl_glsl_LightSample _sample = nbl_glsl_light_generate_and_remainder_and_pdf(neeContrib,lightPdf,t,intersection,interaction,epsilon[0],depth);
@@ -175,7 +175,7 @@ bool closestHitProgram(in uint depth, in uint _sample, inout Ray_t ray, inout nb
175175
if (bsdfPdf>bsdfPdfThreshold && getLuma(throughput)>lumaThroughputThreshold)
176176
{
177177
ray._payload.throughput = throughput;
178-
ray._payload.otherTechniqueHeuristic = neeProbability/bsdfPdf; // numerically stable, don't touch
178+
ray._payload.otherTechniqueHeuristic = (1.0-neeSkipProbability)/bsdfPdf; // numerically stable, don't touch
179179
ray._payload.otherTechniqueHeuristic *= ray._payload.otherTechniqueHeuristic;
180180

181181
// trace new ray

0 commit comments

Comments
 (0)