Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
625 commits
Select commit Hold shift + click to select a range
c6d1d24
adds proper default textures for face gen
Gistix Jan 18, 2026
d4e4b30
Merge pull request #13 from jiayev/raytracing
Gistix Jan 18, 2026
ce781a0
fixes emissives when in interior cell
Gistix Jan 18, 2026
db06b43
correct hair color
jiayev Jan 18, 2026
b916069
fixes to external emittance when in interior and door/container changes
Gistix Jan 18, 2026
3a62255
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 18, 2026
bb2f34a
Merge pull request #14 from jiayev/raytracing
Gistix Jan 18, 2026
2069c7a
uses raster sky for path tracing miss
Gistix Jan 18, 2026
2ccc7f0
eval random sample lr, fix a crash
jiayev Jan 19, 2026
49ab24a
fixes cases where bonesPerVertex is set to 0 and missing createmodel …
Gistix Jan 19, 2026
a59249b
Merge branch 'pr/15' into raytracing
Gistix Jan 19, 2026
92b8c40
createmodel cleanup
Gistix Jan 19, 2026
c1594d0
adds detached status to instances
Gistix Jan 19, 2026
16bc50f
makes allocation release log debug priority
Gistix Jan 19, 2026
2338256
adds attached/detached state for instances
Gistix Jan 19, 2026
55f71ae
adds debug option to disable skinned geometry
Gistix Jan 20, 2026
bc16a03
many performance adjustments and fixes
Gistix Jan 21, 2026
9fcc737
adds hacky interior sun support
Gistix Jan 21, 2026
c9b24a8
interior sun fixes
Gistix Jan 21, 2026
7891db8
fixes point lights when isl is off
Gistix Jan 21, 2026
f261f14
Merge remote-tracking branch 'upstream/dev' into dev
Gistix Jan 21, 2026
111d776
add alphablend and alphatest flags
jiayev Jan 21, 2026
1ea2164
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 21, 2026
774056b
alpha flags
jiayev Jan 21, 2026
cc48ea5
fix crash and set alpha blend opaque for refraction
jiayev Jan 21, 2026
34a3b21
add transmission path
jiayev Jan 21, 2026
f0bce53
transmission fixes
jiayev Jan 21, 2026
8dd3f03
some fixes (not done)
jiayev Jan 21, 2026
b68fc28
fix non pbr path initialization
jiayev Jan 21, 2026
dad94c4
some more transmission fix
jiayev Jan 22, 2026
4e28e97
improves model creation logic, moves Flags to inside Shape struct and…
Gistix Jan 23, 2026
e3304fe
log cleanup
Gistix Jan 23, 2026
e2610c5
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 23, 2026
0de9476
HeadingMarker renamed to IsMarker, additional cleanup
Gistix Jan 23, 2026
b494c1f
heading marker debug log updated
Gistix Jan 23, 2026
bd151a4
add window shadow
jiayev Jan 23, 2026
b2c9efa
add accumulation mode
jiayev Jan 23, 2026
bdfac35
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 23, 2026
d2ebe5b
initial changes for proper shape visibility
Gistix Jan 23, 2026
ace3985
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 23, 2026
1951ed2
fix error and accumulation
jiayev Jan 23, 2026
3e6c19e
clean up and add simple transmission
jiayev Jan 24, 2026
6d68f59
use stochastic blend
jiayev Jan 24, 2026
63720b9
fixes for kRenderUse flag usage
Gistix Jan 24, 2026
5242073
Merge branch 'raytracing' of https://github.com/jiayev/skyrim-communi…
jiayev Jan 24, 2026
1292732
add stochastic
jiayev Jan 24, 2026
7ac87ac
better window method
jiayev Jan 24, 2026
cc73186
adds support for player character 3rd person model
Gistix Jan 25, 2026
6b8f49a
adds SE Relocation ID for TES_Load3D
Gistix Jan 25, 2026
62f89e6
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 25, 2026
df1d011
fix compile error
jiayev Jan 25, 2026
0e80bfd
temp solution disabling raster alpha blend (would need proper way)
jiayev Jan 25, 2026
b21fdcd
correct vanilla specular
jiayev Jan 25, 2026
03119f3
adds player face tint render target
Gistix Jan 25, 2026
4597aac
separate specular color
jiayev Jan 25, 2026
dce6712
Merge branch 'pr/15' into raytracing
Gistix Jan 25, 2026
0115d5d
correct offset for transmission
jiayev Jan 25, 2026
51258b0
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 25, 2026
f66a763
fix ndotl in offsetray
jiayev Jan 25, 2026
853e24b
fix nan
jiayev Jan 25, 2026
512fea7
working conversion
Gistix Jan 26, 2026
e7e270d
try transmissive window
jiayev Jan 26, 2026
d584809
fix shadowanyhit
jiayev Jan 26, 2026
879b9f4
conversion fixes and proper geometry transform
Gistix Jan 26, 2026
906f55a
hides msn conversion debug view behind def
Gistix Jan 26, 2026
42acb95
restores kModelSpaceNormals flag for kSpecular specular color
Gistix Jan 26, 2026
b27ad31
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Jan 27, 2026
c1ac67d
adds sky hemisphere rendering in interior cells
Gistix Jan 27, 2026
72ec19e
Merge remote-tracking branch 'gistix/raytracing' into raytracing
jiayev Jan 27, 2026
d17fe31
try init
jiayev Jan 27, 2026
b266ffb
try fix accumulator
jiayev Jan 27, 2026
86ff865
improve rr based on nvidia
jiayev Jan 27, 2026
b57fce7
multiple fixes
jiayev Jan 27, 2026
ba6b953
prevent window delta transmission
jiayev Jan 27, 2026
ed873e5
fix broken triangles on high-triangle count geometry
Gistix Jan 27, 2026
29f9d96
fix markers in blas
Gistix Jan 27, 2026
7592325
add cloud opacity
Gistix Jan 28, 2026
c6a9160
Merge branch 'raytracing' into raytracing-bsdf-2
Gistix Jan 28, 2026
e4b54be
BuildMaterial cleanup
Gistix Jan 28, 2026
9505742
update commonlib to 4.0.0
Gistix Jan 28, 2026
c49e4c1
Merge remote-tracking branch 'upstream/dev' into raytracing-bsdf-2
Gistix Jan 28, 2026
f12ab8b
fixes
Gistix Jan 28, 2026
301eabf
fix for cleared kOwnEmit and emissiveColor
Gistix Jan 28, 2026
4dbae52
restores shader flags
Gistix Jan 28, 2026
d60495b
cloud shadows cleanup
Gistix Jan 28, 2026
6f30446
indirection and material buffer replaced by shape buffer
Gistix Jan 29, 2026
55e6653
test with perma mapped shape buffer
Gistix Jan 29, 2026
9191dde
adds proper object to world rotation matrix
Gistix Jan 29, 2026
12a55cd
fix dynamic vertex skinning update
Gistix Jan 29, 2026
620165f
fix for double-sided geometry by enabling back-face culling
Gistix Jan 29, 2026
0023751
fixes landscape normal map and doublesided geom
Gistix Jan 29, 2026
66bc3ac
adds support for shape transform in shadow anyhit, and normal map adj…
Gistix Jan 29, 2026
d15931e
cleanup
jiayev Jan 28, 2026
cb6ef19
rayoffset from dxvk-remix
jiayev Jan 28, 2026
1914bea
fix ray logic
jiayev Jan 28, 2026
76093c1
try raycone sample
jiayev Jan 28, 2026
acaa799
fix compile
jiayev Jan 28, 2026
fcf87bb
fixes
jiayev Jan 28, 2026
70e157d
remove tmin
jiayev Jan 28, 2026
ece3411
add miplevel debug
jiayev Jan 29, 2026
3e18329
adjust shading normal
jiayev Jan 29, 2026
4d02316
adds variable update rate to instance data
Gistix Jan 29, 2026
8a7dec7
variable update rate fixes
Gistix Jan 29, 2026
eda1678
fixes
jiayev Jan 29, 2026
0f582d2
fix enter status
jiayev Jan 29, 2026
0f383c8
Merge branch 'raytracing-bsdf' into raytracing
Gistix Jan 30, 2026
91fcb88
fix sharc for specular
jiayev Jan 30, 2026
eded822
Merge branch 'heads/jiaye/raytracing' into raytracing
Gistix Jan 30, 2026
30bf607
i just gotta :(
jiayev Jan 30, 2026
909de81
fix compile
jiayev Jan 30, 2026
49c441d
kinda fix normal not facing camera
jiayev Jan 30, 2026
9346a5f
use flat normal
jiayev Jan 31, 2026
307adb7
adds raycone to GI, removes it from payload and normal warning fix
Gistix Jan 31, 2026
632a06c
raycone adjust
Gistix Jan 31, 2026
9846d22
full sample count specular hit distance
Gistix Jan 31, 2026
e534fe8
fix black faces
jiayev Jan 31, 2026
a7d5ef6
Merge branch 'heads/jiaye/raytracing' into raytracing
Gistix Jan 31, 2026
b704804
create model race condition fix
Gistix Jan 31, 2026
c3dd34c
small createmodel adjustment
Gistix Jan 31, 2026
d4e0004
add proper actor 3d release hook and cleanup
Gistix Jan 31, 2026
4733236
cleanup
Gistix Jan 31, 2026
fba7105
raygen warning fix
Gistix Jan 31, 2026
9db5afc
no need for flag cuz they got culled anyway
jiayev Feb 1, 2026
8bd1479
adds GeometryDesc function to shape
Gistix Feb 3, 2026
b3e279a
moves shape update into... shape. *gasp*
Gistix Feb 3, 2026
a6af27a
moves model blas build/update into model struct
Gistix Feb 3, 2026
b7b6b24
cleanup
Gistix Feb 3, 2026
2649785
Model::BuildBLAS simplification
Gistix Feb 3, 2026
43e4d48
cleanup
Gistix Feb 3, 2026
b8088c8
update instances update
Gistix Feb 3, 2026
157e087
this looks awful, doodlum lied
Gistix Feb 3, 2026
f2345cb
adjustments
Gistix Feb 4, 2026
043e48e
more adjustments
Gistix Feb 4, 2026
e658cea
no need for flag cuz they got culled anyway
jiayev Feb 1, 2026
37adc5a
Merge branch 'raytracing' of https://github.com/jiayev/skyrim-communi…
jiayev Feb 4, 2026
a68b45c
working blas rebuild
Gistix Feb 4, 2026
ee5cf75
cleanup
Gistix Feb 4, 2026
b2fb29f
adds dismemberreference and most code for dismember skin support
Gistix Feb 4, 2026
9623435
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 4, 2026
dad1ca7
try add hair
jiayev Feb 2, 2026
f415db0
fixes
jiayev Feb 2, 2026
0d5ee9a
better init
jiayev Feb 2, 2026
ddff4b2
fix compile
jiayev Feb 2, 2026
5dc8e88
flow map process
jiayev Feb 3, 2026
5192679
add hair setting
jiayev Feb 3, 2026
bb28b97
add subsurface
jiayev Feb 3, 2026
5a0e71d
sss fixes for now
jiayev Feb 3, 2026
59cc1c6
some sss settings
jiayev Feb 4, 2026
270d7af
more sss
jiayev Feb 4, 2026
81fede1
working dismember for player character
Gistix Feb 4, 2026
ceb4b52
more sss fix
jiayev Feb 4, 2026
9934bc5
fix seam
jiayev Feb 4, 2026
0c27827
more fixes
jiayev Feb 4, 2026
00bd7ba
better preset
jiayev Feb 4, 2026
449f074
adjustments
Gistix Feb 5, 2026
b4a3012
updates BLAS state management
Gistix Feb 5, 2026
db66822
removes Visual Studio temporary file
Gistix Feb 5, 2026
e3dac37
attempt to fix generic npcs
Gistix Feb 5, 2026
721e94d
renames variable 'meshData' to 'shape' in Raytracing::CreateModelInte…
Gistix Feb 5, 2026
b87c9f7
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
fb72912
optimization attemp by keeping buffers permanently mapped
Gistix Feb 5, 2026
5c97a4f
variable update rate update
Gistix Feb 5, 2026
9217c0a
variable update rate update
Gistix Feb 5, 2026
0b66833
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
c8e25a6
replaces SkinningPipeline upload with uploadregion
Gistix Feb 5, 2026
823735b
skinning variables renaming and cleanup
Gistix Feb 5, 2026
3d17038
remainder from skinning update
Gistix Feb 5, 2026
c46f8b8
adds final state parameter to upload region
Gistix Feb 5, 2026
112f920
changes light buffer upload to upload region
Gistix Feb 5, 2026
6f31883
Merge branch 'raytracing-skinning-mapped' into raytracing
Gistix Feb 5, 2026
a8cceda
barrierCount renamed to numBarriers
Gistix Feb 5, 2026
3f2a37d
Merge remote-tracking branch 'jiaye/raytracing-hair' into raytracing
Gistix Feb 5, 2026
2689ea1
fix using float for irradiance
jiayev Feb 5, 2026
6926d7b
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
17dc9cd
Merge branch 'heads/jiaye/raytracing' into raytracing
Gistix Feb 5, 2026
740255f
Merge branch 'heads/jiaye/raytracing' into raytracing
Gistix Feb 5, 2026
b187532
removes bound radius from shape
Gistix Feb 5, 2026
bf04550
alpha fixes
Gistix Feb 5, 2026
9c8aa79
different ray offset
jiayev Feb 5, 2026
ff947d4
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
a3841d9
RaceMenu crash fix
Gistix Feb 5, 2026
d4694ac
alpha threshold to alpha scale fixed
Gistix Feb 5, 2026
1717c28
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
19e18ec
more possible mod crash fixes
Gistix Feb 5, 2026
24ed0dc
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 5, 2026
c2055f6
add farfield hair bcsdf
jiayev Feb 6, 2026
d4b6804
TES::Load3D renamed to TES::AttachModel
Gistix Feb 6, 2026
09cb7eb
dynamic trishapes update
Gistix Feb 6, 2026
9578b3f
minor style fix
Gistix Feb 6, 2026
2f7334e
sky cubemap update
Gistix Feb 6, 2026
5335730
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 6, 2026
976781a
eye fix attempt + skinning cleanup
Gistix Feb 7, 2026
18f0373
hair fixes
jiayev Feb 7, 2026
5ef71c0
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 7, 2026
0e200ba
Merge remote-tracking branch 'upstream/dev' into dev
Gistix Feb 7, 2026
bcd64fd
Merge branch 'dev' into raytracing
Gistix Feb 7, 2026
e89f58d
Update CommonLibSSE-NG
Gistix Feb 7, 2026
8a92148
adds active constraints
Gistix Feb 7, 2026
5fdec69
adds createactormodel method
Gistix Feb 8, 2026
09b06c1
fix linear lighting shared feature data
Gistix Feb 8, 2026
ac96377
add sanity check for shared feature data
Gistix Feb 8, 2026
9ed4a33
fix linear lighting shared feature data
Gistix Feb 8, 2026
054b566
add sanity check for shared feature data
Gistix Feb 8, 2026
0c587c1
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 8, 2026
067ad44
fix extended translucency shared feature bufer
Gistix Feb 8, 2026
39f9ed5
fix alpha
Gistix Feb 8, 2026
fdb3f1f
shared feature buffer adjustments
Gistix Feb 8, 2026
5c121f5
Merge branch 'raytracing-createactormodel' into raytracing
Gistix Feb 8, 2026
7128ea8
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 9, 2026
c232d6a
switch default hair
jiayev Feb 9, 2026
e586845
warning fix
Gistix Feb 9, 2026
5eef7bb
cleanup
Gistix Feb 9, 2026
68b2fa1
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 9, 2026
3d24c52
fix min light logic
jiayev Feb 9, 2026
b9f047b
fix farfield and offset
jiayev Feb 9, 2026
72c6139
adds SSSSettings struct
Gistix Feb 9, 2026
9d77e51
fix resource naming
Gistix Feb 9, 2026
2e06f91
adds throw when naming fails
Gistix Feb 9, 2026
ecffcd4
i really need it
jiayev Feb 9, 2026
88051b1
post-move naming fix
Gistix Feb 9, 2026
bf1b609
Merge remote-tracking branch 'jiaye/raytracing' into raytracing
Gistix Feb 9, 2026
e041fb1
hides debug visualization behind options
Gistix Feb 9, 2026
6740ef2
alpha check logic simplified
Gistix Feb 9, 2026
b28ca2d
sss settings layout change
Gistix Feb 9, 2026
18d83ae
missing skin fixes
Gistix Feb 9, 2026
3a927a0
fixes global illumination mode, improved vanilla to pbr conversion
Gistix Feb 10, 2026
469c6e1
adds rt define check to Lighting.hlsl
Gistix Feb 10, 2026
b3a22f2
restores specular for GI
Gistix Feb 10, 2026
8baf34e
fixes for gi mode
Gistix Feb 10, 2026
4064487
adds vanilla to pbr conversion to Lighting.hlsl
Gistix Feb 10, 2026
cb1f83e
improves vanilla to pbr conversion
Gistix Feb 10, 2026
ed9904b
rt shared data adjustments
Gistix Feb 10, 2026
eef1cd3
Merge remote-tracking branch 'origin/raytracing-nrd' into raytracing
Gistix Feb 10, 2026
451ad14
adds nrd extern submodule
Gistix Feb 10, 2026
a01b083
header fixes
Gistix Feb 10, 2026
b1ff344
.gitmodules update
Gistix Feb 10, 2026
4d6a9ac
nrd progress
Gistix Feb 10, 2026
0e39044
fix vanilla emit
jiayev Feb 10, 2026
b444bd3
shader fixes and revert
jiayev Feb 10, 2026
3e4483d
nrd related fixes
Gistix Feb 11, 2026
182edee
Merge remote-tracking branch 'jiaye/raytracing' into raytracing
Gistix Feb 11, 2026
7b81344
Merge branch 'raytracing' of https://github.com/Gistix/skyrim-communi…
jiayev Feb 11, 2026
b6d27c8
smol crash fix
jiayev Feb 14, 2026
110f094
better mis
jiayev Feb 14, 2026
5905d28
gpt fix instance management, adding more locks
jiayev Feb 15, 2026
f5f32a0
set sky hemisphere to 16bit
jiayev Feb 15, 2026
8c041a7
really fix sss light sampling (shadow ray cast after)
jiayev Feb 17, 2026
a077daf
fix alpha
jiayev Feb 18, 2026
fc0a83e
add texturedim lod
jiayev Feb 18, 2026
4fba262
fix emissive logic
jiayev Feb 19, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "extern/FidelityFX-SDK"]
path = extern/FidelityFX-SDK
url = https://github.com/MapleHinata/FidelityFX-SDK
[submodule "extern/NRD"]
path = extern/NRD
url = https://github.com/NVIDIA-RTX/NRD.git
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,18 @@ find_package(unordered_dense CONFIG REQUIRED)
find_package(efsw CONFIG REQUIRED)
find_package(Tracy CONFIG REQUIRED)
find_package(directx-headers CONFIG REQUIRED)
find_package(directx-dxc CONFIG REQUIRED)
find_package(D3D12MemoryAllocator CONFIG REQUIRED)
add_subdirectory(${CMAKE_SOURCE_DIR}/cmake/Streamline)

