Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
487 commits
Select commit Hold shift + click to select a range
d65e4be
Update src/Features/Effect11/EffectManager.cpp
doodlum Apr 12, 2026
e87d5ad
Merge branch 'effect11updated' of https://github.com/doodlum/skyrim-c…
doodlum Apr 12, 2026
0e2cab4
fix: rabbit fix
doodlum Apr 12, 2026
5778f2d
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Apr 12, 2026
0f0dce2
fix: make rabbit happy
doodlum Apr 12, 2026
ed23795
Merge branch 'effect11updated' of https://github.com/doodlum/skyrim-c…
doodlum Apr 12, 2026
cf93fd8
Update package/Shaders/Sky.hlsl
doodlum Apr 12, 2026
484a77a
Merge branch 'dev' into effect11updated
doodlum Apr 14, 2026
f1726b3
Merge branch 'dev' into effect11updated
doodlum Apr 17, 2026
5bc9433
fix: fixes
doodlum Apr 17, 2026
d61ff01
fix: fix minor issues
doodlum Apr 17, 2026
a102da8
fix: fixes
doodlum Apr 17, 2026
e456e50
fix: check sun
doodlum Apr 17, 2026
52b92bf
fix: set ibl to enb mode
doodlum Apr 17, 2026
692ad51
feat: better sss
doodlum Apr 17, 2026
7ec8e49
Merge branch 'dev' into effect11updated
doodlum Apr 17, 2026
f5ae4af
chore: bump sss
doodlum Apr 17, 2026
2f146c3
Merge branch 'effect11updated' of https://github.com/doodlum/skyrim-c…
doodlum Apr 17, 2026
bebcd78
fix: fix overdarkness
doodlum Apr 18, 2026
b893ac6
chore: idk
doodlum Apr 18, 2026
b167a05
fix: fix warning
doodlum Apr 18, 2026
0c4d52f
Merge branch 'dev' into effect11updated
doodlum Apr 18, 2026
c0153b2
perf: more sss optimisations
doodlum Apr 18, 2026
8942525
Merge branch 'effect11updated' of https://github.com/doodlum/skyrim-c…
doodlum Apr 18, 2026
96d6ed0
chore: reneable skin soft lighting
doodlum Apr 18, 2026
2bc1445
chore: dont touch ibl i guess
doodlum Apr 18, 2026
01fe7b4
feat: better sss
doodlum Apr 21, 2026
0e28f83
chore: revert strength
doodlum Apr 21, 2026
863a0e6
fix: fix dynamic resolution
doodlum Apr 21, 2026
19d5099
chore: skylighting updates
doodlum Apr 21, 2026
269c9d0
chore: clean up
doodlum Apr 21, 2026
31570fd
fix(cloud-shadows): track cloud layer order to validate deferred samp…
doodlum Apr 30, 2026
38081f4
fix: starting to work
doodlum May 1, 2026
012823d
chore: clean up
doodlum May 1, 2026
f5ea86d
chore: poc stuff
doodlum May 2, 2026
aaa949e
Merge remote-tracking branch 'origin/dev' into effect11updated
doodlum May 2, 2026
08debe0
chore: update CommonLibSSE-NG submodule
doodlum May 2, 2026
d4b9b7b
refactor: move PumboAutoHDR to DisplayMapping
doodlum May 2, 2026
8e5020d
fix: shader patching
doodlum May 2, 2026
ac0a276
feat: preset management
doodlum May 2, 2026
0d5b0f5
fix: fix vl and ibl
doodlum May 2, 2026
73b307e
chore: sss rotation
doodlum May 2, 2026
036eb4c
chore: externalise shaders
doodlum May 2, 2026
48b1855
chore: sss tweaks
doodlum May 2, 2026
e0e0861
fix: force disable sss for eye
doodlum May 2, 2026
3b7a721
fix: fixes
doodlum May 2, 2026
1be9227
chore: bunch of shader patches
doodlum May 2, 2026
2f442dd
refactor: move files
doodlum May 2, 2026
b9ddc15
chore: clean up shader patch
doodlum May 2, 2026
9f89c91
fix: fix blood on sss
doodlum May 2, 2026
faf72cc
fix: more fixes
doodlum May 2, 2026
af841f8
fix: dont override menu lights
doodlum May 2, 2026
be8e4c5
fix: fix ui in interior
doodlum May 2, 2026
9411de0
feat(cloud-shadows): merge inner-cloud-shadow (C++ only)
doodlum May 2, 2026
5484b2b
chore: let data folder work as an enb folder
doodlum May 2, 2026
719cd34
chore: optimised scaling
doodlum May 2, 2026
4ebc73c
feat: worky
doodlum May 3, 2026
b8b1bb7
refactor: clean up
doodlum May 3, 2026
83c67b4
fix: fixes and cleanup
doodlum May 3, 2026
48eb609
refactor: more cleanup
doodlum May 3, 2026
dbe7af4
chore: clean up and fixes
doodlum May 3, 2026
088f2f8
refactor: simplify
doodlum May 3, 2026
8bf1126
perf: optimisations
doodlum May 3, 2026
b06f680
refactor: clean up ui defines
doodlum May 3, 2026
659295e
refactor: cleanup
doodlum May 3, 2026
469e829
refactor: more cleanup
doodlum May 3, 2026
d6792a4
chore: add missing features
doodlum May 3, 2026
5530055
fix: fix ordering
doodlum May 3, 2026
388e521
refactor: cleanup
doodlum May 3, 2026
e47ea4a
refactor: minor cleanup
doodlum May 3, 2026
7a2d6f8
refactor: slightly simpler
doodlum May 3, 2026
a703285
refactor: simplify
doodlum May 3, 2026
91ab44c
fix: fix nonsense
doodlum May 3, 2026
41114b5
fix: close by default
doodlum May 3, 2026
66d1e53
refactor: more cleanup
doodlum May 3, 2026
8a7f255
fix: fixes
doodlum May 3, 2026
08316b5
fix: alternative parsing
doodlum May 3, 2026
da6d0bd
refactor: rename and clean up
doodlum May 4, 2026
c4b6ff3
fix: clean up and fix deviations
doodlum May 4, 2026
d5d7a45
refactor: move to native effect
doodlum May 4, 2026
3531368
chore: clean up
doodlum May 4, 2026
33f7cc5
fix: fix nonsense
doodlum May 4, 2026
727bf61
fix: fix top level
doodlum May 4, 2026
9c87c19
fix: more fixes
doodlum May 4, 2026
92f91e2
fix: more fixes
doodlum May 4, 2026
18d1398
fix: more fixes
doodlum May 4, 2026
54a3f3b
fix: fix nonsense
doodlum May 4, 2026
8a3383a
fix: add enb extender version
doodlum May 5, 2026
78b2f01
fix: fix some downscale related issues
doodlum May 5, 2026
46ce6f8
fix: fix interior time of day
doodlum May 5, 2026
97ca9d4
refactor: clean up time of day
doodlum May 5, 2026
7bf6870
fix: fix vectors
doodlum May 5, 2026
ea40908
merge: update to latest dev
doodlum May 5, 2026
5617e5e
fix: fixes
doodlum May 5, 2026
fda3e33
fix: more fixes
doodlum May 5, 2026
c92b867
fix: fix texture loading
doodlum May 5, 2026
1f3b6fd
fix: fix ordering
doodlum May 5, 2026
b777fa7
fix: fix overly saturated ibl
doodlum May 5, 2026
f01a1af
chore: kiefx at runtime
doodlum May 5, 2026
f8213c1
chore: add error message for kiefx
doodlum May 5, 2026
c5c74f1
refactor: move preprocessing to enbextender
doodlum May 5, 2026
36d8169
chore: use better widgets
doodlum May 6, 2026
89a01de
fix: fix smaa issues
doodlum May 6, 2026
f0259fa
feat: patch settings and optimisations
doodlum May 6, 2026
bbe674e
fix: scale some values by colorpow
doodlum May 6, 2026
c33464b
fix: log some missing settings
doodlum May 6, 2026
14aef8c
fix: fix lightsprites
doodlum May 6, 2026
0902c09
fix: fix some ibl things
doodlum May 6, 2026
81e0405
fix: fix enb ibl color
doodlum May 6, 2026
c8e72e9
chore: attenuate samples
doodlum May 6, 2026
1247aa3
fix: remove colorpow
doodlum May 6, 2026
cb79894
fix: fix specular in linear space
doodlum May 7, 2026
97615c8
fix: fix ibl compile error
doodlum May 7, 2026
a293108
feat: procedural gradient
doodlum May 7, 2026
298254a
Merge branch 'dev' into effect11sh2
doodlum May 9, 2026
d2a4671
chore: bump versions
doodlum May 9, 2026
d2f154f
fix: fix nonsense
doodlum May 9, 2026
cc8bcb6
fix: fix weather
doodlum May 9, 2026
fbbe935
Merge branch 'dev' into effect11sh2
doodlum May 9, 2026
01915a4
chore: height fog things
doodlum May 9, 2026
02b9935
chore: remove volumetric rays (they are bad)
doodlum May 10, 2026
c03d687
fix: fixes
doodlum May 10, 2026
10b761c
chore: revert nonsense
doodlum May 10, 2026
2a161ab
fix: skip nonsense
doodlum May 10, 2026
3ae0fe5
fix: fix exponential fog
doodlum May 10, 2026
74d82df
fix: fix lightsprite
doodlum May 10, 2026
c10295a
fix: fix multipass techniques
doodlum May 10, 2026
eb3484f
chore: remove most shader patches
doodlum May 10, 2026
a6f6032
fix: fix some particle settings
doodlum May 10, 2026
ac743d9
chore: clean up ibl/skylighting shading
doodlum May 10, 2026
95f641b
fix: remove ibl gating
doodlum May 10, 2026
35db73b
refactor: use shared epsilon
doodlum May 10, 2026
dd739f6
chore: remove ibl changes
doodlum May 10, 2026
47d2a9d
chore: remove unused functions
doodlum May 10, 2026
c993c27
fix: skylighting in gamma space
doodlum May 10, 2026
fb81056
refactor: clean up skylighting
doodlum May 10, 2026
0cc48c2
Merge commit '52c493e2e' into effect11sh2
doodlum May 10, 2026
a341564
chore: enb attenuation
doodlum May 10, 2026
d52230d
chore: dont modify water
doodlum May 10, 2026
8ef2e67
chore: remove particle settings
doodlum May 10, 2026
918855d
feat: proceduralsun
doodlum May 10, 2026
bbc766f
chore: set values
doodlum May 10, 2026
76adbcd
chore: set max flt min
doodlum May 10, 2026
cf80175
fix: fix sky compile
doodlum May 10, 2026
e31fe62
chore: tweak sun settings
doodlum May 10, 2026
81816c8
chore: better sun glow curve
doodlum May 10, 2026
05d5939
feat: better procedural sky
doodlum May 11, 2026
cf06473
chore: revert change
doodlum May 11, 2026
c0b2de1
fix: allow zero curve
doodlum May 11, 2026
39f66b2
refactor: cleanup
doodlum May 11, 2026
7b24fe6
fix: cursed string fix
doodlum May 11, 2026
6e73da9
chore: update skylighting
doodlum May 11, 2026
385550e
Merge branch 'dev' into effect11sh2
doodlum May 11, 2026
240ba7d
fix: fix procedural sun edges
doodlum May 12, 2026
54346e0
fix: ibl fixes
doodlum May 12, 2026
9187097
Merge branch 'dev' into effect11sh2
doodlum May 12, 2026
c4093f4
fix: dont error on missing file
doodlum May 12, 2026
f2d9f7a
chore: rename logging
doodlum May 12, 2026
c55c50f
feat: better error display
doodlum May 12, 2026
2ce2205
fix: better settings patches
doodlum May 12, 2026
a272ca4
fix: readonly unmodifiable
doodlum May 12, 2026
c497e0a
chore: add back applyskylighting
doodlum May 13, 2026
58d9efc
chore: add back particle settings
doodlum May 13, 2026
ce653a7
fix: fix some ibl things
doodlum May 13, 2026
d8ba3c1
chore: rename to load and apply
doodlum May 13, 2026
7076725
chore: add particle light intensity
doodlum May 13, 2026
ee2b822
feat: start adding cloud scatter
doodlum May 15, 2026
46df9bc
chore: add moons
doodlum May 15, 2026
929aadf
chore: add more support for cloud scatter
doodlum May 15, 2026
41cb497
chore: add volumetricrays settings
doodlum May 16, 2026
caeba29
feat: initial volumtricrays implementation
doodlum May 16, 2026
4ad71d3
perf: optimise
doodlum May 16, 2026
8bfb24e
perf: more optimisations
doodlum May 16, 2026
5b44571
fix: move volumetric rays to its own pass
doodlum May 16, 2026
08d7d6b
chore: simplify math
doodlum May 16, 2026
3c23382
chore: optimisations
doodlum May 16, 2026
4703b7c
refactor: move volumetricrays
doodlum May 16, 2026
36f4f15
fix: dont modify alpha
doodlum May 16, 2026
898342b
refactor: unify skysync and effect11
doodlum May 16, 2026
2561a40
chore: clean up skysync etc
doodlum May 16, 2026
b047b28
fix: fix volumetric rays at night
doodlum May 16, 2026
6a44e8d
fix: more skysync fixes
doodlum May 16, 2026
126ab6e
chore: clear up
doodlum May 16, 2026
8e81120
chore: more clean up
doodlum May 16, 2026
d614b06
chore: delay moon fade in
doodlum May 16, 2026
97b6a8b
feat: betterer
doodlum May 16, 2026
59a7209
fix: many fixes for skysync
doodlum May 17, 2026
baa8167
fix: copy to framebuffer2
doodlum May 17, 2026
b180248
chore: disable alt sun path by default
doodlum May 17, 2026
818c060
fix: fix volumetricrays
doodlum May 17, 2026
8ba80cb
chore: exterior only settings
doodlum May 17, 2026
4fcd8a1
fix: consider enbeffect.fx missing an error
doodlum May 17, 2026
9fd3783
Merge branch 'dev' into effect11sh2
doodlum May 17, 2026
9df9441
fix: effect fixes
doodlum May 17, 2026
33a916f
fix: use volumetric fog check
doodlum May 17, 2026
c7599b6
fix: fix nonsense
doodlum May 17, 2026
a42f3d5
refactor: organise settings and defaults
doodlum May 17, 2026
4bec434
fix: fix volumetric rays color
doodlum May 18, 2026
9f83a62
fix: no enb specific logic
doodlum May 18, 2026
3990d02
chore: simplify sun more
doodlum May 18, 2026
bb7637d
fix: sky shader fixes
doodlum May 18, 2026
7d0416f
chore: remove CalculateCloudsEdgeFromScattering setting
doodlum May 18, 2026
dfb083d
feat: optimise volumetric rays
doodlum May 18, 2026
576fe3d
chore: adjust color correction
doodlum May 18, 2026
835b81c
fix: fix props for orbital bodies
doodlum May 18, 2026
bb3eb10
fix: compensate cloud scatter
doodlum May 18, 2026
b58145e
fix: cursed fix
doodlum May 18, 2026
1a41d5c
fix: fix sun
doodlum May 18, 2026
a0b1473
fix: add dither
doodlum May 18, 2026
e14258a
chore: improve dithering
doodlum May 18, 2026
c30033e
chore: clear up
doodlum May 18, 2026
a4748af
chore: more aggressive dither
doodlum May 18, 2026
e4f027e
chore: add pdf reference
doodlum May 18, 2026
aabb75f
chore: use highest quality possible dither
doodlum May 18, 2026
72b5fc4
chore: less aggressive dither
doodlum May 18, 2026
bad2fa8
chore: mix with original noise
doodlum May 18, 2026
262decb
fix: add ibl to particle
doodlum May 18, 2026
f9c48cd
feat: rain/snow starting to work
doodlum May 19, 2026
f23cd92
chore: closer but needs work
doodlum May 19, 2026
6307e19
fix: fixes
doodlum May 19, 2026
1340473
perf: optimise rain
doodlum May 19, 2026
ac9529f
perf: optimise some overdraw
doodlum May 19, 2026
44446fe
chore: perf improvements and removed snow
doodlum May 19, 2026
6c1883f
feat: statistics page
doodlum May 20, 2026
97fd961
feat: getting there
doodlum May 20, 2026
ccf4d6f
feat: advanced profiling
doodlum May 20, 2026
1caf44c
fix: partial banding fix
doodlum May 21, 2026
23f9649
fix: better banding fix
doodlum May 21, 2026
ce588f1
fix: clean up
doodlum May 21, 2026
de059f3
fix: correct math
doodlum May 21, 2026
0917d4b
feat: sloppy rain
doodlum May 21, 2026
90dfaef
perf: optimise
doodlum May 21, 2026
f35af49
chore: revert
doodlum May 21, 2026
07cd327
feat: doesnt suck
doodlum May 21, 2026
056f1c5
fix: clean up settings
doodlum May 21, 2026
2578549
fix: fix saturation
doodlum May 21, 2026
2696459
fix: use extractlighting again
doodlum May 21, 2026
c0043b0
chore: remove presets system for now
doodlum May 21, 2026
c1cf4d9
chore: bump feature versions
doodlum May 21, 2026
d8310d9
Merge remote-tracking branch 'origin/dev' into effect11sh2
doodlum May 21, 2026
fca7f7a
fix: fix ssgi overdarkening
doodlum May 21, 2026
a84fb0e
fix: disable more settings
doodlum May 21, 2026
651367d
fix: more fixes
doodlum May 21, 2026
35e5cff
fix: linearise vertexao
doodlum May 22, 2026
182d77b
fix: more fixes, skylighting
doodlum May 22, 2026
19ae982
fix: fix volumetric shadows
doodlum May 22, 2026
ec115d1
fix: use msm
doodlum May 22, 2026
472e222
fix: maybe fixes something
doodlum May 22, 2026
6f3d18e
fix: start fixing skylighting
doodlum May 22, 2026
91862cf
chore: add back blur
doodlum May 22, 2026
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: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ find_package(unordered_dense CONFIG REQUIRED)
find_package(efsw CONFIG REQUIRED)
find_package(Tracy CONFIG REQUIRED)
find_package(directx-headers CONFIG REQUIRED)
find_package(effects11 CONFIG REQUIRED)

