From ba69c24357869bdf42e1ae3f53db79c17ed5b190 Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Thu, 15 Jan 2026 21:08:52 -0800 Subject: [PATCH 01/12] feat(grasslighting): add wrapped lighting toggle toggles the use of a wrapped lighting model on grass from an older version of CS. Prevents certain grass mods from being too dark when sunlight is directly overhead. --- package/Shaders/Common/SharedData.hlsli | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/Shaders/Common/SharedData.hlsli b/package/Shaders/Common/SharedData.hlsli index e92797356d..6b9a2378ec 100644 --- a/package/Shaders/Common/SharedData.hlsli +++ b/package/Shaders/Common/SharedData.hlsli @@ -33,7 +33,8 @@ namespace SharedData bool OverrideComplexGrassSettings; float BasicGrassBrightness; - float3 pad0; + bool EnableWrappedLighting; + float2 pad0; }; struct CPMSettings @@ -306,4 +307,4 @@ namespace SharedData #endif // PSHADER } -#endif // __SHARED_DATA_DEPENDENCY_HLSL__ \ No newline at end of file +#endif // __SHARED_DATA_DEPENDENCY_HLSL__ From e5e7ace59a9121d9067d6355f3ce9e3671e4e983 Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:11:01 -0800 Subject: [PATCH 02/12] Add toggle to GrassLighting.cpp Add toggle checkbox under lighting tree section of grass lighting UI --- src/Features/GrassLighting.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Features/GrassLighting.cpp b/src/Features/GrassLighting.cpp index 3ad5bcb470..6fbe27ae9b 100644 --- a/src/Features/GrassLighting.cpp +++ b/src/Features/GrassLighting.cpp @@ -6,7 +6,8 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( SpecularStrength, SubsurfaceScatteringAmount, OverrideComplexGrassSettings, - BasicGrassBrightness) + BasicGrassBrightness, + EnableWrappedLighting) void GrassLighting::DrawSettings() { @@ -43,6 +44,12 @@ void GrassLighting::DrawSettings() } if (ImGui::TreeNodeEx("Lighting", ImGuiTreeNodeFlags_DefaultOpen)) { + ImGui::Checkbox("Enable Wrapped Lighting", (bool*)&settings.EnableWrappedLighting); + if (auto _tt = Util::HoverTooltipWrapper()) { + ImGui::Text("Old wrapped lighting model from CS 1.3."); + } + ImGui::Spacing(); + ImGui::Spacing(); ImGui::Checkbox("Override Complex Grass Lighting Settings", (bool*)&settings.OverrideComplexGrassSettings); if (auto _tt = Util::HoverTooltipWrapper()) { ImGui::Text( @@ -77,4 +84,4 @@ void GrassLighting::SaveSettings(json& o_json) void GrassLighting::RestoreDefaultSettings() { settings = {}; -} \ No newline at end of file +} From a6f4d6632a0d599ae0380ac230c2e234a0894e89 Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:11:56 -0800 Subject: [PATCH 03/12] Add uint to GrassLighting.h default value is disabled --- src/Features/GrassLighting.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Features/GrassLighting.h b/src/Features/GrassLighting.h index 461703b531..4c9272429a 100644 --- a/src/Features/GrassLighting.h +++ b/src/Features/GrassLighting.h @@ -35,7 +35,8 @@ struct GrassLighting : Feature float SubsurfaceScatteringAmount = 0.5f; uint OverrideComplexGrassSettings = false; float BasicGrassBrightness = 1.0f; - uint pad[3]; + uint EnableWrappedLighting = false; + uint pad[2]; }; STATIC_ASSERT_ALIGNAS_16(Settings); From 3af50fcad24f001449c30c0619041b919ca708c5 Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:15:42 -0800 Subject: [PATCH 04/12] Add old wrapped light function into RunGrass.hlsl adds toggleable wrapped light function if setting is enabled --- package/Shaders/RunGrass.hlsl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index f216361199..3ade797dad 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,7 +629,18 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); + if (SharedData::grassLightingSettings.EnableWrappedLighting) + { + // Old Wrapped Model + float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * !complex;; + float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); + lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * dirDetailShadow; + } + else + { + // Original Standard Model + lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); + } float3 vertexColor = input.VertexColor.xyz; From babdd75f98093a442a9e76f790ac3ae9a617c9a1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 06:21:59 +0000 Subject: [PATCH 05/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- package/Shaders/RunGrass.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 3ade797dad..8a218b0dba 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,14 +629,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * !complex;; float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * dirDetailShadow; } - else + else { // Original Standard Model lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); From 77f1a83d09bd247962e29bb9f47793378004000c Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:35:54 -0800 Subject: [PATCH 06/12] Update RunGrass.hlsl Listened to rabbit, replaced dirdetailshadow with grassdiffusemultiplier on line 637, farther away grass looks better now. --- package/Shaders/RunGrass.hlsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 8a218b0dba..97f1a1495b 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,14 +629,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model - float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * !complex;; + float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); - lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * dirDetailShadow; + lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * Color::GrassDiffuseMult(); } - else + else { // Original Standard Model lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); @@ -644,7 +644,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) float3 vertexColor = input.VertexColor.xyz; -# if defined(SKYLIGHTING) +#if defined(SKYLIGHTING) float skylightingFadeOutFactor = 1.0; if (!SharedData::InInterior) { skylightingFadeOutFactor = Skylighting::getFadeOutFactor(input.WorldPosition.xyz); From 78d4610f43bd332d90bfb92805ba0978b9cb7270 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 21:36:20 +0000 Subject: [PATCH 07/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- package/Shaders/RunGrass.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 97f1a1495b..1d62b1e520 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,14 +629,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * Color::GrassDiffuseMult(); } - else + else { // Original Standard Model lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); From ad41926e30a082d4867b1be32e6222d22b56ffab Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:08:18 -0800 Subject: [PATCH 08/12] Update GrassLighting.cpp update tootltip description explanation --- src/Features/GrassLighting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/GrassLighting.cpp b/src/Features/GrassLighting.cpp index 6fbe27ae9b..79e77015a6 100644 --- a/src/Features/GrassLighting.cpp +++ b/src/Features/GrassLighting.cpp @@ -46,7 +46,7 @@ void GrassLighting::DrawSettings() if (ImGui::TreeNodeEx("Lighting", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Checkbox("Enable Wrapped Lighting", (bool*)&settings.EnableWrappedLighting); if (auto _tt = Util::HoverTooltipWrapper()) { - ImGui::Text("Old wrapped lighting model from CS 1.3."); + ImGui::Text("Enables a softer-looking wrapped lighting model from CS 1.3. Useful for certain non-complex grass textures that look too dark during mid day, when the sun is directly overhead."); } ImGui::Spacing(); ImGui::Spacing(); From 77d5b48043044a3922117571371dd5374dbf8064 Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Sun, 18 Jan 2026 11:43:33 -0800 Subject: [PATCH 09/12] Update RunGrass.hlsl add wrapped model to point lights when enabled --- package/Shaders/RunGrass.hlsl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 1d62b1e520..eba4264858 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,14 +629,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * Color::GrassDiffuseMult(); } - else + else { // Original Standard Model lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); @@ -715,8 +715,18 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) float lightAngle = dot(normal, normalizedLightDirection); float lightNoL = dot(normalizedLightDirection.xyz, viewDirection); + float3 lightDiffuseColor; - float3 lightDiffuseColor = lightColor * saturate(lightAngle); + if (SharedData::grassLightingSettings.EnableWrappedLighting) + { + float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); + float wrappedLight = saturate(lightAngle + wrapAmount) / (1.0 + wrapAmount); + lightDiffuseColor = lightColor * wrappedLight; + } + else + { + lightDiffuseColor = lightColor * saturate(lightAngle); + } sss += lightColor * saturate(-lightAngle); @@ -724,7 +734,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) if (complex) lightsSpecularColor += GrassLighting::GetLightSpecularInput(normalizedLightDirection, viewDirection, normal, lightColor, SharedData::grassLightingSettings.Glossiness) * Color::GrassSpecularMult(); -# endif +#endif } } } From 9cf0456777864cb34e597caa8cf323bb54a9cd69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 18 Jan 2026 19:45:13 +0000 Subject: [PATCH 10/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- package/Shaders/RunGrass.hlsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index eba4264858..5f15eb1d67 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -629,14 +629,14 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * Color::GrassDiffuseMult(); } - else + else { // Original Standard Model lightsDiffuseColor += dirLightColor * saturate(dirLightAngle) * Color::GrassDiffuseMult(); @@ -717,13 +717,13 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) float lightNoL = dot(normalizedLightDirection.xyz, viewDirection); float3 lightDiffuseColor; - if (SharedData::grassLightingSettings.EnableWrappedLighting) + if (SharedData::grassLightingSettings.EnableWrappedLighting) { float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedLight = saturate(lightAngle + wrapAmount) / (1.0 + wrapAmount); lightDiffuseColor = lightColor * wrappedLight; } - else + else { lightDiffuseColor = lightColor * saturate(lightAngle); } From ea89eb1d540fcbcbc35b4e2f97e2b16b82c45fcc Mon Sep 17 00:00:00 2001 From: BigBullmoose <65634364+BigBullmoose@users.noreply.github.com> Date: Sun, 18 Jan 2026 15:16:29 -0800 Subject: [PATCH 11/12] Update RunGrass.hlsl remove duplicate wrapamount float, moved first wrapamount float outside of the "if" function so it could be read further down --- package/Shaders/RunGrass.hlsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 5f15eb1d67..4b0b020335 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -628,11 +628,12 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirLightColorMultiplier; dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - + + float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model - float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedDirLight = saturate(dirLightAngle + wrapAmount) / (1.0 + wrapAmount); lightsDiffuseColor += dirLightColor * saturate(wrappedDirLight) * Color::GrassDiffuseMult(); } @@ -719,7 +720,6 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) if (SharedData::grassLightingSettings.EnableWrappedLighting) { - float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); float wrappedLight = saturate(lightAngle + wrapAmount) / (1.0 + wrapAmount); lightDiffuseColor = lightColor * wrappedLight; } From 5e60f120a3ed5dcd7b577a52f45a9483479bb794 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 18 Jan 2026 23:16:57 +0000 Subject: [PATCH 12/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commi?= =?UTF-8?q?t.ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- package/Shaders/RunGrass.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Shaders/RunGrass.hlsl b/package/Shaders/RunGrass.hlsl index 4b0b020335..731bc61591 100644 --- a/package/Shaders/RunGrass.hlsl +++ b/package/Shaders/RunGrass.hlsl @@ -628,9 +628,9 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) dirLightColor *= dirLightColorMultiplier; dirLightColor *= dirShadow; dirLightColor *= dirDetailShadow; - + float wrapAmount = saturate(input.VertexNormal.w * 10.0)* 0.5 * (!complex); - + if (SharedData::grassLightingSettings.EnableWrappedLighting) { // Old Wrapped Model