set(NRD_USE_DX12 ON CACHE BOOL "" FORCE)
set(NRD_STATIC_LIBRARY ON CACHE BOOL "" FORCE)

set(NRD_EMBEDS_SPIRV_SHADERS OFF CACHE BOOL "" FORCE)
set(NRD_EMBEDS_DXBC_SHADERS OFF CACHE BOOL "" FORCE)

add_subdirectory(extern/NRD)

find_path(DETOURS_INCLUDE_DIRS "detours/detours.h")
find_library(DETOURS_LIBRARY detours REQUIRED)
include(FidelityFX-SDK)
Expand Down Expand Up @@ -104,6 +114,7 @@ target_include_directories(
${CLIB_UTIL_INCLUDE_DIRS}
"${CMAKE_SOURCE_DIR}/package/Shaders"
${DETOURS_INCLUDE_DIRS}
"extern/NRD/Include"
)

target_link_libraries(
Expand All @@ -124,6 +135,9 @@ target_link_libraries(
Streamline
d3d12.lib
Microsoft::DirectX-Headers
Microsoft::DirectXShaderCompiler
GPUOpen::D3D12MemoryAllocator
NRD
${DETOURS_LIBRARY}
)

Expand Down
1 change: 1 addition & 0 deletions extern/NRD
Submodule NRD added at b705fd
2 changes: 2 additions & 0 deletions features/Raytracing/Shaders/Features/Raytracing.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Info]
Version = 1-0-0
43 changes: 43 additions & 0 deletions features/Raytracing/Shaders/Raytracing/CompositeCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "Common/Color.hlsli"