add_subdirectory(${CMAKE_SOURCE_DIR}/cmake/Streamline)

find_path(DETOURS_INCLUDE_DIRS "detours/detours.h")
Expand Down Expand Up @@ -142,6 +144,8 @@ target_link_libraries(
d3d12.lib
Microsoft::DirectX-Headers
${DETOURS_LIBRARY}
Microsoft::Effects11
windowsapp
)

# Some third-party libs (e.g. FFX backend) are built with /GL.
Expand Down
15 changes: 9 additions & 6 deletions features/Cloud Shadows/Shaders/CloudShadows/CloudShadows.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ namespace CloudShadows
{
TextureCube<float> CloudShadowsTexture : register(t25);

// 2 km cloud altitude / 6371 km planet radius converted from metres
// to game units. The original 1.428e-2 is GAME_UNIT_TO_M (1.428f / 100),
// so dividing by GAME_UNIT_TO_M is the exact same value. Game.hlsli
// parenthesizes the macro, so the operator precedence is preserved.
const static float CloudHeight = (2e3f / GAME_UNIT_TO_M) * 0.25;
const static float CloudHeight = (2e3f / GAME_UNIT_TO_M);
const static float PlanetRadius = (6371e3f / GAME_UNIT_TO_M);
const static float RcpHPlusR = (1.0 / (CloudHeight + PlanetRadius));

Expand All @@ -27,6 +23,13 @@ namespace CloudShadows
{
float3 cloudSampleDir = GetCloudShadowSampleDir(worldPosition, SharedData::DirLightDirection.xyz).xyz;
float cloudCubeSample = CloudShadowsTexture.SampleLevel(textureSampler, cloudSampleDir, 0).x;
return lerp(1.0, 1.0 - cloudCubeSample, SharedData::cloudShadowsSettings.Opacity);
return saturate(1.0 - cloudCubeSample * SharedData::cloudShadowsSettings.Opacity);
}

float GetTrueCloudShadowMult(float3 worldPosition, SamplerState textureSampler)
{
float3 cloudSampleDir = GetCloudShadowSampleDir(worldPosition, SharedData::SunDirection.xyz).xyz;
float cloudCubeSample = CloudShadowsTexture.SampleLevel(textureSampler, cloudSampleDir, 0).x;
return 1.0 - cloudCubeSample;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Info]
Version = 2-3-1
Version = 2-4-0

[Nexus]
autoupload = false
42 changes: 42 additions & 0 deletions features/Effect11/Shaders/Effect11/ApplyVolumetricRaysPS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "Common/SharedData.hlsli"

#if defined(IBL)
# define IBL_DEFERRED
# include "IBL/IBL.hlsli"
#endif

Texture2D<float> BlurredShadowTexture : register(t0);

struct VS_OUTPUT_POST
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

float4 main(VS_OUTPUT_POST input) : SV_Target0
{
float2 uv = input.txcoord0;
uint eyeIndex = 0;

float volumetricShadow = BlurredShadowTexture.Load(int3(input.pos.xy, 0));

float depth = SharedData::GetDepth(uv);
float4 positionCS = float4(2 * float2(uv.x, -uv.y + 1) - 1, depth, 1);
float4 positionMS = mul(FrameBuffer::CameraViewProjInverse[eyeIndex], positionCS);
positionMS.xyz /= positionMS.w;

float3 viewDirection = normalize(positionMS.xyz);

float phase = dot(viewDirection, SharedData::SunDirection.xyz) * 0.5 + 0.5;
float3 lightColor = SharedData::SunColor.xyz * phase;

#if defined(IBL)
float3 ibl = ImageBasedLighting::GetSkyIBL(float3(0, 0, -1));
ibl = lerp(dot(ibl, 1.0 / 3.0), ibl, 2.0);
lightColor += ibl * SharedData::enbSettings.VolumetricRaysSkyColorAmount;
#endif

float3 volumetricColor = volumetricShadow * lightColor * SharedData::enbSettings.VolumetricRaysIntensity * SharedData::SunColor.w;

return float4(volumetricColor, 0);
}
44 changes: 44 additions & 0 deletions features/Effect11/Shaders/Effect11/ColorCorrectionCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cbuffer ColorCorrectionParams : register(b0)
{
float Brightness;
float GammaCurve;
uint FrameCount;
};

RWTexture2D<float4> OutputTexture : register(u0);

uint3 pcg3d(uint3 v)
{
v = v * 1664525u + 1013904223u;
v.x += v.y * v.z;
v.y += v.z * v.x;
v.z += v.x * v.y;
v ^= v >> 16u;
v.x += v.y * v.z;
v.y += v.z * v.x;
v.z += v.x * v.y;
return v;
}

float3 TriDither(float2 screenPos, uint frameCount)
{
uint3 seed1 = uint3(screenPos, frameCount);
uint3 seed2 = uint3(screenPos, frameCount + 4729u);
return (pcg3d(seed1) - pcg3d(seed2)) / float(0xFFFFFFFFu);
}

[numthreads(8, 8, 1)] void main(uint3 id
: SV_DispatchThreadID)
{
uint width, height;
OutputTexture.GetDimensions(width, height);
if (id.x >= width || id.y >= height) {
return;
}

float4 color = OutputTexture[id.xy];
color.rgb = pow(abs(color.rgb), GammaCurve);
color.rgb *= Brightness;
color.rgb += TriDither(float2(id.xy), FrameCount) / 1023.0;
OutputTexture[id.xy] = color;
}
39 changes: 39 additions & 0 deletions features/Effect11/Shaders/Effect11/CopyPS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Texture2D SourceTexture : register(t0);

cbuffer DitherParams : register(b0)
{
uint FrameCount;
};

struct PS_INPUT
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

uint3 pcg3d(uint3 v)
{
v = v * 1664525u + 1013904223u;
v.x += v.y * v.z;
v.y += v.z * v.x;
v.z += v.x * v.y;
v ^= v >> 16u;
v.x += v.y * v.z;
v.y += v.z * v.x;
v.z += v.x * v.y;
return v;
}

float3 TriDither(float2 screenPos, uint frameCount)
{
uint3 seed1 = uint3(screenPos, frameCount);
uint3 seed2 = uint3(screenPos, frameCount + 4729u);
return (pcg3d(seed1) - pcg3d(seed2)) / float(0xFFFFFFFFu);
}

float4 main(PS_INPUT input) : SV_TARGET
{
float3 color = SourceTexture.Load(int3(input.pos.xy, 0)).rgb;
color += TriDither(input.pos.xy, FrameCount) / 255.0;
return float4(color, 1.0);
}
13 changes: 13 additions & 0 deletions features/Effect11/Shaders/Effect11/DownsamplePS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Texture2D<float4> SourceTexture : register(t0);
SamplerState LinearSampler : register(s0);

struct PS_INPUT
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

float4 main(PS_INPUT input) : SV_Target
{
return SourceTexture.SampleLevel(LinearSampler, input.txcoord0.xy, 0);
}
22 changes: 22 additions & 0 deletions features/Effect11/Shaders/Effect11/KawaseBlurPS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Texture2D<float4> SourceTexture : register(t0);
SamplerState LinearSampler : register(s0);

struct PS_INPUT
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

float4 main(PS_INPUT input) : SV_Target
{
float2 texelSize = 1.0 / 1024.0;
float2 o = texelSize * 0.5;

float4 sum = 0.0;
sum += SourceTexture.SampleLevel(LinearSampler, input.txcoord0.xy + float2(-o.x, -o.y), 0);
sum += SourceTexture.SampleLevel(LinearSampler, input.txcoord0.xy + float2( o.x, -o.y), 0);
sum += SourceTexture.SampleLevel(LinearSampler, input.txcoord0.xy + float2(-o.x, o.y), 0);
sum += SourceTexture.SampleLevel(LinearSampler, input.txcoord0.xy + float2( o.x, o.y), 0);

return sum * 0.25;
}
19 changes: 19 additions & 0 deletions features/Effect11/Shaders/Effect11/QuadVS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
struct VS_INPUT_POST
{
float3 pos : POSITION;
float2 txcoord : TEXCOORD0;
};

struct VS_OUTPUT_POST
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

VS_OUTPUT_POST main(VS_INPUT_POST IN)
{
VS_OUTPUT_POST OUT;
OUT.pos = float4(IN.pos, 1.0);
OUT.txcoord0 = IN.txcoord;
return OUT;
}
55 changes: 55 additions & 0 deletions features/Effect11/Shaders/Effect11/RaymarchVolumetricRaysPS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "Common/FrameBuffer.hlsli"
#include "Common/Random.hlsli"
#include "Common/SharedData.hlsli"

#define LinearSampler defaultSampler
SamplerState defaultSampler : register(s0);

#include "Common/ShadowSampling.hlsli"

struct VS_OUTPUT_POST
{
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};

float main(VS_OUTPUT_POST input) : SV_Target0
{
float2 uv = input.txcoord0;
uint eyeIndex = 0;

float depth = SharedData::GetDepth(uv);
float4 positionCS = float4(2 * float2(uv.x, -uv.y + 1) - 1, depth, 1);
float4 positionMS = mul(FrameBuffer::CameraViewProjInverse[eyeIndex], positionCS);
positionMS.xyz /= positionMS.w;

float extinction = SharedData::enbSettings.VolumetricRaysExtinction;
float totalRayLength = length(positionMS.xyz);

const uint sampleCount = 16;
float noise = Random::InterleavedGradientNoise(input.pos.xy, SharedData::FrameCount);
float3 cameraOffset = FrameBuffer::CameraPosAdjust[eyeIndex].xyz;

float scattering = 0.0;
float transmittance = 1.0;

for (uint i = 0; i < sampleCount; i++) {
float t0 = float(i) / float(sampleCount);
float t1 = float(i + 1) / float(sampleCount);

t0 *= t0;
t1 *= t1;

float t = lerp(t0, t1, noise);
float stepLength = (t1 - t0) * totalRayLength;

float3 samplePos = positionMS.xyz * t;
float shadow = ShadowSampling::GetTrueWorldShadow(samplePos, cameraOffset, eyeIndex);

float stepTransmittance = exp(-extinction * stepLength);
scattering += shadow * (1.0 - stepTransmittance) * transmittance;
transmittance *= stepTransmittance;
}

return scattering;
}
Loading
Loading