Secondary bounce lighting now uses a stable per-hit RNG for sky/direct-light correction instead of frame-varying RNG, so bounce lighting should stop crawling/sparkling as much.

This commit is contained in:
Justin Marshall
2026-05-24 15:42:55 -07:00
parent 1bd467154e
commit 4ccdb56258
3 changed files with 181 additions and 36 deletions
+16 -3
View File
@@ -361,6 +361,8 @@ void QD3D12_SetCameraInfo(
const float* clipToView,
const float* clipToPrevClip,
const float* prevClipToClip,
const float* worldToView,
const float* viewToWorld,
const float* cameraPos,
const float* cameraRight,
const float* cameraUp,
@@ -534,6 +536,8 @@ struct QD3D12CameraState
Mat4 clipToView = Mat4::Identity();
Mat4 clipToPrevClip = Mat4::Identity();
Mat4 prevClipToClip = Mat4::Identity();
Mat4 worldToView = Mat4::Identity();
Mat4 viewToWorld = Mat4::Identity();
float cameraPos[3] = { 0.0f, 0.0f, 0.0f };
float cameraRight[3] = { 1.0f, 0.0f, 0.0f };
float cameraUp[3] = { 0.0f, 1.0f, 0.0f };
@@ -2173,6 +2177,8 @@ static bool QD3D12_UpdateCameraInfoFromCurrentMatrices()
clipToView,
clipToPrevClip,
prevClipToClip,
worldToView,
viewToWorld,
cameraPos,
cameraRight,
cameraUp,
@@ -9094,9 +9100,8 @@ static void QD3D12_RunUpscalerOrBlit(QD3D12Window& w)
rrOptions.normalRoughnessMode = sl::DLSSDNormalRoughnessMode::ePacked;
rrOptions.alphaUpscalingEnabled = sl::Boolean::eFalse;
Mat4 identity = Mat4::Identity();
memcpy(&rrOptions.worldToCameraView, identity.m, sizeof(float) * 16);
memcpy(&rrOptions.cameraViewToWorld, identity.m, sizeof(float) * 16);
memcpy(&rrOptions.worldToCameraView, g_gl.cameraState.worldToView.m, sizeof(float) * 16);
memcpy(&rrOptions.cameraViewToWorld, g_gl.cameraState.viewToWorld.m, sizeof(float) * 16);
const sl::Result rrOptionsResult = slDLSSDSetOptions(g_qd3d12Sl.viewport, rrOptions);
if (rrOptionsResult != sl::Result::eOk)
@@ -18521,6 +18526,8 @@ void QD3D12_SetCameraInfo(
const float* clipToView,
const float* clipToPrevClip,
const float* prevClipToClip,
const float* worldToView,
const float* viewToWorld,
const float* cameraPos,
const float* cameraRight,
const float* cameraUp,
@@ -18542,6 +18549,12 @@ void QD3D12_SetCameraInfo(
if (prevClipToClip)
memcpy(g_gl.cameraState.prevClipToClip.m, prevClipToClip, sizeof(float) * 16);
if (worldToView)
memcpy(g_gl.cameraState.worldToView.m, worldToView, sizeof(float) * 16);
if (viewToWorld)
memcpy(g_gl.cameraState.viewToWorld.m, viewToWorld, sizeof(float) * 16);
if (cameraPos)
{
g_gl.cameraState.cameraPos[0] = cameraPos[0];