Skip to content

Commit

Permalink
Merge branch 'ralston/bounded_vndf_sampling' into 'main'
Browse files Browse the repository at this point in the history
[REMIX-844] Material Bounded VNDF Sampling

Closes REMIX-844

See merge request lightspeedrtx/dxvk-remix-nv!989
  • Loading branch information
anon-apple committed Oct 4, 2024
2 parents 3b321ad + 23f94f6 commit e232de9
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 166 deletions.
2 changes: 1 addition & 1 deletion src/dxvk/shaders/rtx/algorithm/integrator_direct.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void sampleIndirectRayForFirstBounce(
primaryPolymorphicSurfaceMaterialInteraction,
firstRayPathSampledLobe, firstSampledLobePdf, firstSampledSolidAnglePdf,
true);

// Set the material medium index if a medium was entered or exited
mediumChanged = evalMediumChange(oldInsideMedium, insideMedium, primaryPolymorphicSurfaceMaterialInteraction, mediumMaterialIndex);

Expand Down
12 changes: 6 additions & 6 deletions src/dxvk/shaders/rtx/algorithm/integrator_indirect.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -694,19 +694,19 @@ void integratePathVertex(
// Note: This logic will conditionally terminate paths based on the effective throughput, allowing for
// paths which contribute little to the final image to be shorter while paths which are more important
// are allowed to be longer.
float continueProbability = calculateRussianRouletteContinueProbability(

const float continueProbability = calculateRussianRouletteContinueProbability(
calcBt709Luminance(pathState.throughput),
isOpaqueMaterial,
isOpaqueMaterial,
continuationLobe != opaqueLobeTypeDiffuseReflection,
opaqueSurfaceMaterialInteraction.isotropicRoughness,
rayInteraction.hitDistance / pathState.accumulatedHitDistance);

const float continueSample = getNextSampleBlueNoise(randomState);
// Note: <= used to ensure path never continues if the probability is 0 (and to avoid NaNs in the
// throughput when the probability is divided into it).
const bool terminate = continueProbability <= continueSample;

if (terminate)
{
pathState.continuePath = false;
Expand All @@ -717,7 +717,7 @@ void integratePathVertex(
// in denoising when the continue probability is very low, but this math has been validated to be
// correct as far as I can tell.
continuationThroughput /= continueProbability;
}
}
}

// Steal samples from restir gi
Expand Down
Loading

0 comments on commit e232de9

Please sign in to comment.