Skip to content

Commit

Permalink
chore: further effect shader tweaks (#726)
Browse files Browse the repository at this point in the history
* chore: further effect shader tweaks

* chore: remove experimental code
  • Loading branch information
doodlum authored Nov 9, 2024
1 parent f4f1383 commit 610c2e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package/Shaders/Common/ShadowSampling.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ float Get3DFilteredShadow(float3 positionWS, float3 viewDirection, float2 screen
float r = rnd.z;
float4 sincos_phi;
sincos(phi, sincos_phi.y, sincos_phi.x);
float3 sampleOffset = viewDirection * i * 128 * rcpSampleCount;
sampleOffset += (float3(r * sin_theta * sincos_phi.x, r * sin_theta * sincos_phi.y, r * cos_theta) * 0.5 + 0.5) * 128;
float3 sampleOffset = viewDirection * i * 64 * rcpSampleCount;
sampleOffset += (float3(r * sin_theta * sincos_phi.x, r * sin_theta * sincos_phi.y, r * cos_theta) * 0.5 + 0.5) * 64;

uint cascadeIndex = sD.EndSplitDistances.x < GetShadowDepth(positionWS.xyz + viewDirection * (sampleOffset.x + sampleOffset.y), eyeIndex); // Stochastic cascade sampling

Expand Down
4 changes: 1 addition & 3 deletions package/Shaders/Effect.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,7 @@ PS_OUTPUT main(PS_INPUT input)
psout.ScreenSpaceNormals.xy = screenSpaceNormal.xy + 0.5.xx;
psout.ScreenSpaceNormals.zw = 0.0.xx;
# else
psout.Normal.xyz = float3(!(ExtendedFlags & Effect_Shadows), 0, 0);
psout.Normal.w = finalColor.w;

psout.Normal = float4(!(ExtendedFlags & Effect_Shadows), 0, 0, finalColor.w);
psout.Color2 = finalColor;
# endif

Expand Down
2 changes: 2 additions & 0 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ namespace Hooks
if (state->enabledClasses[type - 1]) {
RE::BSGraphics::VertexShader* vertexShader = shaderCache.GetVertexShader(*currentShader, state->modifiedVertexDescriptor);
if (vertexShader) {
a_vertexShader = vertexShader;
state->context->VSSetShader(reinterpret_cast<ID3D11VertexShader*>(vertexShader->shader), NULL, NULL);
auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton();
GET_INSTANCE_MEMBER(currentVertexShader, shadowState)
Expand Down Expand Up @@ -523,6 +524,7 @@ namespace Hooks
if (state->enabledClasses[type - 1]) {
RE::BSGraphics::PixelShader* pixelShader = shaderCache.GetPixelShader(*currentShader, state->modifiedPixelDescriptor);
if (pixelShader) {
a_pixelShader = pixelShader;
state->context->PSSetShader(reinterpret_cast<ID3D11PixelShader*>(pixelShader->shader), NULL, NULL);
auto shadowState = RE::BSGraphics::RendererShadowState::GetSingleton();
GET_INSTANCE_MEMBER(currentPixelShader, shadowState)
Expand Down

0 comments on commit 610c2e1

Please sign in to comment.