fix(lighting): guard EMAT parallax shadow against undefined TBN#2462
Conversation
…unity-shaders#80) Co-authored-by: ParticleTroned <248299730+ParticleTroned@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR refines shader compilation by narrowing the conditional guard for EMAT parallax shadow logic in ChangesEMAT parallax shadow conditional guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
No actionable suggestions for changed features. |
Summary
The EMAT parallax-shadow block in
Lighting.hlslreads the tangent-space basistbnviamul(refractedLightDirection, tbn), buttbnis only defined underdefined(SKINNED) || !defined(MODELSPACENORMALS). ForMODELSPACENORMALS && !SKINNEDpermutations, the block read an undefinedtbn, producing garbage parallax soft-shadow results.This gates the block on the same condition that defines
tbn, matching the idiom already used elsewhere in the file (e.g. the EMAT normal-mapping block and thetbndefinition itself).Change
package/Shaders/Lighting.hlsl— two lines: tighten#if defined(EMAT)→#if defined(EMAT) && (defined(SKINNED) || !defined(MODELSPACENORMALS))around the parallax-shadow block (and annotate the matching#endif).The guard only removes the block from permutations where
tbnwas undefined, so it cannot introduce a compile error — only fix the latent undefined read. CI shader validation covers the affected permutations.Attribution
Ported from ParticleTroned/skyrim-community-shaders (
fix(lighting): guard EMAT parallax shadow TBN use).🤖 Generated with Claude Code
Cherrypicked from open shaders
Summary by CodeRabbit