Skip to content

Commit c258f63

Browse files
SGTForgeryOopyDoopy
authored andcommitted
feat(crimsondesert): Reduced energy modulation for GI during dawn/dusk, added red text to explain WIP RT SPMIS is broken
1 parent d7c274d commit c258f63

7 files changed

Lines changed: 54 additions & 4 deletions

src/games/crimsondesert/addon.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,13 @@ renodx::utils::settings::Settings settings = {
10341034
.section = "WIP Rendering",
10351035
//.tint = rendering,
10361036
.is_visible = []() { return current_settings_mode >= 1.f; },
1037+
},
1038+
new renodx::utils::settings::Setting{
1039+
.value_type = renodx::utils::settings::SettingValueType::TEXT,
1040+
.label = "WARNING: PATCH 1.02.00 HAS REDUCED GI QUALITY TO HALF RES AND ALSO DID OTHER CHANGES, SPMIS LOOKS SIGNIFICANTLY WORSE IN EXTERIORS, ONLY USE FOR INTERIOR SCREENSHOTS WITH REDUCED AUTO EXPOSURE\n",
1041+
.section = "Rendering",
1042+
.tint = 0xaa0000,
1043+
.is_visible = []() { return current_settings_mode >= 1.f; },
10371044
},
10381045
new renodx::utils::settings::Setting{
10391046
.key = "RaytracingQuality",

src/games/crimsondesert/rt/EvaluateDiffuseRadiance_0x28104287.cs_6_6.hlsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,15 @@ void main(
24482448
float _4100 = min((max(0.009999999776482582f, _exposure3.w) * 2048.0f), _4099);
24492449
float _4104 = max(9.999999717180685e-10f, _4099);
24502450
float _4112 = __3__36__0__0__g_raytracingDiffuseRayInversePDF.Load(int3(((int)(((uint)(((int)((uint)(_64) << 4)) & 1048560)) + SV_GroupThreadID.x)), ((int)(((uint)(((uint)((uint)(_64)) >> 16) << 4)) + SV_GroupThreadID.y)), 0));
2451-
float _4114 = _4112.x * 2.0f;
2451+
// [GI_ENERGY_CONSERVATION] Dawn/dusk inverse PDF energy correction
2452+
// vanilla is 2x for whatever reason dunno why. Lowering it slightly
2453+
// for dawn/dusk helps
2454+
float _energyCorrection = 1.0f;
2455+
if (DAWN_DUSK_IMPROVEMENTS == 1.f) {
2456+
float _ddFactor = DawnDuskFactor(_sunDirection.y);
2457+
_energyCorrection = lerp(1.0f, 0.5f, _ddFactor);
2458+
}
2459+
float _4114 = _4112.x * 2.0f * _energyCorrection;
24522460
float _4115 = _4114 * (((_4100 * _4092) / _4104) + (_renderParams2.y * _4068));
24532461
float _4116 = _4114 * (((_4100 * _4093) / _4104) + (_renderParams2.y * _4069));
24542462
float _4117 = _4114 * (((_4100 * _4094) / _4104) + (_renderParams2.y * _4070));

src/games/crimsondesert/rt/EvaluateDiffuseRadiance_0xEDC48671.cs_6_6.hlsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2456,7 +2456,15 @@ void main(
24562456
float _4103 = min((max(0.009999999776482582f, _exposure3.w) * 2048.0f), _4102);
24572457
float _4107 = max(9.999999717180685e-10f, _4102);
24582458
float _4115 = __3__36__0__0__g_raytracingDiffuseRayInversePDF.Load(int3(((int)((((uint)(((int)((uint)(_72) << 5)) & 2097120)) + SV_GroupThreadID.x) + ((uint)((_53 - (_54 << 1)) << 4)))), ((int)((((uint)(_54 << 4)) + SV_GroupThreadID.y) + ((uint)(((uint)((uint)(_72)) >> 16) << 5)))), 0));
2459-
float _4117 = _4115.x * 2.0f;
2459+
// [GI_ENERGY_CONSERVATION] Dawn/dusk inverse PDF energy correction
2460+
// vanilla is 2x for whatever reason dunno why. Lowering it slightly
2461+
// for dawn/dusk helps
2462+
float _energyCorrection = 1.0f;
2463+
if (DAWN_DUSK_IMPROVEMENTS == 1.f) {
2464+
float _ddFactor = DawnDuskFactor(_sunDirection.y);
2465+
_energyCorrection = lerp(1.0f, 0.5f, _ddFactor);
2466+
}
2467+
float _4117 = _4115.x * 2.0f * _energyCorrection;
24602468
float _4118 = _4117 * (((_4103 * _4095) / _4107) + (_renderParams2.y * _4071));
24612469
float _4119 = _4117 * (((_4103 * _4096) / _4107) + (_renderParams2.y * _4072));
24622470
float _4120 = _4117 * (((_4103 * _4097) / _4107) + (_renderParams2.y * _4073));

src/games/crimsondesert/rt/EvaluateDiffuseRadiance_0xF75E217A.cs_6_6.hlsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,15 @@ void main(
23262326
float _4096 = min((max(0.009999999776482582f, _exposure3.w) * 2048.0f), _4095);
23272327
float _4100 = max(9.999999717180685e-10f, _4095);
23282328
float _4108 = __3__36__0__0__g_raytracingDiffuseRayInversePDF.Load(int3(((int)(((uint)(((int)((uint)(_64) << 4)) & 1048560)) + SV_GroupThreadID.x)), ((int)(((uint)(((uint)((uint)(_64)) >> 16) << 4)) + SV_GroupThreadID.y)), 0));
2329-
float _4110 = _4108.x * 2.0f;
2329+
// [GI_ENERGY_CONSERVATION] Dawn/dusk inverse PDF energy correction
2330+
// vanilla is 2x for whatever reason dunno why. Lowering it slightly
2331+
// for dawn/dusk helps
2332+
float _energyCorrection = 1.0f;
2333+
if (DAWN_DUSK_IMPROVEMENTS == 1.f) {
2334+
float _ddFactor = DawnDuskFactor(_sunDirection.y);
2335+
_energyCorrection = lerp(1.0f, 0.5f, _ddFactor);
2336+
}
2337+
float _4110 = _4108.x * 2.0f * _energyCorrection;
23302338
float _4111 = _4110 * (((_4096 * _4088) / _4100) + (_renderParams2.y * _4064));
23312339
float _4112 = _4110 * (((_4096 * _4089) / _4100) + (_renderParams2.y * _4065));
23322340
float _4113 = _4110 * (((_4096 * _4090) / _4100) + (_renderParams2.y * _4066));

src/games/crimsondesert/rt/EvaluateDiffuseRadiance_0xF882ACCB.cs_6_6.hlsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,15 @@ void main(
23342334
float _4099 = min((max(0.009999999776482582f, _exposure3.w) * 2048.0f), _4098);
23352335
float _4103 = max(9.999999717180685e-10f, _4098);
23362336
float _4111 = __3__36__0__0__g_raytracingDiffuseRayInversePDF.Load(int3(((int)((((uint)(((int)((uint)(_72) << 5)) & 2097120)) + SV_GroupThreadID.x) + ((uint)((_53 - (_54 << 1)) << 4)))), ((int)((((uint)(_54 << 4)) + SV_GroupThreadID.y) + ((uint)(((uint)((uint)(_72)) >> 16) << 5)))), 0));
2337-
float _4113 = _4111.x * 2.0f;
2337+
// [GI_ENERGY_CONSERVATION] Dawn/dusk inverse PDF energy correction
2338+
// vanilla is 2x for whatever reason dunno why. Lowering it slightly
2339+
// for dawn/dusk helps
2340+
float _energyCorrection = 1.0f;
2341+
if (DAWN_DUSK_IMPROVEMENTS == 1.f) {
2342+
float _ddFactor = DawnDuskFactor(_sunDirection.y);
2343+
_energyCorrection = lerp(1.0f, 0.5f, _ddFactor);
2344+
}
2345+
float _4113 = _4111.x * 2.0f * _energyCorrection;
23382346
float _4114 = _4113 * (((_4099 * _4091) / _4103) + (_renderParams2.y * _4067));
23392347
float _4115 = _4113 * (((_4099 * _4092) / _4103) + (_renderParams2.y * _4068));
23402348
float _4116 = _4113 * (((_4099 * _4093) / _4103) + (_renderParams2.y * _4069));

src/games/crimsondesert/shared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#define CUSTOM_VIGNETTE shader_injection.custom_vignette
6060
#define LENS_FLARE_STRENGTH shader_injection.lens_flare_strength
6161
#define BLOOM_STRENGTH shader_injection.bloom_strength
62+
#define DAWN_DUSK_GI_ENERGY 0.6f
6263

6364
#define SHADOW_DEBUG_MODE 0 // shader_injection.shadow_debug_mode
6465
#define SHADOW_DISABLE_LAYER 0 // shader_injection.shadow_disable_layer

src/games/crimsondesert/sky-atmospheric/RenderAtmosphericScatteringOffscreenSky_0x139B0E4B.cs_6_6.hlsl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,16 @@ void main(
16951695
}
16961696
}
16971697

1698+
// [DAWN_DUSK_SKY_PROBE_ENERGY] Inscatter Energy Reduction
1699+
// scale down omnidirectional inscatter during dawn/dusk to prevent
1700+
// Probe from boosting GI with directionless energy
1701+
if (DAWN_DUSK_IMPROVEMENTS == 1.f && DAWN_DUSK_GI_ENERGY < 1.f) {
1702+
float _energyAtten = lerp(1.f, DAWN_DUSK_GI_ENERGY, _dawnDuskFactor);
1703+
_4273 *= _energyAtten;
1704+
_4274 *= _energyAtten;
1705+
_4275 *= _energyAtten;
1706+
}
1707+
16981708
__3__38__0__1__g_texSkyInscatterUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4273, _4274, _4275, 0.0f);
16991709
__3__38__0__1__g_texSkyExtinctionUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4256, _4257, _4258, 1.0f);
17001710
}

0 commit comments

Comments
 (0)