fix(foliage): flip foliage normal and fix sss#2344
Conversation
📝 WalkthroughWalkthroughTwo shader files receive conditional logic and calculations for tree animation rendering. PBR transmission uses foliage-specific attenuation when TREE_ANIM is active. Lighting applies normal-space transformation and enforces a sun-facing constraint on Screen Space Shadows during vegetation shading. ChangesTree Animation Rendering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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)
Comment |
|
No actionable suggestions for changed features. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
package/Shaders/Common/PBR.hlsli (1)
175-188: ⚡ Quick winAdd a closing issue reference in the PR description.
Since this is a bug-fix PR, consider adding
Fixes #<id>orCloses #<id>for traceability.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 current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@package/Shaders/Common/PBR.hlsli` around lines 175 - 188, The PR is a bug-fix but lacks a closing issue reference; update the PR description to include a GitHub keyword like "Fixes #<id>" or "Closes #<id>" referencing the tracked bug so the issue is auto-closed on merge—add that line (e.g., Fixes `#123`) to the PR description and ensure the issue ID corresponds to the bug being fixed in the changes around material.SubsurfaceColor / subsurface foliage handling in PBR.hlsli.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@package/Shaders/Common/PBR.hlsli`:
- Around line 175-188: The PR is a bug-fix but lacks a closing issue reference;
update the PR description to include a GitHub keyword like "Fixes #<id>" or
"Closes #<id>" referencing the tracked bug so the issue is auto-closed on
merge—add that line (e.g., Fixes `#123`) to the PR description and ensure the
issue ID corresponds to the bug being fixed in the changes around
material.SubsurfaceColor / subsurface foliage handling in PBR.hlsli.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5058781a-7257-437a-9e9d-764b44b295f0
📒 Files selected for processing (2)
package/Shaders/Common/PBR.hlslipackage/Shaders/Lighting.hlsl
This pull request introduces improvements to subsurface lighting and normal handling in tree animation shaders, as well as a small fix for screen space shadowing. The changes enhance the realism of foliage rendering and prevent potential shadow artifacts.
Tree Animation and Subsurface Lighting:
package/Shaders/Common/PBR.hlsli: Added a special-case branch for subsurface lighting whenTREE_ANIMis defined, using a simplified calculation tailored for animated foliage.package/Shaders/Lighting.hlsl: WhenTREE_ANIMis defined, transforms the surface normal to ensure consistent lighting for animated tree geometry by adjusting the normal in view space and converting it back to world space.Screen Space Shadows:
package/Shaders/Lighting.hlsl: Adds a check to only apply screen space shadows if the directional light angle is non-negative, preventing shadow artifacts in certain interior or edge cases.Summary by CodeRabbit
Visual Improvements
Performance