Texture2D<float4> MainInputTexture : register(t0);
Texture2D<float4> DiffuseAlbedoTexture : register(t1);
Texture2D<float4> DiffuseGITexture : register(t2);
Texture2D<float4> SpecularGITexture : register(t3);

RWTexture2D<float4> MainOutputTexture : register(u0);

cbuffer AccumulationCB : register(b2)
{
uint AccumulatedFrames;
float3 _padding;
}

[numthreads(8, 8, 1)]
void main(uint2 id : SV_DispatchThreadID)
{
#if defined(ACCUMULATION)
float3 previousAccumulated = MainInputTexture[id].rgb;
float3 currentPathTraced = DiffuseAlbedoTexture[id].rgb;

float3 outputColor = lerp(previousAccumulated, currentPathTraced, 1.0 / (AccumulatedFrames + 1));
#elif defined(COMPOSITE)
float3 outputColor = Color::GammaToTrueLinear(MainInputTexture[id].rgb);

# if defined(DIFFUSE)
outputColor += DiffuseAlbedoTexture[id].rgb * DiffuseGITexture[id].rgb;
# endif // DIFFUSE

# if defined(SPECULAR)
outputColor += SpecularGITexture[id].rgb;
# endif // SPECULAR
#else
float3 outputColor = DiffuseGITexture[id].rgb;
#endif // COMPOSITE

#if defined(GAMMA_OUTPUT)
outputColor = Color::TrueLinearToGamma(outputColor);
#endif // GAMMA_OUTPUT

MainOutputTexture[id] = float4(outputColor, 1.0f);
}
54 changes: 54 additions & 0 deletions features/Raytracing/Shaders/Raytracing/ConvertTexturesCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "Raytracing/Includes/Common.hlsli"
#include "Common/FrameBuffer.hlsli"
#include "Common/GBuffer.hlsli"
#include "Common/Color.hlsli"

