Skip to content

fix(ISL): stealth light level calculations#1254

Merged
alandtse merged 2 commits into
community-shaders:devfrom
sicsix:fixlightlevelcalcs
Jul 14, 2025
Merged

fix(ISL): stealth light level calculations#1254
alandtse merged 2 commits into
community-shaders:devfrom
sicsix:fixlightlevelcalcs

Conversation

@sicsix
Copy link
Copy Markdown
Collaborator

@sicsix sicsix commented Jul 14, 2025

Summary by CodeRabbit

  • New Features

    • Improved lighting realism by updating luminance calculations for point lights using the inverse square law, enhancing visual accuracy for lights with the "InverseSquare" property.
  • Chores

    • Updated the minimum required version of the VR address library to 0.181.0.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 14, 2025

Walkthrough

A new luminance calculation override for inverse square point lights was implemented by introducing a detour hook and thunk. The logic specifically alters how luminance is computed for these lights, while other types retain the original behavior. Additionally, the minimum required VR address library version was raised from 0.179.0 to 0.181.0.

Changes

File(s) Change Summary
src/Features/InverseSquareLighting.cpp, .h Added a detour hook, thunk, and new struct for custom luminance calculation for inverse square point lights.
src/XSEPlugin.cpp Updated VR address library version check from 0.179.0 to 0.181.0.

Suggested reviewers

  • alandtse

Poem

In the world of light, a tweak so bright,
Inverse squares now shine just right!
A thunk appears, with logic new,
For point lights shining through and through.
Version checks hop up, not down—
This bunny’s code will light the town!
🐇💡


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7993635 and 047373e.

📒 Files selected for processing (3)
  • src/Features/InverseSquareLighting.cpp (2 hunks)
  • src/Features/InverseSquareLighting.h (1 hunks)
  • src/XSEPlugin.cpp (1 hunks)
🧰 Additional context used
🧠 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.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#577
File: features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli:57-61
Timestamp: 2025-06-17T05:40:22.785Z
Learning: Default parameter values are supported in the HLSL compiler used by the skyrim-community-shaders project, contrary to standard HLSL (FXC/DXC) limitations.
⏰ 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 (4)
src/XSEPlugin.cpp (1)

157-157: VR address library version update looks good.

The version bump from 0.179.0 to 0.181.0 aligns with the PR objectives and the referenced VR library pull request.

src/Features/InverseSquareLighting.h (1)

60-64: Hook declaration follows established patterns.

The BSLight_GetLuminance struct properly declares the detour hook following the same pattern as other hooks in this codebase.

src/Features/InverseSquareLighting.cpp (2)

18-18: Detour hook installation is correct.

The hook installation for BSLight_GetLuminance follows the established pattern and uses appropriate relocation IDs for both SE and VR.


96-113: Confirm necessity of bsLight->luminance assignment

I searched the codebase for other reads or writes of bsLight->luminance and found that this assignment at line 110 in src/Features/InverseSquareLighting.cpp is the only occurrence. Since the function also returns the computed luminance, please verify that updating the luminance member is required by the engine (e.g., for later game logic) and not redundant.

• File: src/Features/InverseSquareLighting.cpp
Line 110: bsLight->luminance = luminance;

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@github-actions
Copy link
Copy Markdown

Using provided base ref: 7993635
Using base ref: 7993635
Base commit date: 2025-07-13T17:18:52-07:00 (Sunday, July 13, 2025 05:18 PM)
No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

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

@alandtse alandtse changed the title fix: stealth light level calculations for inverse square lights fix(ISL): stealth light level calculations Jul 14, 2025
@alandtse alandtse merged commit 21f6706 into community-shaders:dev Jul 14, 2025
17 checks passed
alandtse pushed a commit to alandtse/open-shaders that referenced this pull request Jul 20, 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.

2 participants