Skip to content

Conversation

@midona-rhel
Copy link

@midona-rhel midona-rhel commented Dec 1, 2025

Fix snow appearing on vertical surfaces facing certain directions

Snow projection was comparing model-space and world-space vectors directly, causing inconsistent results based on
object rotation. Some wall-mounted objects (like rugs) would incorrectly show snow depending on which compass
direction they faced.

Fixed by transforming the projection direction to world space before the comparison.

Easiest way I found to replicate this was to download https://www.nexusmods.com/skyrimspecialedition/mods/18223 and create a new character, speedrun into the house and look at the rug facing the east.

Summary by CodeRabbit

  • Rendering
    • Improved texture projection coordinate transformation in shader processing for enhanced visual accuracy.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

A shader optimization modifies how texture projection coordinates are transformed in the non-skinned PROJECTED_UV rendering path. Instead of directly using projection coordinates, the code now constructs a world-space 3x3 matrix from world axes and multiplies it with the projection vector, altering the orientation transformation.

Changes

Cohort / File(s) Summary
Shader projection coordinate transformation
package/Shaders/Lighting.hlsl
Modified TexProj computation in PROJECTED_UV (non-SKINNED) path to use world-space matrix transformation instead of direct texture projection coordinate usage

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file modified with focused mathematical transformation
  • Requires understanding of world-space vs. texture-space coordinate systems and their impact on rendering
  • Consider verifying the matrix construction logic and confirming this produces the intended visual/performance results

Possibly related PRs

Suggested reviewers

  • doodlum
  • jiayev
  • Pentalimbed

Poem

🐰 A matrix dance in shader's light,
World-space axes spinning bright!
Projections twist from old to new,
Transforming coordinates through and through. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The PR title 'fix: use world space vectors for snow' directly matches the core change: transforming projection direction to world space for snow projection calculations, addressing the issue of snow appearing on vertical surfaces due to model-space/world-space mismatch.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Using provided base ref: 39aa9d7
Using base ref: 39aa9d7
Base commit date: 2025-11-30T19:11:20-08:00 (Sunday, November 30, 2025 07:11 PM)
No actionable suggestions for changed features.

@midona-rhel midona-rhel changed the title Updated snow projection to use proper world space vectors fix: Updated snow projection to use proper world space vectors Dec 1, 2025
@midona-rhel midona-rhel marked this pull request as ready for review December 1, 2025 21:06
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse changed the title fix: Updated snow projection to use proper world space vectors fix: use world space vectors for snow Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant