From fdce55c01da3ba343d4e2913bba3e4ca12be967d Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Fri, 9 Jun 2023 01:26:01 -0700 Subject: [PATCH 01/13] Add warning if feature ini files are missing Failures were previously silent. --- src/Features/DistantTreeLighting.cpp | 2 ++ src/Features/GrassCollision.cpp | 2 ++ src/Features/GrassLighting.cpp | 2 ++ src/Features/ScreenSpaceShadows.cpp | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/Features/DistantTreeLighting.cpp b/src/Features/DistantTreeLighting.cpp index 31cf0f487d..c81a6fdcd6 100644 --- a/src/Features/DistantTreeLighting.cpp +++ b/src/Features/DistantTreeLighting.cpp @@ -177,8 +177,10 @@ void DistantTreeLighting::Load(json& o_json) if (auto value = ini.GetValue("Info", "Version")) { enabled = true; version = value; + logger::info("TreeLODLighting.ini successfully loaded"); } else { enabled = false; + logger::warn("TreeLODLighting.ini not successfully loaded"); } } diff --git a/src/Features/GrassCollision.cpp b/src/Features/GrassCollision.cpp index c3391f3c9c..634f1c60de 100644 --- a/src/Features/GrassCollision.cpp +++ b/src/Features/GrassCollision.cpp @@ -257,8 +257,10 @@ void GrassCollision::Load(json& o_json) if (auto value = ini.GetValue("Info", "Version")) { enabledFeature = true; version = value; + logger::info("GrassCollision.ini successfully loaded"); } else { enabledFeature = false; + logger::warn("GrassCollision.ini not successfully loaded"); } } diff --git a/src/Features/GrassLighting.cpp b/src/Features/GrassLighting.cpp index 3de0f0a0fe..7e79621972 100644 --- a/src/Features/GrassLighting.cpp +++ b/src/Features/GrassLighting.cpp @@ -123,8 +123,10 @@ void GrassLighting::Load(json& o_json) if (auto value = ini.GetValue("Info", "Version")) { enabled = true; version = value; + logger::info("GrassLighting.ini successfully loaded"); } else { enabled = false; + logger::warn("GrassLighting.ini not successfully loaded"); } } diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index 366e964aa6..7a4666cf8a 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -418,8 +418,10 @@ void ScreenSpaceShadows::Load(json& o_json) if (auto value = ini.GetValue("Info", "Version")) { enabledFeature = true; version = value; + logger::info("ScreenSpaceShadows.ini successfully loaded"); } else { enabledFeature = false; + logger::warn("ScreenSpaceShadows.ini not successfully loaded"); } } From ee78dbe6dd2e31072afad44f46f9b213b4b14594 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Fri, 9 Jun 2023 01:28:32 -0700 Subject: [PATCH 02/13] Convert ScreenSpaceShadows to ng --- src/Features/ScreenSpaceShadows.cpp | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index 7a4666cf8a..3b3627c58d 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -158,14 +158,14 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) auto context = RE::BSGraphics::Renderer::GetSingleton()->GetRuntimeData().context; - auto accumulator = BSGraphics::BSShaderAccumulator::GetCurrentAccumulator(); + auto accumulator = RE::BSGraphics::BSShaderAccumulator::GetCurrentAccumulator(); - if (auto sunLight = (NiDirectionalLight*)accumulator->m_ActiveShadowSceneNode->sunLight->light.get()) { - auto renderer = BSGraphics::Renderer::QInstance(); + if (auto sunLight = (NiDirectionalLight*)accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get()) { + auto renderer = RE::BSGraphics::Renderer::GetSingleton(); if (!screenSpaceShadowsTexture) { { - auto device = RE::BSGraphics::Renderer::GetSingleton()->GetRuntimeData().forwarder; + auto device = renderer->GetRuntimeData().forwarder; D3D11_SAMPLER_DESC samplerDesc = {}; samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; @@ -179,10 +179,10 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) } { - auto shadowMask = renderer->pRenderTargets[RENDER_TARGET_SHADOW_MASK]; + auto shadowMask = renderer->GetRuntimeData().renderTargets[RE::RENDER_TARGETS::kSHADOW_MASK]; D3D11_TEXTURE2D_DESC texDesc{}; - shadowMask.Texture->GetDesc(&texDesc); + shadowMask.texture->GetDesc(&texDesc); texDesc.Format = DXGI_FORMAT_R16_FLOAT; texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_RENDER_TARGET; screenSpaceShadowsTexture = new Texture2D(texDesc); @@ -206,11 +206,11 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) } } - auto shadowState = BSGraphics::RendererShadowState::QInstance(); + auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton(); bool enableSSS = true; - if (shadowState->m_CubeMapRenderTarget == RENDER_TARGET_CUBEMAP_REFLECTIONS) { + if (shadowState->cubeMapRenderTarget == RE::RENDER_TARGETS_CUBEMAP::kREFLECTIONS) { enableSSS = false; } else if (!renderedScreenCamera && enabled) { @@ -248,8 +248,8 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) data.RcpBufferDim.x = 1.0f / screenSpaceShadowsTexture->desc.Width; data.RcpBufferDim.y = 1.0f / screenSpaceShadowsTexture->desc.Height; - data.ProjMatrix = shadowState->m_CameraData.m_ProjMat; - data.InvProjMatrix = XMMatrixInverse(nullptr, shadowState->m_CameraData.m_ProjMat); + data.ProjMatrix = shadowState->GetRuntimeData2().cameraData.getEye().projMat; + data.InvProjMatrix = XMMatrixInverse(nullptr, data.ProjMatrix); auto& direction = sunLight->GetWorldDirection(); DirectX::XMFLOAT3 position{}; @@ -258,10 +258,10 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) position.z = -direction.z; auto invDirLightDirectionWS = XMLoadFloat3(&position); - data.InvDirLightDirectionVS = XMVector3TransformCoord(invDirLightDirectionWS, shadowState->m_CameraData.m_ViewMat); + data.InvDirLightDirectionVS = XMVector3TransformCoord(invDirLightDirectionWS, shadowState->GetRuntimeData2().cameraData.getEye().viewMat); data.ShadowDistance = 10000.0f; - + data.Settings = settings; raymarchCB->Update(data); @@ -272,9 +272,9 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) context->CSSetSamplers(0, 1, &computeSampler); - auto depth = renderer->pDepthStencils[DEPTH_STENCIL_POST_ZPREPASS_COPY]; + auto depth = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGET_DEPTHSTENCIL::kPOST_ZPREPASS_COPY]; - ID3D11ShaderResourceView* view = depth.DepthSRV; + ID3D11ShaderResourceView* view = depth.depthSRV; context->CSSetShaderResources(0, 1, &view); ID3D11UnorderedAccessView* uav = screenSpaceShadowsTexture->uav.get(); @@ -349,13 +349,13 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) } PerPass data{}; - data.EnableSSS = enableSSS && shadowState->m_RasterStateCullMode <= 1 && enabled; + data.EnableSSS = enableSSS && shadowState->rasterStateCullMode <= 1 && enabled; perPass->Update(data); if (renderedScreenCamera) { - auto shadowMask = renderer->pDepthStencils[DEPTH_STENCIL_POST_ZPREPASS_COPY]; + auto shadowMask = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGET_DEPTHSTENCIL::kPOST_ZPREPASS_COPY]; ID3D11ShaderResourceView* views[2]{}; - views[0] = shadowMask.DepthSRV; + views[0] = shadowMask.depthSRV; views[1] = screenSpaceShadowsTexture->srv.get(); context->PSSetShaderResources(20, ARRAYSIZE(views), views); } From d9d550c28206096d5823792f355826dd3215aaf8 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Fri, 9 Jun 2023 01:29:24 -0700 Subject: [PATCH 03/13] Add additional debug logging to ScreenSpaceShadows These are at debug and shouldn't' be spammy --- src/Features/ScreenSpaceShadows.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index 3b3627c58d..ae658fc699 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -132,22 +132,28 @@ void ScreenSpaceShadows::ClearComputeShader() ID3D11ComputeShader* ScreenSpaceShadows::GetComputeShader() { - if (!raymarchProgram) + if (!raymarchProgram) { + logger::debug("Compiling raymarchProgram"); raymarchProgram = (ID3D11ComputeShader*)Util::CompileShader(L"Data\\Shaders\\ScreenSpaceShadows\\RaymarchCS.hlsl", {}, "cs_5_0"); + } return raymarchProgram; } ID3D11ComputeShader* ScreenSpaceShadows::GetComputeShaderHorizontalBlur() { - if (!horizontalBlurProgram) + if (!horizontalBlurProgram) { + logger::debug("Compiling horizontalBlurProgram"); horizontalBlurProgram = (ID3D11ComputeShader*)Util::CompileShader(L"Data\\Shaders\\ScreenSpaceShadows\\FilterCS.hlsl", { { "HORIZONTAL", "" } }, "cs_5_0"); + } return horizontalBlurProgram; } ID3D11ComputeShader* ScreenSpaceShadows::GetComputeShaderVerticalBlur() { - if (!verticalBlurProgram) + if (!verticalBlurProgram) { verticalBlurProgram = (ID3D11ComputeShader*)Util::CompileShader(L"Data\\Shaders\\ScreenSpaceShadows\\FilterCS.hlsl", { { "VERTICAL", "" } }, "cs_5_0"); + logger::debug("Compiling verticalBlurProgram"); + } return verticalBlurProgram; } @@ -165,6 +171,8 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) if (!screenSpaceShadowsTexture) { { + logger::debug("Creating screenSpaceShadowsTexture"); + auto device = renderer->GetRuntimeData().forwarder; D3D11_SAMPLER_DESC samplerDesc = {}; From e39c236f129a9515d0c673f65f9ca9cf7860aaeb Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sat, 10 Jun 2023 11:34:59 +0100 Subject: [PATCH 04/13] Version bump --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5ed0db590..dbec9d18af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21) project( CommunityShaders - VERSION 0.2.0 + VERSION 0.3.0 LANGUAGES CXX ) From 934e86b1e159e767c145dee3c21159a5f6076ef2 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sat, 10 Jun 2023 12:02:37 +0100 Subject: [PATCH 05/13] Fixed incorrectly building for VR --- Build Release.bat | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Build Release.bat b/Build Release.bat index 66d50a41a3..c46d364f27 100644 --- a/Build Release.bat +++ b/Build Release.bat @@ -2,7 +2,7 @@ RMDIR dist /S /Q -cmake -S . --preset=VR --check-stamp-file "build\CMakeFiles\generate.stamp" +cmake -S . --preset=FLATRIM --check-stamp-file "build\CMakeFiles\generate.stamp" if %ERRORLEVEL% NEQ 0 exit 1 cmake --build build --config Release if %ERRORLEVEL% NEQ 0 exit 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index dbec9d18af..34b30b36b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21) project( CommunityShaders - VERSION 0.3.0 + VERSION 0.3.1 LANGUAGES CXX ) From 6f768ae519e8e3c67090e48fd7f7c220becacb43 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sat, 10 Jun 2023 13:05:31 +0100 Subject: [PATCH 06/13] Reverted to non-VR shader --- package/Shaders/RunGrass.hlsl | 140 +++++++++------------------------- 1 file changed, 36 insertions(+), 104 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 72981fd5d6..a62930f2ba 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -8,7 +8,6 @@ struct VS_INPUT float4 InstanceData2 : TEXCOORD5; float4 InstanceData3 : TEXCOORD6; float4 InstanceData4 : TEXCOORD7; - uint InstanceID : SV_InstanceID0; }; struct VS_OUTPUT @@ -23,41 +22,36 @@ struct VS_OUTPUT #endif float4 WorldPosition : POSITION1; float4 PreviousWorldPosition : POSITION2; - float o7 : SV_ClipDistance0; - float p7 : SV_CullDistance0; }; #ifdef VSHADER - -cbuffer cb7 : register(b7) -{ - float4 cb7[1]; -} - -cbuffer cb8 : register(b8) +cbuffer PerGeometry : register(b2) { - float4 cb8[240]; + row_major float4x4 WorldViewProj : packoffset(c0); + row_major float4x4 WorldView : packoffset(c4); + row_major float4x4 World : packoffset(c8); + row_major float4x4 PreviousWorld : packoffset(c12); + float4 FogNearColor : packoffset(c16); + float3 WindVector : packoffset(c17); + float WindTimer : packoffset(c17.w); + float3 DirLightDirection : packoffset(c18); + float PreviousWindTimer : packoffset(c18.w); + float3 DirLightColor : packoffset(c19); + float AlphaParam1 : packoffset(c19.w); + float3 AmbientColor : packoffset(c20); + float AlphaParam2 : packoffset(c20.w); + float3 ScaleMask : packoffset(c21); + float ShadowClampValue : packoffset(c21.w); } -cbuffer PerGeometry : register(b2) -{ - float4 cb2[32] : packoffset(c0); - float4 FogNearColor : packoffset(c32); - float3 WindVector : packoffset(c33); - float WindTimer : packoffset(c33.w); - float3 DirLightDirection : packoffset(c34); - float PreviousWindTimer : packoffset(c34.w); - float3 DirLightColor : packoffset(c35); - float AlphaParam1 : packoffset(c35.w); - float3 AmbientColor : packoffset(c36); - float AlphaParam2 : packoffset(c36.w); - float3 ScaleMask : packoffset(c37); - float ShadowClampValue : packoffset(c37.w); +cbuffer cb7 : register(b7) +{ + float4 cb7[1]; } -cbuffer cb13 : register(b13) +cbuffer cb8 : register(b8) { - float4 cb13[3]; + float4 cb8[240]; } #define M_PI 3.1415925 // PI @@ -104,24 +98,10 @@ VS_OUTPUT main(VS_INPUT input) { VS_OUTPUT vsout; - float4 r0,r1,r2,r3,r4,r5,r6; - uint4 bitmask, uiDest; - float4 fDest; - - r0.x = (int)input.InstanceID & 1; - r0.x = (uint)r0.x; - r0.x = cb13[0].y * r0.x; - r0.x = (uint)r0.x; - r0.z = (uint)r0.x << 2; - r0.y = (uint)r0.x << 2; - float4 msPosition = GetMSPosition(input, WindTimer); - float4 projSpacePosition; - projSpacePosition.x = dot(cb2[r0.z+0].xyzw, msPosition.xyzw); - projSpacePosition.y = dot(cb2[r0.z+1].xyzw, msPosition.xyzw); - projSpacePosition.z = dot(cb2[r0.z+2].xyzw, msPosition.xyzw); - projSpacePosition.w = dot(cb2[r0.z+3].xyzw, msPosition.xyzw); + float4 projSpacePosition = mul(WorldViewProj, msPosition); + vsout.HPosition = projSpacePosition; #if defined(RENDER_DEPTH) vsout.Depth = projSpacePosition.zw; @@ -143,38 +123,12 @@ VS_OUTPUT main(VS_INPUT input) vsout.AmbientColor.xyz = input.InstanceData1.www * (AmbientColor.xyz * input.Color.xyz); vsout.AmbientColor.w = ShadowClampValue; - vsout.WorldPosition.x = dot(cb2[r0.z+16].xyzw, msPosition.xyzw); - vsout.WorldPosition.y = dot(cb2[r0.z+17].xyzw, msPosition.xyzw); - vsout.WorldPosition.z = dot(cb2[r0.z+18].xyzw, msPosition.xyzw); - vsout.WorldPosition.w = dot(cb2[r0.z+19].xyzw, msPosition.xyzw); + vsout.ViewSpacePosition = mul(WorldView, msPosition).xyz; + vsout.WorldPosition = mul(World, msPosition); float4 previousMsPosition = GetMSPosition(input, PreviousWindTimer); - - vsout.PreviousWorldPosition.x = dot(cb2[r0.z+24].xyzw, previousMsPosition.xyzw); - vsout.PreviousWorldPosition.y = dot(cb2[r0.z+25].xyzw, previousMsPosition.xyzw); - vsout.PreviousWorldPosition.z = dot(cb2[r0.z+26].xyzw, previousMsPosition.xyzw); - vsout.PreviousWorldPosition.w = dot(cb2[r0.z+27].xyzw, previousMsPosition.xyzw); - - vsout.ViewSpacePosition.x = dot(cb2[r0.z+8].xyzw, msPosition.xyzw); - vsout.ViewSpacePosition.y = dot(cb2[r0.z+9].xyzw, msPosition.xyzw); - vsout.ViewSpacePosition.z = dot(cb2[r0.z+10].xyzw, msPosition.xyzw); - - if (0 < cb13[0].y) { - r0.yz = dot(projSpacePosition, cb13[r0.x+1].xyzw); - } else { - r0.yz = float2(1,1); - } - - r0.w = 2 + -cb13[0].y; - r0.x = dot(cb13[0].zw, M_IdentityMatrix[r0.x+0].xy); - r0.xw = r0.xw * projSpacePosition.wx; - r0.x = cb13[0].y * r0.x; - - vsout.HPosition.x = r0.w * 0.5 + r0.x; - vsout.HPosition.yzw = projSpacePosition.yzw; - vsout.o7.x = r0.z; - vsout.p7.x = r0.y; + vsout.PreviousWorldPosition = mul(PreviousWorld, previousMsPosition); return vsout; } @@ -200,27 +154,18 @@ SamplerState SampShadowMaskSampler : register(s1); Texture2D TexBaseSampler : register(t0); Texture2D TexShadowMaskSampler : register(t1); -cbuffer AlphaTestRefCB : register(b13) +cbuffer AlphaTestRefCB : register(b11) { float AlphaTestRefRS : packoffset(c0); } -cbuffer cb0 : register(b0) +cbuffer PerFrame : register(b12) { - float4 cb0[10]; -} - -struct PerEye -{ - row_major float4x4 ScreenProj; - row_major float4x4 PreviousScreenProj; + float4 UnknownPerFrame1[12] : packoffset(c0); + row_major float4x4 ScreenProj : packoffset(c12); + row_major float4x4 PreviousScreenProj : packoffset(c16); }; -cbuffer cb12 : register(b12) -{ - float4 cb12[87]; -} - PS_OUTPUT main(PS_INPUT input) { PS_OUTPUT psout; @@ -250,24 +195,12 @@ PS_OUTPUT main(PS_INPUT input) psout.Albedo.xyz = input.TexCoord.zzz * (diffuseColor * diffuseFraction + ambientColor); psout.Albedo.w = 1; - float stereoUV = input.HPosition.x * cb0[9].x + cb0[9].z; - stereoUV = stereoUV * cb12[86].x; - - uint eyeIndex = (stereoUV >= 0.5); - - float3 screenPosition; - screenPosition.x = dot(cb12[eyeIndex+24].xyzw, input.WorldPosition); - screenPosition.y = dot(cb12[eyeIndex+25].xyzw, input.WorldPosition); - screenPosition.z = dot(cb12[eyeIndex+27].xyzw, input.WorldPosition); - screenPosition.xy = screenPosition.xy / screenPosition.zz; - - float3 previousScreenPosition; - previousScreenPosition.x = dot(cb12[eyeIndex+32].xyzw, input.PreviousWorldPosition); - previousScreenPosition.y = dot(cb12[eyeIndex+33].xyzw, input.PreviousWorldPosition); - previousScreenPosition.z = dot(cb12[eyeIndex+35].xyzw, input.PreviousWorldPosition); - previousScreenPosition.xy = previousScreenPosition.xy / previousScreenPosition.zz; - + float4 screenPosition = mul(ScreenProj, input.WorldPosition); + screenPosition.xy = screenPosition.xy / screenPosition.ww; + float4 previousScreenPosition = mul(PreviousScreenProj, input.PreviousWorldPosition); + previousScreenPosition.xy = previousScreenPosition.xy / previousScreenPosition.ww; float2 screenMotionVector = float2(-0.5, 0.5) * (screenPosition.xy - previousScreenPosition.xy); + psout.MotionVectors = screenMotionVector; float3 ddx = ddx_coarse(input.ViewSpacePosition); @@ -276,7 +209,6 @@ PS_OUTPUT main(PS_INPUT input) float normalScale = max(1.0 / 1000.0, sqrt(normal.z * -8 + 8)); psout.Normal.xy = float2(0.5, 0.5) + normal.xy / normalScale; psout.Normal.zw = float2(0, 0); - #endif return psout; From 7ab18536ec21f5f6a46c74f2d5baedc933564105 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sat, 10 Jun 2023 13:10:20 +0100 Subject: [PATCH 07/13] Fixed DRS --- CMakeLists.txt | 2 +- src/Features/ScreenSpaceShadows.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34b30b36b7..5e5187fd0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21) project( CommunityShaders - VERSION 0.3.1 + VERSION 0.3.2 LANGUAGES CXX ) diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index be11137d67..eeb04a81fc 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -238,8 +238,8 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) { auto viewport = RE::BSGraphics::State::GetSingleton(); - float resolutionX = screenSpaceShadowsTexture->desc.Width * viewport->dynamicResolutionCurrentWidthScale; - float resolutionY = screenSpaceShadowsTexture->desc.Height * viewport->dynamicResolutionCurrentHeightScale; + float resolutionX = screenSpaceShadowsTexture->desc.Width * viewport->GetRuntimeData().dynamicResolutionCurrentWidthScale; + float resolutionY = screenSpaceShadowsTexture->desc.Height * viewport->GetRuntimeData().dynamicResolutionCurrentHeightScale; { RaymarchCB data{}; @@ -253,8 +253,8 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) data.ProjMatrix = shadowState->m_CameraData.m_ProjMat; data.InvProjMatrix = XMMatrixInverse(nullptr, shadowState->m_CameraData.m_ProjMat); - data.DynamicRes.x = viewport->dynamicResolutionCurrentWidthScale; - data.DynamicRes.y = viewport->dynamicResolutionCurrentHeightScale; + data.DynamicRes.x = viewport->GetRuntimeData().dynamicResolutionCurrentWidthScale; + data.DynamicRes.y = viewport->GetRuntimeData().dynamicResolutionCurrentHeightScale; data.DynamicRes.z = 1.0f / data.DynamicRes.x; data.DynamicRes.w = 1.0f / data.DynamicRes.y; From 7a29b39e6eda032e854ff269978a292ac5d96a74 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:50:46 +0100 Subject: [PATCH 08/13] Screen-Space Shadows support for Tree LOD --- .../Shaders/DistantTree.hlsl | 35 +++++++++++++++---- .../Shaders/Features/TreeLODLighting.ini | 2 +- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/features/Tree LOD Lighting/Shaders/DistantTree.hlsl b/features/Tree LOD Lighting/Shaders/DistantTree.hlsl index 9fb6a88da6..d622c7778f 100644 --- a/features/Tree LOD Lighting/Shaders/DistantTree.hlsl +++ b/features/Tree LOD Lighting/Shaders/DistantTree.hlsl @@ -101,13 +101,25 @@ cbuffer AlphaTestRefCB : register(b11) float AlphaTestRefRS : packoffset(c0); } -cbuffer PerFrame : register(b12) +cbuffer PerFrame : register(b12) { - float4 UnknownPerFrame1[12] : packoffset(c0); - row_major float4x4 ScreenProj : packoffset(c12); - row_major float4x4 PreviousScreenProj : packoffset(c16); + row_major float4x4 ViewMatrix : packoffset(c0); + row_major float4x4 ProjMatrix : packoffset(c4); + row_major float4x4 ViewProjMatrix : packoffset(c8); + row_major float4x4 ViewProjMatrixUnjittered : packoffset(c12); + row_major float4x4 PreviousViewProjMatrixUnjittered : packoffset(c16); + row_major float4x4 InvProjMatrixUnjittered : packoffset(c20); + row_major float4x4 ProjMatrixUnjittered : packoffset(c24); + row_major float4x4 InvViewMatrix : packoffset(c28); + row_major float4x4 InvViewProjMatrix : packoffset(c32); + row_major float4x4 InvProjMatrix : packoffset(c36); + float4 CurrentPosAdjust : packoffset(c40); + float4 PreviousPosAdjust : packoffset(c41); + // notes: FirstPersonY seems 1.0 regardless of third/first person, could be LE legacy stuff + float4 GammaInvX_FirstPersonY_AlphaPassZ_CreationKitW : packoffset(c42); + float4 DynamicRes_WidthX_HeightY_PreviousWidthZ_PreviousHeightW : packoffset(c43); + float4 DynamicRes_InvWidthX_InvHeightY_WidthClampZ_HeightClampW : packoffset(c44); } - cbuffer PerTechnique : register(b0) { float4 DiffuseColor : packoffset(c0); @@ -171,6 +183,10 @@ float3x3 CalculateTBN(float3 N, float3 p, float2 uv) Texture2D TexShadowMaskSampler : register(t17); +#if defined(SCREEN_SPACE_SHADOWS) + #include "ScreenSpaceShadows/ShadowsPS.hlsli" +#endif + PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) { PS_OUTPUT psout; @@ -207,9 +223,9 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) } #endif - float4 screenPosition = mul(ScreenProj, input.WorldPosition); + float4 screenPosition = mul(ViewProjMatrixUnjittered, input.WorldPosition); screenPosition.xy = screenPosition.xy / screenPosition.ww; - float4 previousScreenPosition = mul(PreviousScreenProj, input.PreviousWorldPosition); + float4 previousScreenPosition = mul(PreviousViewProjMatrixUnjittered, input.PreviousWorldPosition); previousScreenPosition.xy = previousScreenPosition.xy / previousScreenPosition.ww; float2 screenMotionVector = float2(-0.5, 0.5) * (screenPosition.xy - previousScreenPosition.xy); @@ -246,6 +262,11 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) float3 nsDirLightColor = dirLightColor; +#if defined(SCREEN_SPACE_SHADOWS) + float dirLightSShadow = PrepassScreenSpaceShadows(input.WorldPosition); + shadowColor *= dirLightSShadow; +#endif + dirLightColor *= min(lerp(1, input.TexCoord.zzz, FogDimmerAmount), min(0.5, shadowColor)); float3 diffuseColor = 0; diff --git a/features/Tree LOD Lighting/Shaders/Features/TreeLODLighting.ini b/features/Tree LOD Lighting/Shaders/Features/TreeLODLighting.ini index 19f01444dc..735cfd23a9 100644 --- a/features/Tree LOD Lighting/Shaders/Features/TreeLODLighting.ini +++ b/features/Tree LOD Lighting/Shaders/Features/TreeLODLighting.ini @@ -1,2 +1,2 @@ [Info] -Version = 1-0-0 \ No newline at end of file +Version = 1-0-1 \ No newline at end of file From 6a867f91267cc6c0615c3b51fe614106b7602ab7 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 10 Jun 2023 19:38:49 -0700 Subject: [PATCH 09/13] Fix broken shadows due to bad ng offset --- extern/CommonLibSSE-NG | 2 +- src/Features/Clustered.cpp | 10 ++++++---- src/Features/DistantTreeLighting.cpp | 7 ++++--- src/Features/GrassCollision.cpp | 8 ++++---- src/Features/GrassLighting.cpp | 4 ++-- src/Features/ScreenSpaceShadows.cpp | 21 +++++++++++++++------ 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/extern/CommonLibSSE-NG b/extern/CommonLibSSE-NG index 1abf78d62b..887c11060c 160000 --- a/extern/CommonLibSSE-NG +++ b/extern/CommonLibSSE-NG @@ -1 +1 @@ -Subproject commit 1abf78d62b6e502f4461793a911eca9e1c44175c +Subproject commit 887c11060ce7866e4c6b6c7e749a3b8404d42d2e diff --git a/src/Features/Clustered.cpp b/src/Features/Clustered.cpp index 32942b53cf..9c58c4954a 100644 --- a/src/Features/Clustered.cpp +++ b/src/Features/Clustered.cpp @@ -61,10 +61,10 @@ void Clustered::UpdateLights() RE::NiPoint3 eyePosition{}; if (REL::Module::IsVR()) { // find center of eye position - eyePosition = state->GetVRRuntimeData2().posAdjust.getEye() + state->GetVRRuntimeData2().posAdjust.getEye(1); + eyePosition = state->GetVRRuntimeData().posAdjust.getEye() + state->GetVRRuntimeData().posAdjust.getEye(1); eyePosition /= 2; } else - eyePosition = state->GetRuntimeData2().posAdjust.getEye(); + eyePosition = state->GetRuntimeData().posAdjust.getEye(); worldPos = worldPos - eyePosition; logger::trace("Set {}light {} at ({} {} {}) because of eye ({} {} {})", bsShadowLight ? "shadow" : "", niLight->name, worldPos.x, worldPos.y, worldPos.z, @@ -75,8 +75,10 @@ void Clustered::UpdateLights() position.y = worldPos.y; position.z = worldPos.z; light.positionWS = XMLoadFloat3(&position); - light.positionVS = XMVector3TransformCoord(light.positionWS, state->GetVRRuntimeData2().cameraData.getEye().viewMat); - + if (!REL::Module::IsVR()) + light.positionVS = XMVector3TransformCoord(light.positionWS, state->GetRuntimeData().cameraData.getEye().viewMat); + else + light.positionVS = XMVector3TransformCoord(light.positionWS, state->GetVRRuntimeData().cameraData.getEye().viewMat); light.radius = niLight->GetLightRuntimeData().radius.x; light.active = true; diff --git a/src/Features/DistantTreeLighting.cpp b/src/Features/DistantTreeLighting.cpp index c81a6fdcd6..895c913330 100644 --- a/src/Features/DistantTreeLighting.cpp +++ b/src/Features/DistantTreeLighting.cpp @@ -105,15 +105,16 @@ void DistantTreeLighting::ModifyDistantTree(const RE::BSShader*, const uint32_t RE::NiPoint3 eyePosition{}; if (REL::Module::IsVR()) { // find center of eye position - eyePosition = state->GetVRRuntimeData2().posAdjust.getEye() + state->GetVRRuntimeData2().posAdjust.getEye(1); + eyePosition = state->GetVRRuntimeData().posAdjust.getEye() + state->GetVRRuntimeData().posAdjust.getEye(1); eyePosition /= 2; } else - eyePosition = state->GetRuntimeData2().posAdjust.getEye(); + eyePosition = state->GetRuntimeData().posAdjust.getEye(); perPassData.EyePosition.x = position.x - eyePosition.x; perPassData.EyePosition.y = position.y - eyePosition.y; perPassData.EyePosition.z = position.z - eyePosition.z; - if (auto sunLight = (NiDirectionalLight*)accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get()) { + auto sunLight = skyrim_cast(accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get()); + if (sunLight) { auto imageSpaceManager = RE::ImageSpaceManager::GetSingleton(); perPassData.DirLightScale = imageSpaceManager->data.baseData.hdr.sunlightScale * sunLight->GetLightRuntimeData().fade; diff --git a/src/Features/GrassCollision.cpp b/src/Features/GrassCollision.cpp index 634f1c60de..69e9804144 100644 --- a/src/Features/GrassCollision.cpp +++ b/src/Features/GrassCollision.cpp @@ -128,10 +128,10 @@ void GrassCollision::UpdateCollisions() RE::NiPoint3 eyePosition{}; if (REL::Module::IsVR()) { // find center of eye position - eyePosition = state->GetVRRuntimeData2().posAdjust.getEye() + state->GetVRRuntimeData2().posAdjust.getEye(1); + eyePosition = state->GetVRRuntimeData().posAdjust.getEye() + state->GetVRRuntimeData().posAdjust.getEye(1); eyePosition /= 2; } else - eyePosition = state->GetRuntimeData2().posAdjust.getEye(); + eyePosition = state->GetRuntimeData().posAdjust.getEye(); data.centre.x = centerPos.x - eyePosition.x; data.centre.y = centerPos.y - eyePosition.y; data.centre.z = centerPos.z - eyePosition.z; @@ -202,10 +202,10 @@ void GrassCollision::ModifyGrass(const RE::BSShader*, const uint32_t) RE::NiPoint3 eyePosition{}; if (REL::Module::IsVR()) { // find center of eye position - eyePosition = state->GetVRRuntimeData2().posAdjust.getEye() + state->GetVRRuntimeData2().posAdjust.getEye(1); + eyePosition = state->GetVRRuntimeData().posAdjust.getEye() + state->GetVRRuntimeData().posAdjust.getEye(1); eyePosition /= 2; } else - eyePosition = state->GetRuntimeData2().posAdjust.getEye(); + eyePosition = state->GetRuntimeData().posAdjust.getEye(); perFrameData.boundCentre.x = bound.center.x - eyePosition.x; perFrameData.boundCentre.y = bound.center.y - eyePosition.y; perFrameData.boundCentre.z = bound.center.z - eyePosition.z; diff --git a/src/Features/GrassLighting.cpp b/src/Features/GrassLighting.cpp index 7e79621972..bb6d28c917 100644 --- a/src/Features/GrassLighting.cpp +++ b/src/Features/GrassLighting.cpp @@ -64,10 +64,10 @@ void GrassLighting::ModifyGrass(const RE::BSShader*, const uint32_t descriptor) RE::NiPoint3 eyePosition{}; if (REL::Module::IsVR()) { // find center of eye position - eyePosition = state->GetVRRuntimeData2().posAdjust.getEye() + state->GetVRRuntimeData2().posAdjust.getEye(1); + eyePosition = state->GetVRRuntimeData().posAdjust.getEye() + state->GetVRRuntimeData().posAdjust.getEye(1); eyePosition /= 2; } else - eyePosition = state->GetRuntimeData2().posAdjust.getEye(); + eyePosition = state->GetRuntimeData().posAdjust.getEye(); perFrameData.EyePosition.x = position.x - eyePosition.x; perFrameData.EyePosition.y = position.y - eyePosition.y; perFrameData.EyePosition.z = position.z - eyePosition.z; diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index 5d3a1cfcd8..ff9991e4d1 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -3,6 +3,8 @@ #include "State.h" #include "Util.h" +using RE::RENDER_TARGETS; + void ScreenSpaceShadows::DrawSettings() { if (ImGui::BeginTabItem("Screen-Space Shadows")) { @@ -164,8 +166,8 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) auto context = RE::BSGraphics::Renderer::GetSingleton()->GetRuntimeData().context; auto accumulator = RE::BSGraphics::BSShaderAccumulator::GetCurrentAccumulator(); - - if (auto sunLight = (NiDirectionalLight*)accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get()) { + auto sunLight = skyrim_cast(accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get()); + if (sunLight) { auto renderer = RE::BSGraphics::Renderer::GetSingleton(); if (!screenSpaceShadowsTexture) { @@ -217,7 +219,7 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) bool enableSSS = true; - if (shadowState->cubeMapRenderTarget == RE::RENDER_TARGETS_CUBEMAP::kREFLECTIONS) { + if (shadowState->GetRuntimeData().cubeMapRenderTarget == RE::RENDER_TARGETS_CUBEMAP::kREFLECTIONS) { enableSSS = false; } else if (!renderedScreenCamera && enabled) { @@ -256,6 +258,10 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) data.RcpBufferDim.x = 1.0f / data.BufferDim.x; data.RcpBufferDim.y = 1.0f / data.BufferDim.y; + if (REL::Module::IsVR()) + data.ProjMatrix = shadowState->GetVRRuntimeData().cameraData.getEye().projMat; + else + data.ProjMatrix = shadowState->GetRuntimeData().cameraData.getEye().projMat; data.ProjMatrix = shadowState->GetRuntimeData2().cameraData.getEye().projMat; data.InvProjMatrix = XMMatrixInverse(nullptr, data.ProjMatrix); @@ -271,9 +277,12 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) position.x = -direction.x; position.y = -direction.y; position.z = -direction.z; + auto viewMatrix = shadowState->GetRuntimeData().cameraData.getEye().viewMat; + if (REL::Module::IsVR()) + viewMatrix = shadowState->GetVRRuntimeData().cameraData.getEye().viewMat; auto invDirLightDirectionWS = XMLoadFloat3(&position); - data.InvDirLightDirectionVS = XMVector3TransformCoord(invDirLightDirectionWS, shadowState->GetRuntimeData2().cameraData.getEye().viewMat); + data.InvDirLightDirectionVS = XMVector3TransformCoord(invDirLightDirectionWS, viewMatrix); data.ShadowDistance = 10000.0f; @@ -287,7 +296,7 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) context->CSSetSamplers(0, 1, &computeSampler); - auto depth = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGET_DEPTHSTENCIL::kPOST_ZPREPASS_COPY]; + auto depth = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGETS_DEPTHSTENCIL::kPOST_ZPREPASS_COPY]; ID3D11ShaderResourceView* view = depth.depthSRV; context->CSSetShaderResources(0, 1, &view); @@ -364,7 +373,7 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) } PerPass data{}; - data.EnableSSS = enableSSS && shadowState->rasterStateCullMode <= 1 && enabled; + data.EnableSSS = enableSSS && shadowState->GetRuntimeData().rasterStateCullMode <= 1 && enabled; perPass->Update(data); if (renderedScreenCamera) { From d4ee3f15b474751e59d913ed68c90d486d325071 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 10 Jun 2023 19:39:02 -0700 Subject: [PATCH 10/13] Add BSGraphics static asserts --- src/RE/BSGraphics.h | 13 +++++++++++++ src/RE/BSGraphicsTypes.h | 25 ++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/RE/BSGraphics.h b/src/RE/BSGraphics.h index 1c77dba719..4922cb01a8 100644 --- a/src/RE/BSGraphics.h +++ b/src/RE/BSGraphics.h @@ -22,6 +22,19 @@ namespace BSGraphics char _pad0[0x8]; }; static_assert(sizeof(ViewData) == 0x250); + static_assert(offsetof(ViewData, m_ViewUp) == 0); + static_assert(offsetof(ViewData, m_ViewRight) == 0x10); + static_assert(offsetof(ViewData, m_ViewDir) == 0x20); + static_assert(offsetof(ViewData, m_ViewMat) == 0x30); + static_assert(offsetof(ViewData, m_ProjMat) == 0x70); + static_assert(offsetof(ViewData, m_ViewProjMat) == 0xb0); + static_assert(offsetof(ViewData, m_UnknownMat1) == 0xf0); + static_assert(offsetof(ViewData, m_ViewProjMatrixUnjittered) == 0x130); + static_assert(offsetof(ViewData, m_PreviousViewProjMatrixUnjittered) == 0x170); + static_assert(offsetof(ViewData, m_ProjMatrixUnjittered) == 0x1b0); + static_assert(offsetof(ViewData, m_UnknownMat2) == 0x1f0); + static_assert(offsetof(ViewData, m_ViewPort) == 0x230); + static_assert(offsetof(ViewData, m_ViewDepthRange) == 0x240); struct CameraStateData { diff --git a/src/RE/BSGraphicsTypes.h b/src/RE/BSGraphicsTypes.h index fe8410ef85..a4b6df5e90 100644 --- a/src/RE/BSGraphicsTypes.h +++ b/src/RE/BSGraphicsTypes.h @@ -584,17 +584,32 @@ namespace BSGraphics uint64_t m_VertexDesc; VertexShader* m_CurrentVertexShader; PixelShader* m_CurrentPixelShader; - D3D11_PRIMITIVE_TOPOLOGY m_Topology; + D3D11_PRIMITIVE_TOPOLOGY m_Topology; // 358 - RE::NiPoint3 m_PosAdjust; - RE::NiPoint3 m_PreviousPosAdjust; - ViewData m_CameraData; + RE::NiPoint3 m_PosAdjust; // 35c + RE::NiPoint3 m_PreviousPosAdjust; //368 + ViewData m_CameraData; // 380 - uint32_t m_AlphaBlendModeExtra; + uint32_t m_AlphaBlendModeExtra; //5d0 char _pad0[0xC]; static RendererShadowState* QInstance(); }; + static_assert(sizeof(RendererShadowState) == 0x5e0); + static_assert(offsetof(RendererShadowState, m_RenderTargets) == 0x18); + static_assert(offsetof(RendererShadowState, m_ViewPort) == 0x70); + static_assert(offsetof(RendererShadowState, m_AlphaTestEnabled) == 0xb4); + static_assert(offsetof(RendererShadowState, m_PSTextureAddressMode) == 0xbc); + static_assert(offsetof(RendererShadowState, m_PSTextureFilterMode) == 0xfc); + static_assert(offsetof(RendererShadowState, m_PSTexture) == 0x140); + static_assert(offsetof(RendererShadowState, m_CSUAV) == 0x300); + static_assert(offsetof(RendererShadowState, m_VertexDesc) == 0x340); + static_assert(offsetof(RendererShadowState, m_CurrentVertexShader) == 0x348); + static_assert(offsetof(RendererShadowState, m_CurrentPixelShader) == 0x350); + static_assert(offsetof(RendererShadowState, m_Topology) == 0x358); + static_assert(offsetof(RendererShadowState, m_PosAdjust) == 0x35c); + static_assert(offsetof(RendererShadowState, m_PreviousPosAdjust) == 0x368); + static_assert(offsetof(RendererShadowState, m_CameraData) == 0x380); class Renderer { From c3720a64926ac50ab9ea340a2fd483849892de20 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 10 Jun 2023 19:39:42 -0700 Subject: [PATCH 11/13] Fix VR controlmap --- src/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menu.cpp b/src/Menu.cpp index aa68cb9936..1d0c05ff56 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -156,7 +156,7 @@ RE::BSEventNotifyControl Menu::ProcessEvent(RE::InputEvent* const* a_event, RE:: IsEnabled = !IsEnabled; if (const auto controlMap = RE::ControlMap::GetSingleton()) { - controlMap->ignoreKeyboardMouse = IsEnabled; + controlMap->GetRuntimeData().ignoreKeyboardMouse = IsEnabled; } } else From 2ed079cf0a05cd4526fee18655e91fbfced9f0b7 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 10 Jun 2023 19:47:48 -0700 Subject: [PATCH 12/13] Compile for ALL for default build VR doesn't CTD but shaders need to be fixed. --- Build Release.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build Release.bat b/Build Release.bat index c46d364f27..62a75e0872 100644 --- a/Build Release.bat +++ b/Build Release.bat @@ -2,7 +2,7 @@ RMDIR dist /S /Q -cmake -S . --preset=FLATRIM --check-stamp-file "build\CMakeFiles\generate.stamp" +cmake -S . --preset=ALL --check-stamp-file "build\CMakeFiles\generate.stamp" if %ERRORLEVEL% NEQ 0 exit 1 cmake --build build --config Release if %ERRORLEVEL% NEQ 0 exit 1 From 47ac1cc1971f0e391220d991b1f6ca1508d6f6e3 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 10 Jun 2023 19:59:39 -0700 Subject: [PATCH 13/13] Remove redundant setting of data.ProjMatrix --- src/Features/ScreenSpaceShadows.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Features/ScreenSpaceShadows.cpp b/src/Features/ScreenSpaceShadows.cpp index ff9991e4d1..32c013ff1e 100644 --- a/src/Features/ScreenSpaceShadows.cpp +++ b/src/Features/ScreenSpaceShadows.cpp @@ -263,7 +263,6 @@ void ScreenSpaceShadows::ModifyLighting(const RE::BSShader*, const uint32_t) else data.ProjMatrix = shadowState->GetRuntimeData().cameraData.getEye().projMat; - data.ProjMatrix = shadowState->GetRuntimeData2().cameraData.getEye().projMat; data.InvProjMatrix = XMMatrixInverse(nullptr, data.ProjMatrix); data.DynamicRes.x = viewport->GetRuntimeData().dynamicResolutionCurrentWidthScale;