Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package/Shaders/Effect.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,11 @@ float3 GetLightingColor(float3 msPosition, float3 worldPosition, float4 screenPo
color += dirLightColor * GetEffectShadow(worldPosition, normalize(worldPosition), screenPosition, eyeIndex);
}

# if !defined(LIGHT_LIMIT_FIX)
color.x += dot(PLightColorR * lightFadeMul, 1.0.xxxx);
color.y += dot(PLightColorG * lightFadeMul, 1.0.xxxx);
color.z += dot(PLightColorB * lightFadeMul, 1.0.xxxx);
# endif

return color;
}
Expand Down Expand Up @@ -621,7 +623,7 @@ PS_OUTPUT main(PS_INPUT input)
float lightDist = length(lightDirection);
float intensityFactor = saturate(lightDist / light.radius);
float intensityMultiplier = 1 - intensityFactor * intensityFactor;
float3 lightColor = light.color.xyz * intensityMultiplier;
float3 lightColor = light.color.xyz * intensityMultiplier * 0.5;
propertyColor += lightColor;
}
}
Expand Down
21 changes: 18 additions & 3 deletions package/Shaders/ISReflectionsRayTracing.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ float hash(float2 p)
return frac(p.x * p.y * float2(0.5, 0.5).x);
}

float3 ViewToUVDepthHelper(float3 x, uint eyeIndex)
{
float4 newPosition = float4(x, 1.0);
float4 uv = mul(CameraProj[eyeIndex], newPosition);
uv.xyz /= uv.w;
float3 uvDepth = float3(uv.xy * float2(0.5, -0.5) + 0.5, uv.z);
uvDepth.xy = FrameBuffer::GetDynamicResolutionAdjustedScreenPosition(uvDepth.xy);
return uvDepth;
}

PS_OUTPUT main(PS_INPUT input)
{
PS_OUTPUT psout;
Expand Down Expand Up @@ -85,6 +95,12 @@ PS_OUTPUT main(PS_INPUT input)
float ssrPower = max(srcNormal.z >= 1e-5, srcNormal.w);
bool isSsrDisabled = ssrPower < 1e-5;

[branch] if (isSsrDisabled)
{
psout.Color = 0;
return psout;
}

# if defined(SPECMASK)
float3 color = ColorTex.Sample(ColorSampler, uvStartDR).xyz;

Expand Down Expand Up @@ -116,15 +132,14 @@ PS_OUTPUT main(PS_INPUT input)
float3 uvDepthFinish = ViewToUVDepth(vsFinish.xyz);
float3 deltaUvDepth = uvDepthFinish - uvDepthStart;

float3 uvDepthFinishDR = uvDepthStart + deltaUvDepth * (SSRParams.x * rcp(length(deltaUvDepth.xy)));
float3 uvDepthFinishDR = uvDepthStart + deltaUvDepth * SSRParams.x * rcp(length(deltaUvDepth.xy));
uvDepthFinishDR.xy = FrameBuffer::GetDynamicResolutionAdjustedScreenPosition(uvDepthFinishDR.xy);

# ifdef VR
uvStartDR.xy = FrameBuffer::GetDynamicResolutionAdjustedScreenPosition(uvDepthStart.xy);
# endif

float3 uvDepthStartDR = float3(uvStartDR, vsStart.z);
float3 deltaUvDepthDR = uvDepthFinishDR - uvDepthStartDR;

float3 uvDepthPreResultDR = uvDepthStartDR;
float3 uvDepthResultDR = float3(uvDepthStartDR.xy, depthStart);
Expand All @@ -142,7 +157,7 @@ PS_OUTPUT main(PS_INPUT input)
; // Adjust based on performance/quality tradeoff

for (; iterationIndex < maxIterations; iterationIndex++) {
float3 iterationUvDepthDR = uvDepthStartDR + (iterationIndex / (float)maxIterations) * deltaUvDepthDR;
float3 iterationUvDepthDR = ViewToUVDepthHelper(lerp(csStart.xyz, csFinish.xyz, (iterationIndex / (float)maxIterations) * SSRParams.x * rcp(length(deltaUvDepth.xy))), eyeIndex);
float3 iterationUvDepthSampleDR =
# ifdef VR
// Apply dynamic resolution adjustments and stereo UV conversions
Expand Down
4 changes: 4 additions & 0 deletions src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ void LightLimitFix::BSLightingShader_SetupGeometry_GeometrySetupConstantPointLig

SetLightPosition(light, niLight->world.translate, inWorld);

light.lightFlags = static_cast<LightFlags>(runtimeData.ambient.red);

if (bsLight->IsShadowLight()) {
auto* shadowLight = static_cast<RE::BSShadowLight*>(bsLight);
GET_INSTANCE_MEMBER(shadowLightIndex, shadowLight);
Expand Down Expand Up @@ -791,6 +793,8 @@ void LightLimitFix::UpdateLights()

light.radius = runtimeData.radius.x;

light.lightFlags = static_cast<LightFlags>(runtimeData.ambient.red);

if (!IsGlobalLight(bsLight)) {
// List of BSMultiBoundRooms affected by a light
for (const auto& roomPtr : bsLight->rooms) {
Expand Down