fix(hair): marschner volumetric shadow tint#1944
Conversation
|
No actionable suggestions for changed features. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughRefactors hair shader direct-lighting to pass a Changes
Sequence Diagram(s)(Skipped — changes are internal shader refactors and test additions that do not introduce multi-component runtime flows requiring diagramming.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@features/Hair` Specular/Shaders/Hair/Hair.hlsli:
- Around line 224-225: Remove the now-unused local variables lightColor and
selfShadow in Hair.hlsli: delete the declarations "float3 lightColor =
context.lightColor;" and "float selfShadow = context.hairShadow *
context.softShadow;" in the function where they appear since both values are
computed inside the sub-functions from the context parameter; ensure no other
code in that scope references lightColor or selfShadow before committing.
|
✅ A pre-release build is available for this PR: |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
features/Hair Specular/Shaders/Hair/Hair.hlsli (1)
301-301: PR metadata follow-up: tighten title and add issue linkage.Consider shortening the PR title to stay within 50 chars (e.g.,
fix(hair): fix marschner volumetric shadow tint) and add an issue keyword in the PR body (Fixes #...) if applicable.As per coding guidelines: "Length: 50 characters limit for title" and "Suggest adding appropriate GitHub keywords: 'Fixes
#123'/'Closes#123' for bug fixes."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@features/Hair` Specular/Shaders/Hair/Hair.hlsli at line 301, Update the PR metadata: shorten the PR title to <=50 characters (example: "fix(hair): fix marschner volumetric shadow tint") and add an issue linkage keyword in the PR body like "Fixes #<issue-number>" or "Closes #<issue-number>"; this change is requested for the review anchored on features/Hair Specular/Shaders/Hair/Hair.hlsli around the __HAIR_DEPENDENCY_HLSL__ block—ensure the updated title and PR body follow the repository guidelines for length and GitHub keywords.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@features/Hair` Specular/Shaders/Hair/Hair.hlsli:
- Line 301: Update the PR metadata: shorten the PR title to <=50 characters
(example: "fix(hair): fix marschner volumetric shadow tint") and add an issue
linkage keyword in the PR body like "Fixes #<issue-number>" or "Closes
#<issue-number>"; this change is requested for the review anchored on
features/Hair Specular/Shaders/Hair/Hair.hlsli around the
__HAIR_DEPENDENCY_HLSL__ block—ensure the updated title and PR body follow the
repository guidelines for length and GitHub keywords.
alandtse
left a comment
There was a problem hiding this comment.
I think we should really generate some hlsl test cases so these sigs don't get changed later and randomly break stuff.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
features/Hair Specular/Shaders/Hair/Hair.hlsli (1)
224-228: PR metadata tweak: shorten title and add bug-link keyword.Suggested title:
fix(hair): correct volumetric shadow tint
Also consider addingFixes #<issue-id>(orCloses #<issue-id>) in the PR description for traceability.As per coding guidelines "Conventional Commit Titles ... Length: 50 characters limit for title" and "Issue References ... 'Fixes
#123' or 'Closes#123' for bug fixes".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@features/Hair` Specular/Shaders/Hair/Hair.hlsli around lines 224 - 228, Update the pull request title to follow Conventional Commit style (e.g., "fix(hair): correct volumetric shadow tint") and add an issue reference line in the PR description using "Fixes #<issue-id>" or "Closes #<issue-id>" for traceability; this is a metadata change only and does not touch code in Hair.hlsli (e.g., references to SharedData::hairSpecularSettings.HairMode and the GetHairDirectLightScheuermann/GetHairDirectLightMarschner calls remain unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@features/Hair` Specular/Shaders/Hair/Hair.hlsli:
- Around line 224-228: Update the pull request title to follow Conventional
Commit style (e.g., "fix(hair): correct volumetric shadow tint") and add an
issue reference line in the PR description using "Fixes #<issue-id>" or "Closes
#<issue-id>" for traceability; this is a metadata change only and does not touch
code in Hair.hlsli (e.g., references to
SharedData::hairSpecularSettings.HairMode and the
GetHairDirectLightScheuermann/GetHairDirectLightMarschner calls remain
unchanged).
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
✅ Created PR with unit tests: #1945 |
|
@jiayev see if the rabbit gave you anything usable. |
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
package/Shaders/Tests/TestHair.hlsl (1)
107-133: Consider adding tests for DirectContext-based functions.The
DirectContextstruct is stubbed but none of the test kernels exercise functions that consume it (e.g.,GetHairDirectLightScheuermann,GetHairDirectLightMarschner). Since the PR's main change refactors these functions to useDirectContext, adding integration-style tests that validate shadow tint behavior with the new context-based API would increase confidence in the fix.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Tests/TestHair.hlsl` around lines 107 - 133, Add integration tests that exercise the DirectContext-based lighting functions (e.g., GetHairDirectLightScheuermann and GetHairDirectLightMarschner) by constructing a DirectContext instance with varied lightDir, lightColor, viewDir, worldNormal, vertexNormal, and shadow parameters and passing it along with a MaterialProperties instance into the kernels; assert expected shadow tint/diffuse/specular changes (including cases for detailedShadow, softShadow, hairShadow) to validate the refactor to the DirectContext API and ensure shadow tint behavior matches previous behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package/Shaders/Tests/TestHair.hlsl`:
- Around line 194-197: Hair_g currently divides by B in both the exponent and
the denominator which can produce Inf/NaN when B == 0; update Hair_g to guard B
(the function parameter) by clamping or saturating it to a small positive
epsilon (e.g. max(B, 1e-6)) or assert that B > 0 before use, then use the
guarded value in the exponent and the sqrt(Math::TAU) * B denominator; reference
the Hair_g(float B, float Theta) function and Math::TAU constant when making the
change.
- Around line 9-91: The file defines a local Color namespace (symbols
PBRLightingCompensation and RGBToLuminance) that will conflict with the real
Color.hlsli included at the top; remove the local stubbed Color namespace (the
block declaring PBRLightingCompensation and RGBToLuminance) so the real include
provides those symbols, and if tests fail because the real header is unavailable
in the test environment instead delete the include and keep the stub—use the
presence of the Color namespace and functions (RGBToLuminance,
PBRLightingCompensation) to locate the code to modify.
- Around line 159-163: ReorientTangent currently normalizes V = T - N * dot(T,N)
which is zero when T is parallel to N; modify the ReorientTangent function to
guard against that by testing V's length (or |dot(T,N)| near 1) and returning a
stable orthonormal tangent when the projection is zero (for example compute any
vector perpendicular to N—using a world-up fallback or cross(N, some axis)—then
normalize that fallback); update the implementation to use this safe-fallback
path and add a unit test for the edge case where T is parallel to N to ensure no
NaNs are produced.
---
Nitpick comments:
In `@package/Shaders/Tests/TestHair.hlsl`:
- Around line 107-133: Add integration tests that exercise the
DirectContext-based lighting functions (e.g., GetHairDirectLightScheuermann and
GetHairDirectLightMarschner) by constructing a DirectContext instance with
varied lightDir, lightColor, viewDir, worldNormal, vertexNormal, and shadow
parameters and passing it along with a MaterialProperties instance into the
kernels; assert expected shadow tint/diffuse/specular changes (including cases
for detailedShadow, softShadow, hairShadow) to validate the refactor to the
DirectContext API and ensure shadow tint behavior matches previous behavior.
| #include "/Shaders/Common/Color.hlsli" | ||
| #include "/Shaders/Common/Math.hlsli" | ||
|
|
||
| // Stub SharedData hairSpecularSettings | ||
| namespace SharedData | ||
| { | ||
| struct HairSpecularSettings | ||
| { | ||
| uint Enabled; | ||
| float HairGlossiness; | ||
| float SpecularMult; | ||
| float DiffuseMult; | ||
| uint EnableTangentShift; | ||
| float PrimaryTangentShift; | ||
| float SecondaryTangentShift; | ||
| float HairSaturation; | ||
| float SpecularIndirectMult; | ||
| float DiffuseIndirectMult; | ||
| float BaseColorMult; | ||
| float Transmission; | ||
| uint EnableSelfShadow; | ||
| float SelfShadowStrength; | ||
| float SelfShadowExponent; | ||
| float SelfShadowScale; | ||
| uint HairMode; | ||
| uint3 pad; | ||
| }; | ||
|
|
||
| // Default test settings | ||
| static HairSpecularSettings hairSpecularSettings = { | ||
| 1, // Enabled | ||
| 0.5f, // HairGlossiness | ||
| 1.0f, // SpecularMult | ||
| 1.0f, // DiffuseMult | ||
| 0, // EnableTangentShift (disabled for simpler tests) | ||
| 0.0f, // PrimaryTangentShift | ||
| 0.5f, // SecondaryTangentShift | ||
| 1.0f, // HairSaturation | ||
| 1.0f, // SpecularIndirectMult | ||
| 1.0f, // DiffuseIndirectMult | ||
| 1.0f, // BaseColorMult | ||
| 0.5f, // Transmission | ||
| 0, // EnableSelfShadow (disabled) | ||
| 0.5f, // SelfShadowStrength | ||
| 2.0f, // SelfShadowExponent | ||
| 1.0f, // SelfShadowScale | ||
| 0, // HairMode (Scheuermann) | ||
| uint3(0, 0, 0) | ||
| }; | ||
| } | ||
|
|
||
| // Stub Game.hlsli constants | ||
| #define GAME_UNIT_TO_CM 1.428f | ||
|
|
||
| // Stub for BRDF.hlsli | ||
| namespace BRDF | ||
| { | ||
| float3 F_Schlick(float3 F0, float VdotH) | ||
| { | ||
| float Fc = pow(1 - VdotH, 5); | ||
| return F0 + (1 - F0) * Fc; | ||
| } | ||
|
|
||
| float2 EnvBRDF(float roughness, float NdotV) | ||
| { | ||
| // Simplified approximation | ||
| float a = roughness * roughness; | ||
| float x = 1 - NdotV; | ||
| float x2 = x * x; | ||
| return float2(saturate(1 - a + a * x2), saturate(x2 * 0.5)); | ||
| } | ||
| } | ||
|
|
||
| // Stub for Color.hlsli if needed | ||
| namespace Color | ||
| { | ||
| static const float PBRLightingCompensation = 1.0f; | ||
|
|
||
| float RGBToLuminance(float3 color) | ||
| { | ||
| return dot(color, float3(0.2126f, 0.7152f, 0.0722f)); | ||
| } | ||
| } |
There was a problem hiding this comment.
Potential namespace redefinition conflict.
Color.hlsli is included at line 9, but the Color namespace is also stubbed at lines 83-91 with RGBToLuminance and PBRLightingCompensation. If the real Color.hlsli already defines these symbols, this will cause a redefinition error. Consider either:
- Removing the include and fully stubbing the dependency, or
- Removing the stub and relying on the real include
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package/Shaders/Tests/TestHair.hlsl` around lines 9 - 91, The file defines a
local Color namespace (symbols PBRLightingCompensation and RGBToLuminance) that
will conflict with the real Color.hlsli included at the top; remove the local
stubbed Color namespace (the block declaring PBRLightingCompensation and
RGBToLuminance) so the real include provides those symbols, and if tests fail
because the real header is unavailable in the test environment instead delete
the include and keep the stub—use the presence of the Color namespace and
functions (RGBToLuminance, PBRLightingCompensation) to locate the code to
modify.
| float3 ReorientTangent(float3 T, float3 N) | ||
| { | ||
| float3 T_reoriented = normalize(T - N * dot(T, N)); | ||
| return T_reoriented; | ||
| } |
There was a problem hiding this comment.
Potential NaN when tangent is parallel to normal.
ReorientTangent normalizes T - N * dot(T, N). If T is parallel to N, this produces a zero vector, and normalize(float3(0,0,0)) returns NaN. Consider adding a guard or documenting this precondition. You may also want to add a test case covering this edge condition.
🛡️ Suggested guard
float3 ReorientTangent(float3 T, float3 N)
{
- float3 T_reoriented = normalize(T - N * dot(T, N));
+ float3 projected = T - N * dot(T, N);
+ float lenSq = dot(projected, projected);
+ float3 T_reoriented = lenSq > EPSILON_DIVISION ? projected * rsqrt(lenSq) : T;
return T_reoriented;
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package/Shaders/Tests/TestHair.hlsl` around lines 159 - 163, ReorientTangent
currently normalizes V = T - N * dot(T,N) which is zero when T is parallel to N;
modify the ReorientTangent function to guard against that by testing V's length
(or |dot(T,N)| near 1) and returning a stable orthonormal tangent when the
projection is zero (for example compute any vector perpendicular to N—using a
world-up fallback or cross(N, some axis)—then normalize that fallback); update
the implementation to use this safe-fallback path and add a unit test for the
edge case where T is parallel to N to ensure no NaNs are produced.
| float Hair_g(float B, float Theta) | ||
| { | ||
| return exp(-0.5 * Theta * Theta / (B * B)) / (sqrt(Math::TAU) * B); | ||
| } |
There was a problem hiding this comment.
Division by zero if B = 0.
Hair_g divides by B twice (in the exponent and denominator). If B approaches zero, this produces infinity or NaN. The edge case test uses B = 0.01f but doesn't test the zero boundary.
Consider adding a minimum clamp or documenting that B > 0 is a precondition:
🛡️ Suggested guard
float Hair_g(float B, float Theta)
{
+ B = max(B, EPSILON_DIVISION);
return exp(-0.5 * Theta * Theta / (B * B)) / (sqrt(Math::TAU) * B);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package/Shaders/Tests/TestHair.hlsl` around lines 194 - 197, Hair_g currently
divides by B in both the exponent and the denominator which can produce Inf/NaN
when B == 0; update Hair_g to guard B (the function parameter) by clamping or
saturating it to a small positive epsilon (e.g. max(B, 1e-6)) or assert that B >
0 before use, then use the guarded value in the exponent and the sqrt(Math::TAU)
* B denominator; reference the Hair_g(float B, float Theta) function and
Math::TAU constant when making the change.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
package/Shaders/Tests/TestHair.hlsl (2)
157-160:⚠️ Potential issue | 🟡 Minor
ReorientTangentstill needs a zero-length projection guard.Line 159 can hit a degenerate projection when
Tis parallel toN, which makes normalization unstable for this edge case.🔧 Suggested fix
float3 ReorientTangent(float3 T, float3 N) { - float3 T_reoriented = normalize(T - N * dot(T, N)); - return T_reoriented; + float3 projected = T - N * dot(T, N); + float lenSq = dot(projected, projected); + if (lenSq <= EPSILON_DIVISION) { + float3 axis = abs(N.z) < 0.999f ? float3(0, 0, 1) : float3(0, 1, 0); + return normalize(cross(axis, N)); + } + return projected * rsqrt(lenSq); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Tests/TestHair.hlsl` around lines 157 - 160, ReorientTangent can normalize a zero-length projection when T is parallel to N; modify ReorientTangent to compute the projected vector (T - N * dot(T,N)), test its length against a small epsilon, and if below epsilon return a stable fallback tangent (e.g., a normalized vector orthogonal to N computed by crossing N with a chosen basis axis) otherwise normalize and return the projection; reference the ReorientTangent function, variables T, N and the intermediate projected vector (T_reoriented) when applying this guard.
192-195:⚠️ Potential issue | 🟡 MinorGuard
Hair_gforB <= 0to avoid invalid math.Line 194 divides by
Btwice;B == 0(or near-zero) can produce non-finite output.🔧 Suggested fix
float Hair_g(float B, float Theta) { - return exp(-0.5 * Theta * Theta / (B * B)) / (sqrt(Math::TAU) * B); + float Bsafe = max(B, EPSILON_DIVISION); + return exp(-0.5 * Theta * Theta / (Bsafe * Bsafe)) / (sqrt(Math::TAU) * Bsafe); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Tests/TestHair.hlsl` around lines 192 - 195, The Hair_g function computes exp(-0.5 * Theta * Theta / (B * B)) / (sqrt(Math::TAU) * B) and currently divides by B (and B*B) without guarding against B <= 0; modify Hair_g to handle B <= 0 (or very small |B|) by either returning a safe default (e.g., 0.0) or clamping B to a small epsilon before the computation, ensuring you avoid division by zero and preserve numeric stability; update the function Hair_g to check B <= 0 (or fabs(B) < EPSILON) and take the chosen safe path before performing the existing formula.
🧹 Nitpick comments (2)
package/Shaders/Tests/TestHair.hlsl (2)
1-1: Consider adding a bug-tracker closing keyword in the PR description.If this fix maps to an issue, add
Fixes #<id>(orCloses #<id>) for traceability and auto-close behavior.As per coding guidelines, “Issue References (if PR fixes bugs or implements features): Suggest adding appropriate GitHub keywords: ‘Fixes
#123’ or ‘Closes#123’ for bug fixes.”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Tests/TestHair.hlsl` at line 1, Add a GitHub auto-close keyword to the PR description that references the related issue (e.g., "Fixes #<id>" or "Closes #<id>") so the PR will automatically close the tracked bug/feature; ensure the referenced issue ID is correct and the description mentions the scope (e.g., TestHair.hlsl / Hair.hlsli Hair Specular fix) for traceability.
149-149: Add targeted shader compilation validation for this new test shader.A focused compile check for this file would catch include/stub regressions early without running full shader validation.
Based on learnings: “Run targeted shader validation using hlslkit-compile during development with specific feature directories rather than full validation.”
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Tests/TestHair.hlsl` at line 149, Add a targeted shader compilation step for package/Shaders/Tests/TestHair.hlsl (the new TestHair shader that includes "/Test/STF/ShaderTestFramework.hlsli") so CI runs hlslkit-compile against just this file and its feature/stub include dirs; update the test script or CI job to invoke hlslkit-compile with the TestHair.hlsl path and the specific feature/include directories used by ShaderTestFramework.hlsli, fail the job on non-zero exit and surface stderr in the job logs to catch include/stub regressions early.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package/Shaders/Tests/TestHair.hlsl`:
- Around line 205-207: The computation of fakeN = normalize(V - N * NdotV) can
produce a zero vector when V is colinear with N, destabilizing wrappedNdotL;
change the code to compute the unnormalized tangent T = V - N * NdotV, test its
length (e.g. dot(T,T) or length(T)) against a small epsilon, and only normalize
when it is above the threshold; if it is below epsilon, pick a stable fallback
(for example use N or a safe orthonormal tangent) for fakeN before computing
wrappedNdotL to ensure no divide-by-zero or NaN propagation in the
saturate((dot(fakeN, L) + wrap) / ((1 + wrap) * (1 + wrap))) expression.
---
Duplicate comments:
In `@package/Shaders/Tests/TestHair.hlsl`:
- Around line 157-160: ReorientTangent can normalize a zero-length projection
when T is parallel to N; modify ReorientTangent to compute the projected vector
(T - N * dot(T,N)), test its length against a small epsilon, and if below
epsilon return a stable fallback tangent (e.g., a normalized vector orthogonal
to N computed by crossing N with a chosen basis axis) otherwise normalize and
return the projection; reference the ReorientTangent function, variables T, N
and the intermediate projected vector (T_reoriented) when applying this guard.
- Around line 192-195: The Hair_g function computes exp(-0.5 * Theta * Theta /
(B * B)) / (sqrt(Math::TAU) * B) and currently divides by B (and B*B) without
guarding against B <= 0; modify Hair_g to handle B <= 0 (or very small |B|) by
either returning a safe default (e.g., 0.0) or clamping B to a small epsilon
before the computation, ensuring you avoid division by zero and preserve numeric
stability; update the function Hair_g to check B <= 0 (or fabs(B) < EPSILON) and
take the chosen safe path before performing the existing formula.
---
Nitpick comments:
In `@package/Shaders/Tests/TestHair.hlsl`:
- Line 1: Add a GitHub auto-close keyword to the PR description that references
the related issue (e.g., "Fixes #<id>" or "Closes #<id>") so the PR will
automatically close the tracked bug/feature; ensure the referenced issue ID is
correct and the description mentions the scope (e.g., TestHair.hlsl / Hair.hlsli
Hair Specular fix) for traceability.
- Line 149: Add a targeted shader compilation step for
package/Shaders/Tests/TestHair.hlsl (the new TestHair shader that includes
"/Test/STF/ShaderTestFramework.hlsli") so CI runs hlslkit-compile against just
this file and its feature/stub include dirs; update the test script or CI job to
invoke hlslkit-compile with the TestHair.hlsl path and the specific
feature/include directories used by ShaderTestFramework.hlsli, fail the job on
non-zero exit and surface stderr in the job logs to catch include/stub
regressions early.
| float3 fakeN = normalize(V - N * NdotV); | ||
| const float wrap = 1; | ||
| float wrappedNdotL = saturate((dot(fakeN, L) + wrap) / ((1 + wrap) * (1 + wrap))); |
There was a problem hiding this comment.
Diffuse attenuation has an unguarded colinear V/N path.
Line 205 normalizes V - N * NdotV; when V is colinear with N (covered by your edge test), this vector is zero and can destabilize wrappedNdotL.
🔧 Suggested fix
- float3 fakeN = normalize(V - N * NdotV);
+ float3 vPerp = V - N * NdotV;
+ float invLen = rsqrt(max(dot(vPerp, vPerp), EPSILON_DIVISION));
+ float3 fakeN = vPerp * invLen;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| float3 fakeN = normalize(V - N * NdotV); | |
| const float wrap = 1; | |
| float wrappedNdotL = saturate((dot(fakeN, L) + wrap) / ((1 + wrap) * (1 + wrap))); | |
| float3 vPerp = V - N * NdotV; | |
| float invLen = rsqrt(max(dot(vPerp, vPerp), EPSILON_DIVISION)); | |
| float3 fakeN = vPerp * invLen; | |
| const float wrap = 1; | |
| float wrappedNdotL = saturate((dot(fakeN, L) + wrap) / ((1 + wrap) * (1 + wrap))); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package/Shaders/Tests/TestHair.hlsl` around lines 205 - 207, The computation
of fakeN = normalize(V - N * NdotV) can produce a zero vector when V is colinear
with N, destabilizing wrappedNdotL; change the code to compute the unnormalized
tangent T = V - N * NdotV, test its length (e.g. dot(T,T) or length(T)) against
a small epsilon, and only normalize when it is above the threshold; if it is
below epsilon, pick a stable fallback (for example use N or a safe orthonormal
tangent) for fakeN before computing wrappedNdotL to ensure no divide-by-zero or
NaN propagation in the saturate((dot(fakeN, L) + wrap) / ((1 + wrap) * (1 +
wrap))) expression.
…rove dependency stubs
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
* fix(weather overrides): ensure json format for features (community-shaders#1748) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * perf(terrain blending): tweak defaults (community-shaders#1771) * fix(lighting): vanilla envcolor mult the correct value (community-shaders#1775) * fix(water): remove final colour saturate (community-shaders#1778) * fix(unified-water): LOD water cache mismatch (community-shaders#1779) * fix(weather editor): override desync with weather transitions (community-shaders#1782) * fix(weather editor): no-override weather file deletion (community-shaders#1777) * fix(weather editor): apply weather settings post-load (community-shaders#1776) * fix(weather editor): handling of weathers without overrides (community-shaders#1773) * feat(UI): feature headings (community-shaders#1786) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(VR): add wand pointing (community-shaders#1790) * chore(UI): theme consistency (community-shaders#1787) * fix(upscaling): warn about max nvidia resolution (community-shaders#1795) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore(linear lighting): UI settings changes (community-shaders#1785) Co-authored-by: Jiaye <l936249247@hotmail.com> * fix(grass-lighting) better basic grass brightness default (community-shaders#1780) * chore(UI): remove settings and about tabs (community-shaders#1794) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(terrain shadows): fix compiler warnings (community-shaders#1798) * fix: fix flickering particles (community-shaders#1791) * fix(terrain blending): disable vr support (community-shaders#1799) * refactor(upscaling): standardize behavior and tune settings (community-shaders#1783) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(UI): add auto-hide featurelist option (community-shaders#1793) * fix: match grass brightness of vanilla (community-shaders#1801) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * refactor(perfoverlay): remove color from "Other" and "Total" (community-shaders#1806) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(unified water): fix for mesh water jitter (community-shaders#1809) * fix: clear shader cache on plugin version change (community-shaders#1739) * feat(filewatcher): add hlsli tracking (community-shaders#1796) * feat(linear lighting): add ambient multiplier (community-shaders#1805) * fix(unified-water): underwater fog flicker (community-shaders#1807) * fix(UI): conflicting esc key on welcome hotkey dialogue (community-shaders#1811) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(UI): add subtext font to tooltips (community-shaders#1810) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * build: bump streamline to 2.10.3 (community-shaders#1813) * build: resolve shader warnings (community-shaders#1818) * feat(ui): add combo hotkey support (community-shaders#1808) * feat: add feature constraints (community-shaders#1804) * build: update version to 1.4.8 (community-shaders#1802) * fix(VR): apply per eye upscaling (community-shaders#1819) - Split upscaling across each eye for correctness and to avoid DLSS failing over 8k x 8k limit - Changes HMD mask color to black to hide artifacts with fast movement * build: bump common lib to 4.2.0 (community-shaders#1821) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(grass collision): catch trashed actor pointers (community-shaders#1765) * fix(weather editor): desynced override transitions (community-shaders#1820) * fix(upscaling): fix preset and allocation handling (community-shaders#1824) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * build: remove linear lighting from core whilst in development (community-shaders#1826) * chore: bump version to 1.4.9 (community-shaders#1827) * fix: add back LLF core file and remove LL core file (community-shaders#1828) * fix: dont save shader debug toggles (community-shaders#1831) * fix: remove IBL from core, unfinished (community-shaders#1830) * chore: update version to 1.4.10 (community-shaders#1832) * chore(dynamic cubemaps): lessen normalisation darkening (community-shaders#1833) * chore(llf): remove LightsVisualisationMode settings loading (community-shaders#1834) * revert: "fix: dont save shader debug toggles (community-shaders#1831)" This reverts commit f55f195. * revert: "chore(llf): remove LightsVisualisationMode settings loading (community-shaders#1834)" This reverts commit b3db5a7. * fix: default enabledClasses true * build: bump version * feat(upscaling): custom DLSS preset (community-shaders#1837) * fix(weather editor): sync UI for full transition (community-shaders#1822) * fix(linearlighting): return correct buffer when ll feature off (community-shaders#1838) * fix(PBR): skip IrradianceToLinear on specular in vanilla (community-shaders#1839) * feat(weather editor): adjust slider ranges (community-shaders#1847) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): replace volumetric Lighting RGB sliders with color picker (community-shaders#1846) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * fix(grass collision): collision radius math (community-shaders#1849) * chore: move new feature information into docs (community-shaders#1848) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(ui): background blur with upscaling (community-shaders#1815) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * refactor: move some features to core (community-shaders#1852) * fix: fix blown out water specular (community-shaders#1853) * feat(weather editor): toggle hotkey (community-shaders#1856) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(color picker): add an original color reference to all color pickers (community-shaders#1857) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * perf(emat): alternate tweaks (community-shaders#1850) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather-editor): merge weather picker and editor (community-shaders#1845) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(llf): remove LLF settings loading (community-shaders#1859) * feat: exponential height fog (community-shaders#1708) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): block editor access in loading screens (community-shaders#1871) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): improve weather picker UI and functionality (community-shaders#1863) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): repurpose unsaved changes tracking (community-shaders#1860) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix: sync grass lighting defaults to match ENB (community-shaders#1844) * fix: stop shader compilation on game exit (community-shaders#1867) closes community-shaders#1130 * fix(weather editor): prevent inputs when editor is open (community-shaders#1872) * fix(weather editor): add ctd guards (community-shaders#1864) * feat(weather editor): remove WorldSpace widget and associated code (community-shaders#1878) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(vr): add OpenComposite menu support (community-shaders#1880) * revert: "feat(vr): add OpenComposite VR menu" (community-shaders#1881) * revert: "fix: stop shader compilation on game exit" (community-shaders#1882) * feat(vr): add OpenComposite menu support (community-shaders#1883) * feat(weather editor): add time controls (community-shaders#1877) * feat: add shadowmap rasterizer override (community-shaders#1690) * fix(weather editor): clear feature overrides with revert (community-shaders#1884) * feat(UI): Interior Only (community-shaders#1854) * fix(VR): fix Shadowmap Cascade Rasterizer (community-shaders#1888) * fix(unified water): distance calculation for raindrops & LOD fade (community-shaders#1890) * refactor: clarify core feature version mismatch text (community-shaders#1886) * fix: stop shader compilation on game exit (community-shaders#1885) * build: exclude hlsl tests from packaging (community-shaders#1894) * chore: disable feature constraints in dev mode (community-shaders#1893) * fix(vr): improve stereo UV handling (community-shaders#1899) * fix(weather editor): move esc key to native input system (community-shaders#1897) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * fix: move ResolveMonoUVForEye outside VR guard (community-shaders#1906) * fix(grass collision): validate actor (community-shaders#1905) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(terrain shadows): height map regression (community-shaders#1911) * fix: util vertical fov math (community-shaders#1904) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * test: add float4 overload test (community-shaders#1902) * refactor: move all features to globals::game::calendar (community-shaders#1909) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(UI): resolution based font (community-shaders#1907) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): make objects window be independently scrollable (community-shaders#1908) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(UI): consolidate searchbar to util and add to weather editor (community-shaders#1898) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): add filled star for favourites. (community-shaders#1913) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): add delete json button to objects window (community-shaders#1914) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(VR): resolution-based font (community-shaders#1923) * refactor: use depthbuffer helper (community-shaders#1925) * refactor: move TurboColormap into Color.hlsli (community-shaders#1924) * fix(weather editor): expand clickable area of feature override (community-shaders#1921) * feat(weather editor): enable snapping to viewport (community-shaders#1917) * feat(weather editor): highlight enabled cloud layers (community-shaders#1916) * fix(VR): SSGI discrepancies (community-shaders#1926) * feat: volumetric shadows (community-shaders#1874) * ci: enhance feature version audit (community-shaders#1927) * feat(weather editor): add filter options for objects window (community-shaders#1922) * feat(weather editor): sticky headers and scrollable content (community-shaders#1930) * fix(UI): ImGui scaling for borderless mode (community-shaders#1929) * ci: don't fail on feature audits (community-shaders#1934) * fix(pbr): use scrap heap allocation (community-shaders#1928) * chore(UI): add subsurface scattering to Interior Only (community-shaders#1932) * fix(weather editor): align highlights, fix tooltip (community-shaders#1918) * fix(ssgi): guard VR only compilation (community-shaders#1938) * build: update template to avoid extra directory (community-shaders#1812) * style: fix hlsl formatting (community-shaders#1939) * fix(UI): improve theme management UI flow (community-shaders#1933) closes community-shaders#1919 * build(deps): update pre-commit hooks (community-shaders#1768) * feat(UI): delete theme button (community-shaders#1940) * feat(UI): open log file button (community-shaders#1942) * fix(hair): marschner volumetric shadow tint (community-shaders#1944) * fix(VR): screen space shadows desync (community-shaders#1946) closes community-shaders#1840 * fix(VR): depth culling during upscaling/Terrain Blending (community-shaders#1858) * feat(VR): add edge detection for stereo blending (community-shaders#1948) * refactor: allocate trampoline once (community-shaders#1951) * fix(UI): PBR MATO color scale RGB settings corrected (community-shaders#1957) * fix(weather editor): guard against loadorder changes (community-shaders#1953) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: davo0411 <davidkehoe0411@outlook.com> * fix(UI): feature description text wrapping (community-shaders#1960) * fix(VR): exponential height fog stereo mismatch (community-shaders#1961) * chore: pbr consistency changes (community-shaders#1841) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: jiayev <l936249247@hotmail.com> * fix(skylighting): remove PBR lighting scale (community-shaders#1963) * fix(skysync): effect mesh blackout during shadow caster transitions (community-shaders#1965) * ci: fix wiki deletion with buffer update (community-shaders#1967) * feat(weather-editor): option to hide viewport (community-shaders#1970) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * test(shader): fallback to warp on invalidarg (community-shaders#1956) Co-authored-by: LukeFrankio <loren@example.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat: triplanar projected materials (community-shaders#1950) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(ao): better ao calculations (community-shaders#1968) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(pbr): fix improper kD terms (community-shaders#1971) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * perf(emat): tweak fade and shadow intensity (community-shaders#1892) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(ibl): revamp ibl and dalc sh (community-shaders#1947) * build: bump commonlib to 4.7.1 (community-shaders#1977) * fix: upscaling monitor detection fixes (community-shaders#1978) * fix(weather editor): prevent overrides resetting settings (community-shaders#1980) * fix(VR): bad llf offset (community-shaders#1984) * perf: cache frequent ui checks (community-shaders#1985) * fix: preserve vanilla water TAA when no upscaler is active (community-shaders#1986) Co-authored-by: jturnley <jturnley@users.noreply.github.com> * fix(UI): first-time dialog fade affects all overlays (community-shaders#1976) * fix(skysync): remove sunlight fade and volumetric lighting overrides (community-shaders#1966) * refactor(HLSL): standardize epsilon constants (community-shaders#1992) closes community-shaders#1227 * feat(UI): require Shift to dock windows (community-shaders#1989) * fix(UI): input spam after alt-tab (community-shaders#1993) * fix(sky sync): early return for invalid cells (community-shaders#1991) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: jiayev <l936249247@hotmail.com> * fix(sky sync): remove undeclared variable (community-shaders#1994) * refactor(pbr): clear up semantics (community-shaders#1995) * fix(UI): scale layout values for high-DPI (community-shaders#1987) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(water): hdr water taa blend (community-shaders#1988) * refactor(color): clarify gamma conversion functions (community-shaders#1996) * feat(ISL-editor): add light counters and fix filtering (community-shaders#1997) * fix(UI): DPI-aware window layouts (community-shaders#2000) * fix(weather-editor): save color palette window (community-shaders#2001) * refactor: centralize feature category names (community-shaders#2007) closes community-shaders#1265 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * chore: bump versions (community-shaders#2010) * fix(water): sample history mask from current mask (community-shaders#2011) * chore(wetness-effects): set default MaxPuddleWetness to 1.5 (community-shaders#1981) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather-editor): add free camera and play mode (community-shaders#2008) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * build: bump versions and reduce false positives (community-shaders#2013) * fix(VR): LLF cluster building and culling (community-shaders#2012) * build: update to VS 2026 (community-shaders#1990) * ci: fix preset in vs2022 mode (community-shaders#2015) * ci: remove v2022 from shader jobs (community-shaders#2016) * feat(upscaling): integrate Streamline Reflex controls (community-shaders#1958) * fix(unified-water): BSWaterShaderProperty.plane (community-shaders#1998) --------- Co-authored-by: Skrubby Skrub In A Shrub <87662196+SkrubbySkrubInAShrub@users.noreply.github.com> Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> Co-authored-by: jiayev <l936249247@hotmail.com> Co-authored-by: Dlizzio <77717521+Dlizzio@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alan Tse <alandtse@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Bruce <44987693+brucenguyen@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Dawntic <197450198+Dawntic@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Alan Tse <alandtse@gmail.com> Co-authored-by: Vanni Giachin <vanni.giachin@qlik.com> Co-authored-by: zxcvbn <66063766+zndxcvbn@users.noreply.github.com> Co-authored-by: ParticleTroned <248299730+ParticleTroned@users.noreply.github.com> Co-authored-by: soda <130315225+soda3000@users.noreply.github.com> Co-authored-by: YtzyFvra <59631290+YtzyFvra@users.noreply.github.com> Co-authored-by: LukeFrankio <lorenzogrutzmann@gmail.com> Co-authored-by: LukeFrankio <loren@example.com> Co-authored-by: jturnley <32892261+jturnley@users.noreply.github.com> Co-authored-by: jturnley <jturnley@users.noreply.github.com> Co-authored-by: Igor Alan Albuquerque de Sousa <50077829+IgorAlanAlbuquerque@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix(weather overrides): ensure json format for features (community-shaders#1748) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * perf(terrain blending): tweak defaults (community-shaders#1771) * fix(lighting): vanilla envcolor mult the correct value (community-shaders#1775) * fix(water): remove final colour saturate (community-shaders#1778) * fix(unified-water): LOD water cache mismatch (community-shaders#1779) * fix(weather editor): override desync with weather transitions (community-shaders#1782) * fix(weather editor): no-override weather file deletion (community-shaders#1777) * fix(weather editor): apply weather settings post-load (community-shaders#1776) * fix(weather editor): handling of weathers without overrides (community-shaders#1773) * feat(UI): feature headings (community-shaders#1786) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(VR): add wand pointing (community-shaders#1790) * chore(UI): theme consistency (community-shaders#1787) * fix(upscaling): warn about max nvidia resolution (community-shaders#1795) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore(linear lighting): UI settings changes (community-shaders#1785) Co-authored-by: Jiaye <l936249247@hotmail.com> * fix(grass-lighting) better basic grass brightness default (community-shaders#1780) * chore(UI): remove settings and about tabs (community-shaders#1794) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(terrain shadows): fix compiler warnings (community-shaders#1798) * fix: fix flickering particles (community-shaders#1791) * fix(terrain blending): disable vr support (community-shaders#1799) * refactor(upscaling): standardize behavior and tune settings (community-shaders#1783) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(UI): add auto-hide featurelist option (community-shaders#1793) * fix: match grass brightness of vanilla (community-shaders#1801) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * refactor(perfoverlay): remove color from "Other" and "Total" (community-shaders#1806) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(unified water): fix for mesh water jitter (community-shaders#1809) * fix: clear shader cache on plugin version change (community-shaders#1739) * feat(filewatcher): add hlsli tracking (community-shaders#1796) * feat(linear lighting): add ambient multiplier (community-shaders#1805) * fix(unified-water): underwater fog flicker (community-shaders#1807) * fix(UI): conflicting esc key on welcome hotkey dialogue (community-shaders#1811) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(UI): add subtext font to tooltips (community-shaders#1810) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * build: bump streamline to 2.10.3 (community-shaders#1813) * build: resolve shader warnings (community-shaders#1818) * feat(ui): add combo hotkey support (community-shaders#1808) * feat: add feature constraints (community-shaders#1804) * build: update version to 1.4.8 (community-shaders#1802) * fix(VR): apply per eye upscaling (community-shaders#1819) - Split upscaling across each eye for correctness and to avoid DLSS failing over 8k x 8k limit - Changes HMD mask color to black to hide artifacts with fast movement * build: bump common lib to 4.2.0 (community-shaders#1821) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(grass collision): catch trashed actor pointers (community-shaders#1765) * fix(weather editor): desynced override transitions (community-shaders#1820) * fix(upscaling): fix preset and allocation handling (community-shaders#1824) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * build: remove linear lighting from core whilst in development (community-shaders#1826) * chore: bump version to 1.4.9 (community-shaders#1827) * fix: add back LLF core file and remove LL core file (community-shaders#1828) * fix: dont save shader debug toggles (community-shaders#1831) * fix: remove IBL from core, unfinished (community-shaders#1830) * chore: update version to 1.4.10 (community-shaders#1832) * chore(dynamic cubemaps): lessen normalisation darkening (community-shaders#1833) * chore(llf): remove LightsVisualisationMode settings loading (community-shaders#1834) * revert: "fix: dont save shader debug toggles (community-shaders#1831)" This reverts commit f55f195. * revert: "chore(llf): remove LightsVisualisationMode settings loading (community-shaders#1834)" This reverts commit b3db5a7. * fix: default enabledClasses true * build: bump version * feat(upscaling): custom DLSS preset (community-shaders#1837) * fix(weather editor): sync UI for full transition (community-shaders#1822) * fix(linearlighting): return correct buffer when ll feature off (community-shaders#1838) * fix(PBR): skip IrradianceToLinear on specular in vanilla (community-shaders#1839) * feat(weather editor): adjust slider ranges (community-shaders#1847) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): replace volumetric Lighting RGB sliders with color picker (community-shaders#1846) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * fix(grass collision): collision radius math (community-shaders#1849) * chore: move new feature information into docs (community-shaders#1848) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(ui): background blur with upscaling (community-shaders#1815) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * refactor: move some features to core (community-shaders#1852) * fix: fix blown out water specular (community-shaders#1853) * feat(weather editor): toggle hotkey (community-shaders#1856) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(color picker): add an original color reference to all color pickers (community-shaders#1857) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * perf(emat): alternate tweaks (community-shaders#1850) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather-editor): merge weather picker and editor (community-shaders#1845) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * chore(llf): remove LLF settings loading (community-shaders#1859) * feat: exponential height fog (community-shaders#1708) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): block editor access in loading screens (community-shaders#1871) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): improve weather picker UI and functionality (community-shaders#1863) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): repurpose unsaved changes tracking (community-shaders#1860) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix: sync grass lighting defaults to match ENB (community-shaders#1844) * fix: stop shader compilation on game exit (community-shaders#1867) closes community-shaders#1130 * fix(weather editor): prevent inputs when editor is open (community-shaders#1872) * fix(weather editor): add ctd guards (community-shaders#1864) * feat(weather editor): remove WorldSpace widget and associated code (community-shaders#1878) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(vr): add OpenComposite menu support (community-shaders#1880) * revert: "feat(vr): add OpenComposite VR menu" (community-shaders#1881) * revert: "fix: stop shader compilation on game exit" (community-shaders#1882) * feat(vr): add OpenComposite menu support (community-shaders#1883) * feat(weather editor): add time controls (community-shaders#1877) * feat: add shadowmap rasterizer override (community-shaders#1690) * fix(weather editor): clear feature overrides with revert (community-shaders#1884) * feat(UI): Interior Only (community-shaders#1854) * fix(VR): fix Shadowmap Cascade Rasterizer (community-shaders#1888) * fix(unified water): distance calculation for raindrops & LOD fade (community-shaders#1890) * refactor: clarify core feature version mismatch text (community-shaders#1886) * fix: stop shader compilation on game exit (community-shaders#1885) * build: exclude hlsl tests from packaging (community-shaders#1894) * chore: disable feature constraints in dev mode (community-shaders#1893) * fix(vr): improve stereo UV handling (community-shaders#1899) * fix(weather editor): move esc key to native input system (community-shaders#1897) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * fix: move ResolveMonoUVForEye outside VR guard (community-shaders#1906) * fix(grass collision): validate actor (community-shaders#1905) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * fix(terrain shadows): height map regression (community-shaders#1911) * fix: util vertical fov math (community-shaders#1904) Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> * test: add float4 overload test (community-shaders#1902) * refactor: move all features to globals::game::calendar (community-shaders#1909) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(UI): resolution based font (community-shaders#1907) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): make objects window be independently scrollable (community-shaders#1908) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(UI): consolidate searchbar to util and add to weather editor (community-shaders#1898) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(weather editor): add filled star for favourites. (community-shaders#1913) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather editor): add delete json button to objects window (community-shaders#1914) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(VR): resolution-based font (community-shaders#1923) * refactor: use depthbuffer helper (community-shaders#1925) * refactor: move TurboColormap into Color.hlsli (community-shaders#1924) * fix(weather editor): expand clickable area of feature override (community-shaders#1921) * feat(weather editor): enable snapping to viewport (community-shaders#1917) * feat(weather editor): highlight enabled cloud layers (community-shaders#1916) * fix(VR): SSGI discrepancies (community-shaders#1926) * feat: volumetric shadows (community-shaders#1874) * ci: enhance feature version audit (community-shaders#1927) * feat(weather editor): add filter options for objects window (community-shaders#1922) * feat(weather editor): sticky headers and scrollable content (community-shaders#1930) * fix(UI): ImGui scaling for borderless mode (community-shaders#1929) * ci: don't fail on feature audits (community-shaders#1934) * fix(pbr): use scrap heap allocation (community-shaders#1928) * chore(UI): add subsurface scattering to Interior Only (community-shaders#1932) * fix(weather editor): align highlights, fix tooltip (community-shaders#1918) * fix(ssgi): guard VR only compilation (community-shaders#1938) * build: update template to avoid extra directory (community-shaders#1812) * style: fix hlsl formatting (community-shaders#1939) * fix(UI): improve theme management UI flow (community-shaders#1933) closes community-shaders#1919 * build(deps): update pre-commit hooks (community-shaders#1768) * feat(UI): delete theme button (community-shaders#1940) * feat(UI): open log file button (community-shaders#1942) * fix(hair): marschner volumetric shadow tint (community-shaders#1944) * fix(VR): screen space shadows desync (community-shaders#1946) closes community-shaders#1840 * fix(VR): depth culling during upscaling/Terrain Blending (community-shaders#1858) * feat(VR): add edge detection for stereo blending (community-shaders#1948) * refactor: allocate trampoline once (community-shaders#1951) * fix(UI): PBR MATO color scale RGB settings corrected (community-shaders#1957) * fix(weather editor): guard against loadorder changes (community-shaders#1953) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: davo0411 <davidkehoe0411@outlook.com> * fix(UI): feature description text wrapping (community-shaders#1960) * fix(VR): exponential height fog stereo mismatch (community-shaders#1961) * chore: pbr consistency changes (community-shaders#1841) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: jiayev <l936249247@hotmail.com> * fix(skylighting): remove PBR lighting scale (community-shaders#1963) * fix(skysync): effect mesh blackout during shadow caster transitions (community-shaders#1965) * ci: fix wiki deletion with buffer update (community-shaders#1967) * feat(weather-editor): option to hide viewport (community-shaders#1970) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * test(shader): fallback to warp on invalidarg (community-shaders#1956) Co-authored-by: LukeFrankio <loren@example.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat: triplanar projected materials (community-shaders#1950) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(ao): better ao calculations (community-shaders#1968) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(pbr): fix improper kD terms (community-shaders#1971) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * perf(emat): tweak fade and shadow intensity (community-shaders#1892) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat(ibl): revamp ibl and dalc sh (community-shaders#1947) * build: bump commonlib to 4.7.1 (community-shaders#1977) * fix: upscaling monitor detection fixes (community-shaders#1978) * fix(weather editor): prevent overrides resetting settings (community-shaders#1980) * fix(VR): bad llf offset (community-shaders#1984) * perf: cache frequent ui checks (community-shaders#1985) * fix: preserve vanilla water TAA when no upscaler is active (community-shaders#1986) Co-authored-by: jturnley <jturnley@users.noreply.github.com> * fix(UI): first-time dialog fade affects all overlays (community-shaders#1976) * fix(skysync): remove sunlight fade and volumetric lighting overrides (community-shaders#1966) * refactor(HLSL): standardize epsilon constants (community-shaders#1992) closes community-shaders#1227 * feat(UI): require Shift to dock windows (community-shaders#1989) * fix(UI): input spam after alt-tab (community-shaders#1993) * fix(sky sync): early return for invalid cells (community-shaders#1991) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: jiayev <l936249247@hotmail.com> * fix(sky sync): remove undeclared variable (community-shaders#1994) * refactor(pbr): clear up semantics (community-shaders#1995) * fix(UI): scale layout values for high-DPI (community-shaders#1987) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(water): hdr water taa blend (community-shaders#1988) * refactor(color): clarify gamma conversion functions (community-shaders#1996) * feat(ISL-editor): add light counters and fix filtering (community-shaders#1997) * fix(UI): DPI-aware window layouts (community-shaders#2000) * fix(weather-editor): save color palette window (community-shaders#2001) * refactor: centralize feature category names (community-shaders#2007) closes community-shaders#1265 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * chore: bump versions (community-shaders#2010) * fix(water): sample history mask from current mask (community-shaders#2011) * chore(wetness-effects): set default MaxPuddleWetness to 1.5 (community-shaders#1981) Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> * feat(weather-editor): add free camera and play mode (community-shaders#2008) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * build: bump versions and reduce false positives (community-shaders#2013) * fix(VR): LLF cluster building and culling (community-shaders#2012) * build: update to VS 2026 (community-shaders#1990) * ci: fix preset in vs2022 mode (community-shaders#2015) * ci: remove v2022 from shader jobs (community-shaders#2016) * feat(upscaling): integrate Streamline Reflex controls (community-shaders#1958) * fix(unified-water): BSWaterShaderProperty.plane (community-shaders#1998) --------- Co-authored-by: Skrubby Skrub In A Shrub <87662196+SkrubbySkrubInAShrub@users.noreply.github.com> Co-authored-by: SkrubbySkrubInAShrub <skrubbyskrubinashrub@gmail.com> Co-authored-by: doodlum <15017472+doodlum@users.noreply.github.com> Co-authored-by: jiayev <l936249247@hotmail.com> Co-authored-by: Dlizzio <77717521+Dlizzio@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alan Tse <alandtse@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Bruce <44987693+brucenguyen@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Dawntic <197450198+Dawntic@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Alan Tse <alandtse@gmail.com> Co-authored-by: Vanni Giachin <vanni.giachin@qlik.com> Co-authored-by: zxcvbn <66063766+zndxcvbn@users.noreply.github.com> Co-authored-by: ParticleTroned <248299730+ParticleTroned@users.noreply.github.com> Co-authored-by: soda <130315225+soda3000@users.noreply.github.com> Co-authored-by: YtzyFvra <59631290+YtzyFvra@users.noreply.github.com> Co-authored-by: LukeFrankio <lorenzogrutzmann@gmail.com> Co-authored-by: LukeFrankio <loren@example.com> Co-authored-by: jturnley <32892261+jturnley@users.noreply.github.com> Co-authored-by: jturnley <jturnley@users.noreply.github.com> Co-authored-by: Igor Alan Albuquerque de Sousa <50077829+IgorAlanAlbuquerque@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit a653c74)
This pull request refactors the way lighting and shadow information is passed and used in hair shading functions. Instead of passing individual lighting and shadow parameters, the code now uses a unified
DirectContextobject, allowing for more consistent and flexible handling of light color and shadow factors. The changes also improve the calculation of transmission and attenuation for more realistic hair rendering.Refactoring of function signatures and parameter handling:
GetHairDirectLightScheuermannandGetHairDirectLightMarschnerfunctions now take aDirectContextobject instead of separate light and shadow parameters, simplifying their interfaces and improving maintainability. [1] [2] [3]Improved shadow and transmission calculations:
DirectContextfor more realistic results. [1] [2] [3]Consistency and correctness fixes:
lightColoris standardized across functions, ensuring consistent lighting compensation and shadowing. [1] [2]Summary by CodeRabbit
Refactor
Tests