Texture2D<unorm half4> NormalGlossiness : register(t0);
Texture2D<unorm half4> Albedo : register(t1);
Texture2D<unorm half4> GNMAO : register(t2);
Texture2D<half2> MotionVectors : register(t3);

RWTexture2D<snorm half4> NormalRoughness : register(u0);
RWTexture2D<half4> Diffuse : register(u1);
RWTexture2D<half2> MotionVectorsOut : register(u2);

cbuffer RenderResCB : register(b0)
{
uint2 RenderRes;
float2 RenderResRcp;
};

SamplerState Sampler : register(s0);

[numthreads(8, 8, 1)]
void main(uint2 id : SV_DispatchThreadID)
{
if (any(id >= RenderRes))
return;

const float2 uv = float2(id.xy + 0.5f) * RenderResRcp;
#ifndef PT
const unorm half3 normalGlossiness = NormalGlossiness.SampleLevel(Sampler, uv, 0).xyz;
const snorm half3 normalWS = normalize(ViewToWorldVector(GBuffer::DecodeNormal(normalGlossiness.xy), FrameBuffer::CameraViewInverse[0]));
NormalRoughness[id] = half4(normalWS, 1.0f - normalGlossiness.z);

const float4 albedo = Albedo.SampleLevel(Sampler, uv, 0);
const float metallic = GNMAO.SampleLevel(Sampler, uv, 0).z;
Diffuse[id] = float4(Color::GammaToTrueLinear(albedo.rgb) * (1.0f - metallic), albedo.a);
#endif
MotionVectorsOut[id] = MotionVectors.SampleLevel(Sampler, uv, 0);
}

