Skip to content

Commit f5ef3ca

Browse files
committed
feat(crimsondesert): Further improvements to aurora with more palettes, randomisation and chance based night gating, Updated EffectDistortion no-op, Added Sky scattering brightness reduction
1 parent 4a93854 commit f5ef3ca

11 files changed

Lines changed: 456 additions & 195 deletions

src/games/crimsondesert/addon.cpp

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ const std::unordered_map<std::string, float> VANILLA_VALUES = {
163163
{"SnowFogFix", 0.f},
164164
{"RaytracingQuality", 0.f},
165165
{"AuroraBorealis", 0.f},
166+
{"AuroraBrightness", 50.f},
167+
{"AuroraChance", 40.f},
168+
{"NightSkyAttenuation", 0.f},
166169
};
167170

168171
const std::unordered_map<std::string, float> NEUTRAL_VALUES = {
@@ -1023,7 +1026,22 @@ renodx::utils::settings::Settings settings = {
10231026
.can_reset = true,
10241027
.label = "Dawn/Dusk Improvements (WIP)",
10251028
.section = "Rendering",
1026-
.tooltip = "Directionality additions to atmospheric lighting at dawn and dusk.\n",
1029+
.tooltip = "Directionality additions to atmospheric lighting at dawn/dusk.\n",
1030+
.labels = {"Off", "On"},
1031+
.tint = rendering,
1032+
.is_visible = []() { return current_settings_mode == rendering_group; },
1033+
},
1034+
new renodx::utils::settings::Setting{
1035+
.key = "NightSkyAttenuation",
1036+
.binding = &shader_injection.custom_flags,
1037+
.value_type = renodx::utils::settings::SettingValueType::INTEGER,
1038+
.default_value = 1.f,
1039+
.packed_values = {0u, CUSTOM_FLAGS__NIGHT_SKY_ATTENUATION},
1040+
.can_reset = true,
1041+
.label = "Darker Nights + Darker Dawn/Dusk Scattering (WIP)",
1042+
.section = "Rendering",
1043+
.tooltip = "Reduces sky brightness at night and during dawn/dusk.\n"
1044+
"Fixes the overly bright sky at 3-5am and after sunset.",
10271045
.labels = {"Off", "On"},
10281046
.tint = rendering,
10291047
.is_visible = []() { return current_settings_mode == rendering_group; },
@@ -1129,7 +1147,7 @@ renodx::utils::settings::Settings settings = {
11291147
},
11301148
new renodx::utils::settings::Setting{
11311149
.value_type = renodx::utils::settings::SettingValueType::TEXT,
1132-
.label = "WARNING: Added Aurora for nights with various colour palettes, looks cool but currently lacks region specific gating or randomised chance to not appear.\n",
1150+
.label = "Aurora now has randomisation for various parts, however lack per region data\n",
11331151
.section = "Rendering",
11341152
//.tint = rendering,
11351153
.is_visible = []() { return current_settings_mode == rendering_group; },
@@ -1150,6 +1168,31 @@ renodx::utils::settings::Settings settings = {
11501168
.is_enabled = []() { return RR_ENABLED; },
11511169
.is_visible = []() { return current_settings_mode == rendering_group; },
11521170
},
1171+
new renodx::utils::settings::Setting{
1172+
.key = "AuroraBrightness",
1173+
.binding = &shader_injection.aurora_brightness,
1174+
.default_value = 25.f,
1175+
.label = "Aurora Brightness",
1176+
.section = "Rendering",
1177+
.tooltip = "Controls the overall brightness of the aurora borealis effect.",
1178+
.tint = wiprendering,
1179+
.max = 100.f,
1180+
.is_enabled = []() { return RR_ENABLED && (CUSTOM_FLAGS_AS_UINT & CUSTOM_FLAGS__AURORA_BOREALIS) != 0u; },
1181+
.is_visible = []() { return current_settings_mode == rendering_group; },
1182+
},
1183+
new renodx::utils::settings::Setting{
1184+
.key = "AuroraChance",
1185+
.binding = &shader_injection.aurora_chance,
1186+
.default_value = 40.f,
1187+
.label = "Aurora Appearance Chance",
1188+
.section = "Rendering",
1189+
.tooltip = "Percentage chance for the aurora to appear each night.\n"
1190+
"0 = never appears, 100 = always appears.",
1191+
.tint = wiprendering,
1192+
.max = 100.f,
1193+
.is_enabled = []() { return RR_ENABLED && (CUSTOM_FLAGS_AS_UINT & CUSTOM_FLAGS__AURORA_BOREALIS) != 0u; },
1194+
.is_visible = []() { return current_settings_mode == rendering_group; },
1195+
},
11531196
new renodx::utils::settings::Setting{
11541197
.key = "ShadowDebugMode",
11551198
.binding = SHADOW_DEBUG_MODE,
@@ -1347,6 +1390,9 @@ void OnPresetOff() {
13471390
{"SnowFogFix", 0.f},
13481391
{"DisableAWB", 0.f},
13491392
{"AuroraBorealis", 0.f},
1393+
{"AuroraBrightness", 50.f},
1394+
{"AuroraChance", 40.f},
1395+
{"NightSkyAttenuation", 0.f},
13501396

13511397
{"ImprovedAutoExposure", 0.f},
13521398
{"AE_PerceptualMinBrightness", 0.f},

src/games/crimsondesert/shared.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define CUSTOM_FLAGS__TONEMAP_DEBUG_BIT1 0b0100000000000000000u
2727
#define CUSTOM_FLAGS__RR_ENABLED 0b1000000000000000000u
2828
#define CUSTOM_FLAGS__AURORA_BOREALIS 0b10000000000000000000u
29+
#define CUSTOM_FLAGS__NIGHT_SKY_ATTENUATION 0b100000000000000000000u
2930

3031
#define CUSTOM_FLAGS shader_injection.custom_flags
3132

@@ -100,7 +101,10 @@
100101
#define DAWN_DUSK_IMPROVEMENTS ((CUSTOM_FLAGS_AS_UINT & CUSTOM_FLAGS__DAWN_DUSK_IMPROVEMENTS) != 0u ? 1.f : 0.f)
101102
#define SNOW_FOG_FIX ((CUSTOM_FLAGS_AS_UINT & CUSTOM_FLAGS__SNOW_FOG_FIX) != 0u ? 1.f : 0.f)
102103
#define DAWN_DUSK_GI_ENERGY 0.7f
103-
#define AURORA_GI_ENERGY 0.1f
104+
#define AURORA_GI_ENERGY 1.0f
105+
#define AURORA_BRIGHTNESS shader_injection.aurora_brightness
106+
#define AURORA_CHANCE shader_injection.aurora_chance
107+
#define NIGHT_SKY_ATTENUATION ((CUSTOM_FLAGS_AS_UINT & CUSTOM_FLAGS__NIGHT_SKY_ATTENUATION) != 0u ? 1.f : 0.f)
104108

105109
// Auto exposure tuning
106110
//#define AE_DARK_POWER_OUTDOOR shader_injection.ae_dark_power_outdoor
@@ -181,6 +185,8 @@ struct ShaderInjectData {
181185
float moon_disk_size;
182186
float lens_flare_strength;
183187
float bloom_strength;
188+
float aurora_brightness;
189+
float aurora_chance;
184190
};
185191

186192
#ifndef __cplusplus

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,15 @@ void main(
17051705
_4275 *= _energyAtten;
17061706
}
17071707

1708+
// [NIGHT_SKY_ATTENUATION] Reduce sky brightness when sun is below horizon
1709+
// Works for both early morning and late evening
1710+
{
1711+
float _nightSkyAtten = NightSkyAttenuation(_sunDirection.y);
1712+
_4273 *= _nightSkyAtten;
1713+
_4274 *= _nightSkyAtten;
1714+
_4275 *= _nightSkyAtten;
1715+
}
1716+
17081717
__3__38__0__1__g_texSkyInscatterUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4273, _4274, _4275, 0.0f);
17091718
__3__38__0__1__g_texSkyExtinctionUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4256, _4257, _4258, 1.0f);
17101719
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,14 @@ void main(
22722272
_5084 *= _inscatterBias.x;
22732273
_5085 *= _inscatterBias.y;
22742274
_5086 *= _inscatterBias.z;
2275+
2276+
// [NIGHT_SKY_ATTENUATION] Reduce sky brightness when sun is below horizon
2277+
{
2278+
float _nightSkyAtten = NightSkyAttenuation(_sunDirection.y);
2279+
_5084 *= _nightSkyAtten;
2280+
_5085 *= _nightSkyAtten;
2281+
_5086 *= _nightSkyAtten;
2282+
}
22752283

22762284
__3__38__0__1__g_texSkyInscatterUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_5084, _5085, _5086, _61.x);
22772285
__3__38__0__1__g_texSkyExtinctionUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_5081, _5082, _5083, 0.0f);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ void main(
12411241
if (AURORA_BOREALIS_ENABLED) {
12421242
float nightGate = ComputeNightGate(_sunDirection.y);
12431243
float3 aurora = ComputeAurora(
1244-
float3(_133, _134, _135), _time.w, _frameNumber.x,
1244+
float3(_133, _134, _135), _time.w, _time.x, _frameNumber.x,
12451245
uint2(_52, _54)
12461246
);
12471247
aurora *= nightGate * _801;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void main(
247247
if (AURORA_BOREALIS_ENABLED) {
248248
float nightGate = ComputeNightGate(_sunDirection.y);
249249
float3 aurora = ComputeAurora(
250-
float3(_111, _112, _113), _time.w, _frameNumber.x,
250+
float3(_111, _112, _113), _time.w, _time.x, _frameNumber.x,
251251
uint2(SV_DispatchThreadID.x, SV_DispatchThreadID.y)
252252
);
253253
float transmittance = ChapmanTransmittance(0.f, _113, _rayleighScaledHeight, _earthRadius);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,14 @@ void main(
19391939
}
19401940
}
19411941

1942+
// [NIGHT_SKY_ATTENUATION] Reduce sky brightness when sun is below horizon
1943+
{
1944+
float _nightSkyAtten = NightSkyAttenuation(_sunDirection.y);
1945+
_4347 *= _nightSkyAtten;
1946+
_4348 *= _nightSkyAtten;
1947+
_4349 *= _nightSkyAtten;
1948+
}
1949+
19421950
__3__38__0__1__g_texSkyInscatterUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4347, _4348, _4349, _61.x);
19431951
__3__38__0__1__g_texSkyExtinctionUAV[int2((int)(SV_DispatchThreadID.x), (int)(SV_DispatchThreadID.y))] = float4(_4344, _4345, _4346, 0.0f);
19441952
}

0 commit comments

Comments
 (0)