Skip to content

fix: fix bad camera data#1459

Merged
doodlum merged 1 commit into
devfrom
camera-data-fix
Sep 9, 2025
Merged

fix: fix bad camera data#1459
doodlum merged 1 commit into
devfrom
camera-data-fix

Conversation

@doodlum
Copy link
Copy Markdown
Collaborator

@doodlum doodlum commented Sep 9, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved per-eye lighting accuracy in VR, reducing flicker and shadow misalignment.
    • Disabled Temporal AA after upscaling to minimize blur, ghosting, and jitter, resulting in a sharper, more stable image.
    • Post-processing no longer re-enables TAA, preventing unintended toggling.
  • Refactor

    • Updated internal camera and projection data handling to a more consistent source for reliability in lighting calculations, with no expected impact on user workflows beyond improved stability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 9, 2025

Walkthrough

Replaces camera/projection data access in LightLimitFix with frameBufferCached getters and transposed matrices. In Upscaling, forces TAA off after upscaling and removes prior re-toggle in post-processing. No signatures changed; logic flow largely maintained except for TAA state handling.

Changes

Cohort / File(s) Summary
Camera/projection via frameBufferCached
src/Features/LightLimitFix.cpp
Switched eye position, view, projection, and inverse projection retrieval from Util/DirectX calls to frameBufferCached APIs; applied .Transpose(); updated both eye-cache population and per-eye projection/inverse computations.
TAA state handling after upscaling
src/Features/Upscaling.cpp
In PerformUpscaling, after locking dynamic resolution, fetched BSImagespaceShaderISTemporalAA and set taaEnabled = false. Removed post-processing reassertion of TAA state (taaEnabled = upscaleMethod == kTAA;).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as Upscaling::PerformUpscaling
  participant R as RuntimeData
  participant I as ImageSpaceManager (singleton)
  participant T as BSImagespaceShaderISTemporalAA

  U->>R: dynamicResolutionLock = 1
  Note over U,R: After upscaling step completes
  U->>I: Get singleton
  I-->>U: manager*
  U->>T: GET_INSTANCE_MEMBER(manager)
  U->>T: taaEnabled = false
  Note over T: TAA forcibly disabled post-upscale

  rect rgba(235,235,255,0.4)
  Note over U,T: Previous flow removed
  U-x T: (Post-processing thunk no longer toggles TAA by upscaleMethod)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • jiayev

Pre-merge checks (1 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive There is no pull request description provided, so it is not possible to verify whether it relates to the changeset. Please add or update the pull request description to summarize the key changes in both LightLimitFix.cpp and Upscaling.cpp so that it clearly reflects the intent and scope of the patch.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “fix: fix bad camera data” clearly references the camera data correction in the LightLimitFix patch but does not cover the Upscaling.cpp updates and is somewhat generic with redundant phrasing. It is related to a real aspect of the changeset yet does not fully summarize the scope or primary focus of the pull request.

Poem

A rabbit tweaks the light and view,
Cached frames in paws, matrices anew.
I flip the TAA switch to “no,”
After the upscale’s finished show.
Hop, hop—less jitter in the night,
Two bright eyes, correctly lit just right. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch camera-data-fix

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
Copy Markdown

github-actions Bot commented Sep 9, 2025

Using provided base ref: 99a5edc
Using base ref: 99a5edc
Base commit date: 2025-09-09T19:55:56+01:00 (Tuesday, September 09, 2025 07:55 PM)
No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Features/Upscaling.cpp (1)

1560-1564: Redundant TAA toggle; clarify intent (“jitter” vs full TAA) and de-duplicate

You disable TAA here, and Main_PostProcessing later sets taaEnabled = (upscaleMethod == kTAA) on Line 1705. If the goal is “no TAA when using FSR/XeSS/DLSS,” the later assignment already enforces that per-frame, making this toggle redundant. If the goal is to prevent any post-upscale jitter/temporal blend before camera constants refresh, please document it and guard it explicitly to avoid flip-flopping.

Suggestion: centralize the TAA state change in one place (Main_PostProcessing), or at least guard this block to make the intent obvious.

-    // Disable jitter after upscaling
-    auto imageSpaceManager = RE::ImageSpaceManager::GetSingleton();
-    GET_INSTANCE_MEMBER(BSImagespaceShaderISTemporalAA, imageSpaceManager);
-    BSImagespaceShaderISTemporalAA->taaEnabled = false;
+    // Ensure TAA is disabled for non-TAA upscalers before camera constants update
+    // (kept only if disabling here is required to avoid a transient blend)
+    if (GetUpscaleMethod() != UpscaleMethod::kTAA) {
+        auto imageSpaceManager = RE::ImageSpaceManager::GetSingleton();
+        GET_INSTANCE_MEMBER(BSImagespaceShaderISTemporalAA, imageSpaceManager);
+        BSImagespaceShaderISTemporalAA->taaEnabled = false;
+    }

Note: The AI summary claims the post-processing reassertion was removed, but Line 1705 still reassigns taaEnabled; please reconcile.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99a5edc and 2aef96e.

📒 Files selected for processing (2)
  • src/Features/LightLimitFix.cpp (2 hunks)
  • src/Features/Upscaling.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not include TODO/FIXME placeholders; provide complete, working solutions

Files:

  • src/Features/Upscaling.cpp
  • src/Features/LightLimitFix.cpp
src/**/*.{cpp,cxx,cc,h,hpp,hxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code

Files:

  • src/Features/Upscaling.cpp
  • src/Features/LightLimitFix.cpp
🧠 Learnings (1)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (2)
src/Features/LightLimitFix.cpp (2)

812-816: Ensure consistent matrix convention: Verify that both frameBufferCached.GetCameraView and Util::GetCameraData(eyeIndex).viewMat use the same row/column-major orientation—either drop the unnecessary Transpose() on the cached path or apply a corresponding transpose in the non-cached path so that SimpleMath::Vector3::Transform always receives uniformly oriented matrices.


1024-1036: Verify file presence and FOV derivation
I couldn’t locate LightLimitFix.cpp in the repo—please confirm its path and that the vertical FOV is derived from pm.m[1][1] (not m[0][0]), and verify the transpose aligns with your HLSL row- vs column-major expectations.

@doodlum doodlum merged commit f041e68 into dev Sep 9, 2025
15 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Sep 9, 2025

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

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.

2 participants