[numthreads(8, 8, 1)]
void main2(uint2 id : SV_DispatchThreadID)
{
const unorm half3 normalGlossiness = NormalGlossiness[id].xyz;
const snorm half3 normalWS = normalize(ViewToWorldVector(GBuffer::DecodeNormal(normalGlossiness.xy), FrameBuffer::CameraViewInverse[0]));
NormalRoughness[id] = half4(normalWS, 1.0f - normalGlossiness.z);

float metallic, ao;
UnpackMAO(GNMAO[id].z, metallic, ao);
Diffuse[id] = Albedo[id] * (1.0f - metallic);

MotionVectorsOut[id] = MotionVectors[id];
}
Comment on lines +42 to +54

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing bounds check in main2 could cause out-of-bounds writes.

The main2 entry point lacks the bounds check present in main (lines 26-27). If the compute dispatch size exceeds the texture dimensions, this will result in out-of-bounds writes to the output textures.

🔎 Add bounds check consistent with main
 [numthreads(8, 8, 1)]
 void main2(uint2 id : SV_DispatchThreadID)
 {
+    if (any(id >= RenderRes))
+        return;
+
     const unorm half3 normalGlossiness = NormalGlossiness[id].xyz;
🤖 Prompt for AI Agents
In features/Raytracing/Shaders/Raytracing/ConvertTexturesCS.hlsl around lines 44
to 56, the main2 entry point is missing the bounds check present in main (around
lines 26-27), which can allow out-of-bounds texture writes when dispatch >
texture size; add the same early-return bounds check at the top of main2
(compare SV_DispatchThreadID.x/y against the target texture/dispatch dimensions
used in main and return if outside) so threads outside the valid pixel rectangle
do nothing, matching the existing main implementation.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "ConvertTexturesCS.hlsl" -type f

Repository: doodlum/skyrim-community-shaders

Length of output: 139


🏁 Script executed:

# Search for references to main2 as a shader entry point in C++ files
rg -n "main2" --type cpp --type h -C 3

Repository: doodlum/skyrim-community-shaders

Length of output: 224


🏁 Script executed:

# Search for references to ConvertTexturesCS in C++ files
rg -n "ConvertTexturesCS" --type cpp --type h -C 3

Repository: doodlum/skyrim-community-shaders

Length of output: 224


🏁 Script executed:

cat -n ./features/Raytracing/Shaders/Raytracing/ConvertTexturesCS.hlsl

Repository: doodlum/skyrim-community-shaders

Length of output: 2467


🏁 Script executed:

# Search for main2 without type filters
rg -n "main2" -C 3

Repository: doodlum/skyrim-community-shaders

Length of output: 809


🏁 Script executed:

# Search for ConvertTexturesCS without type filters
rg -n "ConvertTexturesCS" -C 3

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

# Search more broadly for any reference to main2 entry point
rg -i "main2|entry.*point" -C 2

Repository: doodlum/skyrim-community-shaders

Length of output: 520


🏁 Script executed:

# Check for any shader compilation or dispatch patterns
rg -n "Dispatch|compute.*shader|entry" --type toml --type json --type yaml -C 2

Repository: doodlum/skyrim-community-shaders

Length of output: 224


Remove the unused main2 entry point.

The file contains two compute shader entry points: main (lines 24-42, which is correct) and main2 (lines 45-56, which is incorrect and unused). The main2 entry point:

  • Uses direct indexing instead of filtered sampling
  • Lacks the bounds check present in main
  • Missing color space conversion (Color::GammaToTrueLinear) that main correctly applies on line 39

Since main2 is not referenced anywhere in the codebase, it should be removed entirely rather than maintained as dead code or fixed.

🤖 Prompt for AI Agents
In features/Raytracing/Shaders/Raytracing/ConvertTexturesCS.hlsl around lines 44
to 56, the unused compute shader entry point main2 should be removed: delete the
entire main2 function (the [numthreads...] declaration and its body) so only the
correct main entry point remains; ensure no remaining references to main2 exist
and that the file retains the bounds checks, filtered sampling, and
Color::GammaToTrueLinear usage present in the original main.

22 changes: 22 additions & 0 deletions features/Raytracing/Shaders/Raytracing/CopyDepthCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "Common/SharedData.hlsli"
#include "Raytracing/Includes/Common.hlsli"

Texture2D<unorm float> DepthIn : register(t0);
RWTexture2D<float> DepthOut : register(u0);
RWTexture2D<float2> DepthViewOut : register(u1);

[numthreads(8, 8, 1)]
void main(uint2 id : SV_DispatchThreadID)
{
uint width, height;
DepthIn.GetDimensions(width, height);

if (id.x >= width || id.y >= height)
return;

const float depthScreen = DepthIn[id];
DepthOut[id] = depthScreen;

float depthLinear = ScreenToViewDepth(depthScreen, SharedData::CameraData);
DepthViewOut[id] = float2(depthLinear, 0.0f);
}
31 changes: 31 additions & 0 deletions features/Raytracing/Shaders/Raytracing/CubeToHemiCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
TextureCube<float4> CubeMap : register(t0);
TextureCube<float> OcclusionMap : register(t1);

SamplerState Sampler : register(s0);

RWTexture2D<float4> HemisphereOut : register(u0);

[numthreads(8, 8, 1)]
void main(uint2 id : SV_DispatchThreadID)
{

if (id.x >= RESOLUTION || id.y >= RESOLUTION)
return;

const float2 uv = float2(id.xy + 0.5f) / float2(RESOLUTION, RESOLUTION);
const float2 xy = uv * 2.0f - 1.0f;

const float r = length(xy);

const float phi = atan2(xy.y, xy.x);

const float z = 1.0f - r*r;
const float k = sqrt(1.0f - z*z);

const float3 dir = float3(k * cos(phi), k * sin(phi), z);

const float3 color = CubeMap.SampleLevel(Sampler, dir, 0.0f).rgb;
const float occlusion = OcclusionMap.SampleLevel(Sampler, dir, 0.0f).r;

HemisphereOut[id.xy] = float4(color, occlusion);
}
162 changes: 162 additions & 0 deletions features/Raytracing/Shaders/Raytracing/Denoiser/NRD/Shared.hlsli
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
// © 2022 NVIDIA Corporation

//=============================================================================================
// SETTINGS
//=============================================================================================

// Fused or separate denoising selection
// 0 - DIFFUSE and SPECULAR
// 1 - DIFFUSE_SPECULAR
#define NRD_COMBINED 1

// NORMAL - common (non specialized) denoisers
// SH - SH (spherical harmonics or spherical gaussian) denoisers
// OCCLUSION - OCCLUSION (ambient or specular occlusion only) denoisers
// DIRECTIONAL_OCCLUSION - DIRECTIONAL_OCCLUSION (ambient occlusion in SH mode) denoisers
#define NRD_MODE NORMAL // NRD sample recompilation required
#define SIGMA_TRANSLUCENCY 0

// Default = 1
#define USE_IMPORTANCE_SAMPLING 1
#define USE_SHARC_DITHERING 1.5 // radius in voxels
#define USE_TRANSLUCENCY 1 // translucent foliage
#define USE_MOVING_EMISSION_FIX 1 // fixes a dark tail, left by an animated emissive object

// Default = 0
#define USE_SANITIZATION 0 // NRD sample is NAN/INF free
#define USE_SIMULATED_MATERIAL_ID_TEST 0 // "material ID" debugging
#define USE_SIMULATED_FIREFLY_TEST 0 // "anti-firefly" debugging
#define USE_CAMERA_ATTACHED_REFLECTION_TEST 0 // test special treatment for reflections of objects attached to the camera
#define USE_RUSSIAN_ROULETTE 0 // bad practice for real-time denoising
#define USE_DRS_STRESS_TEST 0 // NRD must not touch GARBAGE data outside of DRS rectangle
#define USE_INF_STRESS_TEST 0 // NRD must not touch GARBAGE data outside of denoising range
#define USE_ANOTHER_COBALT 0 // another cobalt variant
#define USE_PUDDLES 0 // add puddles
#define USE_RANDOMIZED_ROUGHNESS 0 // randomize roughness ( a common case in games )
#define USE_STOCHASTIC_SAMPLING 0 // needed?
#define USE_LOAD 0 // Load vs SampleLevel
#define USE_SHARC_DEBUG 0 // 1 - show cache, 2 - show grid (NRD sample recompile required)
#define USE_TAA_DEBUG 0 // 1 - show weight
#define USE_BIAS_FIX 0 // fixes negligible hair and specular bias

//=============================================================================================
// CONSTANTS
//=============================================================================================

// NRD variant
#define NORMAL 0
#define SH 1 // NORMAL + SH (SG) resolve
#define OCCLUSION 2
#define DIRECTIONAL_OCCLUSION 3 // diffuse OCCLUSION + SH (SG) resolve

// Denoiser
#define DENOISER_REBLUR 0
#define DENOISER_RELAX 1
#define DENOISER_REFERENCE 2

// Resolution
#define RESOLUTION_FULL 0
#define RESOLUTION_FULL_PROBABILISTIC 1
#define RESOLUTION_HALF 2

// What is on screen?
#define SHOW_FINAL 0
#define SHOW_DENOISED_DIFFUSE 1
#define SHOW_DENOISED_SPECULAR 2
#define SHOW_AMBIENT_OCCLUSION 3
#define SHOW_SPECULAR_OCCLUSION 4
#define SHOW_SHADOW 5
#define SHOW_BASE_COLOR 6
#define SHOW_NORMAL 7
#define SHOW_ROUGHNESS 8
#define SHOW_METALNESS 9
#define SHOW_MATERIAL_ID 10
#define SHOW_PSR_THROUGHPUT 11
#define SHOW_WORLD_UNITS 12
#define SHOW_INSTANCE_INDEX 13
#define SHOW_UV 14
#define SHOW_CURVATURE 15
#define SHOW_MIP_PRIMARY 16
#define SHOW_MIP_SPECULAR 17

// Predefined material override
#define MATERIAL_GYPSUM 1
#define MATERIAL_COBALT 2

// Material ID
#define MATERIAL_ID_DEFAULT 0.0f
#define MATERIAL_ID_METAL 1.0f
#define MATERIAL_ID_HAIR 2.0f
#define MATERIAL_ID_SELF_REFLECTION 3.0f

// Mip mode
#define MIP_VISIBILITY 0 // for visibility: emission, shadow and alpha mask
#define MIP_LESS_SHARP 1 // for normal
#define MIP_SHARP 2 // for albedo and roughness

// Register spaces ( sets )
#define SET_OTHER 0
#define SET_RAY_TRACING 1
#define SET_SHARC 2
#define SET_MORPH 3
#define SET_ROOT 4

// Path tracing
#define PT_THROUGHPUT_THRESHOLD 0.001
#define PT_IMPORTANCE_SAMPLES_NUM 16
#define PT_SPEC_LOBE_ENERGY 0.95 // trimmed to 95%
#define PT_SHADOW_RAY_OFFSET 1.0 // pixels
#define PT_BOUNCE_RAY_OFFSET 0.25 // pixels
#define PT_GLASS_RAY_OFFSET 0.05 // pixels
#define PT_MAX_FIREFLY_RELATIVE_INTENSITY 20.0 // no more than 20x energy increase in case of probabilistic sampling
#define PT_EVIL_TWIN_LOBE_TOLERANCE 0.005 // normalized %
#define PT_GLASS_MIN_F 0.05 // adds a bit of stability and bias
#define PT_DELTA_BOUNCES_NUM 8
#define PT_PSR_BOUNCES_NUM 2
#define PT_RAY_FLAGS 0

// Spatial HAsh-based Radiance Cache ( SHARC )
#define SHARC_CAPACITY ( 1 << 22 )
#define SHARC_SCENE_SCALE 45.0
#define SHARC_DOWNSCALE 5
#define SHARC_ANTI_FIREFLY false
#define SHARC_STALE_FRAME_NUM_MIN 32 // new version uses 8 by default, old value offers more stability in voxels with low number of samples ( critical for glass )
#define SHARC_SEPARATE_EMISSIVE 1
#define SHARC_MATERIAL_DEMODULATION 1
#define SHARC_USE_FP16 0

// Blue noise
#define BLUE_NOISE_SPATIAL_DIM 128 // see StaticTexture::ScramblingRanking
#define BLUE_NOISE_TEMPORAL_DIM 4 // good values: 4-8 for shadows, 8-16 for occlusion, 8-32 for lighting

// Other
#define FP16_MAX 65504.0
#define INF 1e5
#define LINEAR_BLOCK_SIZE 256
#define FP16_VIEWZ_SCALE 0.125 // TODO: tuned for meters, needs to be scaled down for cm and mm
#define MAX_MIP_LEVEL 11.0
#define LEAF_TRANSLUCENCY 0.25
#define LEAF_THICKNESS 0.001 // TODO: viewZ dependent?
#define STRAND_THICKNESS 80e-6f
#define TAA_HISTORY_SHARPNESS 0.66 // sharper ( was 0.5 )
#define TAA_SIGMA_SCALE 2.0 // allow nano ghosting ( was 1.0 ) // TODO: can negatively affect moving shadows
#define GARBAGE sqrt( -1.0 ) // sqrt( -1.0 ) or -log( 0.0 ) or 32768.0

#define MORPH_MAX_ACTIVE_TARGETS_NUM 8u
#define MORPH_ELEMENTS_PER_ROW_NUM 4
#define MORPH_ROWS_NUM ( MORPH_MAX_ACTIVE_TARGETS_NUM / MORPH_ELEMENTS_PER_ROW_NUM )

// Instance flags
#define FLAG_FIRST_BIT 24 // this + number of flags must be <= 32
#define NON_FLAG_MASK ( ( 1 << FLAG_FIRST_BIT ) - 1 )

#define FLAG_NON_TRANSPARENT 0x01 // geometry flag: non-transparent
#define FLAG_TRANSPARENT 0x02 // geometry flag: transparent
#define FLAG_FORCED_EMISSION 0x04 // animated emissive cube
#define FLAG_STATIC 0x08 // no velocity
#define FLAG_HAIR 0x10 // hair
#define FLAG_LEAF 0x20 // leaf
#define FLAG_SKIN 0x40 // skin
#define FLAG_MORPH 0x80 // morph

#define GEOMETRY_ALL ( FLAG_NON_TRANSPARENT | FLAG_TRANSPARENT )
Loading
Loading