Skip to content

Commit a088b16

Browse files
committed
Merge branch 'dev/ralston/rtxdi_update' into 'main'
Update RTXDI and Volumetric code See merge request lightspeedrtx/dxvk-remix-nv!1165
2 parents c9fa6da + 2bf71f4 commit a088b16

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

src/dxvk/shaders/rtx/algorithm/volume_integrator.slangh

+33-6
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,39 @@ void integrateVolume(
238238
{
239239
// Construct a new Reservoir via RIS
240240

241-
// Note: Cached light sample currently used externally, could be used to avoid needing to rederive the light sample in some
242-
// cases, but this may just add divergance and not be worth it.
243-
RAB_LightSample cachedSelectedLightSample;
244-
const VolumeReSTIR_Reservoir newVolumeReservoir = VolumeReSTIR_SampleLightRIS(
245-
rabRandomState, rabVolumeVisibilityContext, rabVolumeInteraction,
246-
cachedSelectedLightSample, volumeParameters);
241+
VolumeReSTIR_Reservoir newVolumeReservoir = VolumeReSTIR_SampleLightRIS(
242+
rabRandomState, rabVolumeVisibilityContext, rabVolumeInteraction, volumeParameters);
243+
244+
// Perform an initial visiblity check
245+
246+
if (volumeParameters.enableVolumeRISInitialVisibility && newVolumeReservoir.isValid())
247+
{
248+
// Get the light sample from the reservoir
249+
250+
RAB_LightSample rabLightSample;
251+
float inverseSelectionPdf;
252+
253+
// Note: Assuming the light sample is always valid here if it was selected to begin with via RIS.
254+
VolumeReSTIR_GetLightSample(
255+
newVolumeReservoir, rabVolumeInteraction,
256+
rabLightSample, inverseSelectionPdf);
257+
258+
// Test visibility to the light sample for the reservoir
259+
260+
// Note: Currently set to the invalid Ray Portal index until we support cross-portal lighting here.
261+
uint8_t sampledTransportPortalIndex = RTXDI_INVALID_PORTAL_INDEX;
262+
float16_t3 attenuation = float16_t3(0.0f);
263+
const bool visible = RAB_VolumeReSTIR_TraceNEEVisibility(
264+
rabLightSample, sampledTransportPortalIndex,
265+
rabVolumeVisibilityContext, rabVolumeInteraction, attenuation);
266+
267+
// Invalidate the reservoir if the visibility test fails
268+
269+
if (!visible || all(attenuation == float16_t3(0.0f)))
270+
{
271+
newVolumeReservoir.invalidate();
272+
}
273+
}
247274

248275
// Merge the new Reservoir into the current Reservoir
249276

src/dxvk/shaders/rtx/pass/volume_args.h

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ struct VolumeArgs {
3636
uint2 froxelGridDimensions;
3737
vec2 inverseFroxelGridDimensions;
3838

39+
// Note: These parameters are currently currently unused but present due to being referenced in the also currently unused VolumeReSTIR_SpatialResampling and VolumeReSTIR_TemporalResampling functions.
40+
// This comment should be removed once these parameters become properly set and the volume ReSTIR code is put into use. Do not use these parameters until then as they will not be set.
41+
uint2 restirFroxelGridDimensions;
42+
vec2 restirInverseFroxelGridDimensions;
43+
3944
uint numFroxelVolumes; // 1 if there is just the main camera volume in the texture, 3 if there are also per-portal volumes
4045
uint numActiveFroxelVolumes; // Same logic as numFroxelVolumes but only counting active volumes
4146
uint froxelDepthSlices;

submodules/rtxdi

Submodule rtxdi updated from f19c7b0 to 37ea43d

0 commit comments

Comments
 (0)