Skip to content

feat: new SSGI and SSR + NRD - #2573

Open
jiayev wants to merge 48 commits into
devfrom
ssgi-opt-2-ssr-separation
Open

feat: new SSGI and SSR + NRD#2573
jiayev wants to merge 48 commits into
devfrom
ssgi-opt-2-ssr-separation

Conversation

@jiayev

@jiayev jiayev commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added screen-space reflections with hierarchical ray marching, dynamic cubemap fallback, and optional temporal denoising.
    • Added NVIDIA REBLUR denoising support and improved screen-space global illumination with multi-bounce lighting, SH output, and configurable cubemap fallback.
    • Added controls for whether skylighting affects environment lighting.
  • Enhancements

    • Improved dynamic cubemap skylighting and IBL visibility handling.
    • Updated settings, shader versions, and translations for the new lighting features.
  • Bug Fixes

    • Improved handling of sky-depth values and lighting composition.

doodlum and others added 30 commits May 12, 2026 01:24
Separates Screen Space Reflections from the ScreenSpaceGI feature into its
own standalone feature (features/Screen Space Reflections + src/Features/
ScreenSpaceReflections.{h,cpp}) so reflections can be toggled independently
of diffuse GI.

Promotes the NVIDIA Real-Time Denoiser (NRD) integration to a core
top-level feature (features/NRD with CORE marker + src/Features/NRD.{h,cpp})
that owns the shared guide textures (viewZ, packed normal+roughness, motion
vectors), the prepareNRDGuides compute pass, and the common per-frame
camera/jitter state. Consumers (SSGI, SSR, and any future denoising
clients) construct their own NRDReblurIntegration instances and consume
guides via the global NRD service. REBLURSettings UI/struct is centralized
on NRD so every consumer gets identical controls.

- Move specularGI / prefilterHiZDepth / depthDownsample shaders into the
  new SSR feature folder; SSR's specularGI cbuffer is now SSRCB (b1).
- Move prepareNRDGuides into the new NRD feature folder.
- DeferredCompositeCS: SSGI_SPECULAR / SsgiSpecularTexture renamed to
  SSR / SsrTexture and lifted out of the SSGI #ifdef block so SSR can
  run without SSGI being enabled.
- SharedData: split SSGISettings (diffuse-only) and SSRSettings; SSR
  appended to the FeatureData cbuffer.
- Deferred.cpp: NRD.PrepareGuides() runs first, then SSGI diffuse, then
  SSR specular; the SSR composite define is gated on the SSR feature.
- Globals / Feature.cpp / FeatureBuffer.cpp / SceneSettingsManager /
  VR::AnyScreenSpaceEffectLoaded updated to register the new features.
Removes SampleSSGISpecular (the roughness-biased re-sampling of the SSGI
diffuse texture as approximate specular) and its companion ssgiAo→specular
modulation block in DeferredCompositeCS. With ScreenSpaceReflections now
providing proper stochastic Hi-Z reflections, the SSGI-derived faux
specular path is redundant — and removing it means SSGI's contribution to
the composite is strictly diffuse + AO, which is its actual purpose.
Pairs the existing Tracy zones with BeginPerfEvent/EndPerfEvent calls
gated on State::frameAnnotations, matching the pattern used by SSS,
Skylighting, HDRDisplay, and LightLimitFix. RenderDoc/PIX/Nsight
captures now show the SSR pipeline as named groups (SSR → Hi-Z Depth,
Specular GI, REBLUR Specular) instead of bare compute dispatches.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change integrates NRD, replaces the SSGI pipeline with REBLUR-based processing, adds screen-space reflections, updates deferred bindings, and changes IBL skylighting controls.

Changes

NRD and build integration

Layer / File(s) Summary
NRD infrastructure
.gitmodules, extern/NRD, CMakeLists.txt, src/Features/NRD.*, src/Features/NRDReblurIntegration.*, features/NRD/*
Adds the NRD submodule, build settings, guide preparation shader, DX11 dispatcher, resource management, common settings, and REBLUR controls.

SSGI pipeline replacement

Layer / File(s) Summary
SSGI REBLUR pipeline
src/Features/ScreenSpaceGI.*, features/Screen Space GI/Shaders/ScreenSpaceGI/*, package/Shaders/NRD/NRDReblurSH.hlsli
Replaces legacy SSGI passes with diffuse GI tracing, multi-bounce history, optional SH output, REBLUR denoising, and composite output.

Screen-space reflections

Layer / File(s) Summary
SSR Hi-Z and REBLUR pipeline
src/Features/ScreenSpaceReflections.*, features/Screen Space Reflections/Shaders/*
Adds SSR settings, Hi-Z depth generation, hierarchical ray marching, cubemap fallback, and optional REBLUR denoising.

Deferred rendering and shared data

Layer / File(s) Summary
Deferred composition and registration
src/Deferred.cpp, src/Feature*.cpp, src/Globals.*, package/Shaders/DeferredCompositeCS.hlsl, package/Shaders/Common/SharedData.hlsli
Registers NRD, SSGI, and SSR; updates shared buffers and resource slots; and composites diffuse GI and traced specular output.

IBL and localized metadata

Layer / File(s) Summary
IBL skylighting controls and translations
src/Features/IBL.*, features/IBL/Shaders/IBL/IBL.hlsli, features/Dynamic Cubemaps/*, package/SKSE/Plugins/CommunityShaders/Translations/*
Removes directional DALC mode, adds SkylightingAffectsEnv, updates occluded IBL handling, and revises feature text and metadata.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Deferred
  participant NRD
  participant ScreenSpaceGI
  participant ScreenSpaceReflections
  participant Composite
  Deferred->>NRD: Prepare guides
  Deferred->>ScreenSpaceGI: Generate and denoise diffuse GI
  ScreenSpaceGI-->>Deferred: Diffuse and SH1 outputs
  Deferred->>ScreenSpaceReflections: Generate Hi-Z and trace reflections
  ScreenSpaceReflections-->>Deferred: Specular output
  Deferred->>Composite: Bind GI and SSR resources
  Composite-->>Deferred: Composite lighting
Loading

Possibly related PRs

Suggested reviewers: doodlum, alandtse, pentalimbed

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely identifies the main changes: new SSGI, SSR, and NRD integration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ssgi-opt-2-ssr-separation

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.

@github-actions

Copy link
Copy Markdown

No actionable suggestions for changed features.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
.gitmodules (1)

11-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider updating the PR title and description.

As per path instructions, please ensure the following PR conventions are met:

  1. Conventional Commit Titles: The PR title feat: new SSGI and SSR + NRD should ideally use a fully lowercase description, e.g., feat: integrate nrd, ssgi, and ssr.
  2. Issue References: If this PR implements features or fixes bugs, consider adding appropriate GitHub keywords to the PR description (e.g., Implements #123 or `Fixes `#123).
🤖 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 @.gitmodules around lines 11 - 13, Update the pull request metadata rather
than the .gitmodules change: use a Conventional Commit title with a fully
lowercase description, such as “feat: integrate nrd, ssgi, and ssr,” and add
relevant GitHub issue-closing or implementation references to the PR description
when applicable.

Source: Path instructions

src/Features/IBL.cpp (1)

75-83: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid casting uint* to bool* for ImGui.

ImGui::Checkbox expects a 1-byte bool*, but settings.SkylightingAffectsEnv is a 4-byte uint. Casting uint* to bool* causes ImGui to only read and write the first byte. While this happens to work on little-endian architectures for values of 0 and 1, it violates strict aliasing rules and could lead to undefined behavior.

Consider using a temporary boolean variable to interface with ImGui safely.

♻️ Proposed refactor
-	ImGui::Checkbox(T(TKEY("skylighting_affects_env"), "Skylighting Affects Env/DALC"), (bool*)&settings.SkylightingAffectsEnv);
+	bool skylightingAffectsEnv = settings.SkylightingAffectsEnv != 0;
+	if (ImGui::Checkbox(T(TKEY("skylighting_affects_env"), "Skylighting Affects Env/DALC"), &skylightingAffectsEnv)) {
+		settings.SkylightingAffectsEnv = skylightingAffectsEnv ? 1 : 0;
+	}
🤖 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 `@src/Features/IBL.cpp` around lines 75 - 83, Update the ImGui checkbox
handling for settings.SkylightingAffectsEnv to avoid casting the uint field to
bool*. Use a temporary bool initialized from the setting, pass it to
ImGui::Checkbox, and write the resulting value back to the uint field when the
checkbox changes.
extern/NRD (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Normalize the PR title and add an issue reference.

Consider feat: add ssgi and ssr with nrd; if this feature addresses an issue, add Implements #<issue-number> or Addresses #<issue-number> to the PR description.

As per path instructions: use lowercase Conventional Commit descriptions and include GitHub issue keywords for feature work.

🤖 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 `@extern/NRD` at line 1, Normalize the pull request title to a lowercase
Conventional Commit description, such as “feat: add ssgi and ssr with nrd”, and
add an “Implements #<issue-number>” or “Addresses #<issue-number>” reference to
the pull request description when an issue exists.

Source: Path instructions

features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini (1)

2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

PR meta: consider adding issue references.

The title feat: new SSGI and SSR + NRD is Conventional-Commit compliant. Since this integrates several features, consider linking the tracking issues in the body (e.g. Implements #123, `Related to `#123) so the work is traceable.

🤖 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 `@features/Screen` Space GI/Shaders/Features/ScreenSpaceGI.ini at line 2, Add
tracking issue references to the pull request body for the SSGI, SSR, and NRD
integration, using labels such as “Implements `#123`” or “Related to `#123`” as
appropriate. Keep the existing Conventional Commit title unchanged.

Source: Path instructions

src/Features/ScreenSpaceGI.cpp (1)

7-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

PR title/metadata (per path instructions).

The PR title feat: new SSGI and SSR + NRD bundles multiple concerns and reads informally. Consider a Conventional Commit style title, e.g. feat(rendering): integrate NRD REBLUR for SSGI and SSR, and add issue-reference keywords in the body (Implements #… / Closes #…) if this tracks an issue.

As per path instructions: "Conventional Commit Titles … Format: type(scope): description … lowercase description, no ending period" and "Issue References … Suggest adding appropriate GitHub keywords".

🤖 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 `@src/Features/ScreenSpaceGI.cpp` around lines 7 - 13, Update the pull request
metadata rather than the code: use a Conventional Commit title in the format
type(scope): lowercase description without a trailing period, such as
“feat(rendering): integrate NRD REBLUR for SSGI and SSR”. Add an appropriate
issue-reference keyword such as “Implements #…” or “Closes #…” in the pull
request body when applicable.

Source: Path instructions

🤖 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.

Inline comments:
In `@features/Screen` Space GI/Shaders/ScreenSpaceGI/diffuseGI.cs.hlsl:
- Around line 265-268: Update the conditional normal-orientation check in the
diffuse GI shader to test viewspaceNormal rather than pixCenterPos. Preserve the
existing viewspaceNormal flip, but compare it against viewVec so the branch can
correctly reorient normals facing away from the view direction.

In `@src/Features/ScreenSpaceReflections.cpp`:
- Line 340: Update the SpecMaxMips assignment in the ScreenSpaceReflections
setup to depend only on the available numHiZMips, removing the SpecMaxSteps
clamp so ray-march iteration limits do not reduce the depth hierarchy mip count.

---

Nitpick comments:
In @.gitmodules:
- Around line 11-13: Update the pull request metadata rather than the
.gitmodules change: use a Conventional Commit title with a fully lowercase
description, such as “feat: integrate nrd, ssgi, and ssr,” and add relevant
GitHub issue-closing or implementation references to the PR description when
applicable.

In `@extern/NRD`:
- Line 1: Normalize the pull request title to a lowercase Conventional Commit
description, such as “feat: add ssgi and ssr with nrd”, and add an “Implements
#<issue-number>” or “Addresses #<issue-number>” reference to the pull request
description when an issue exists.

In `@features/Screen` Space GI/Shaders/Features/ScreenSpaceGI.ini:
- Line 2: Add tracking issue references to the pull request body for the SSGI,
SSR, and NRD integration, using labels such as “Implements `#123`” or “Related to
`#123`” as appropriate. Keep the existing Conventional Commit title unchanged.

In `@src/Features/IBL.cpp`:
- Around line 75-83: Update the ImGui checkbox handling for
settings.SkylightingAffectsEnv to avoid casting the uint field to bool*. Use a
temporary bool initialized from the setting, pass it to ImGui::Checkbox, and
write the resulting value back to the uint field when the checkbox changes.

In `@src/Features/ScreenSpaceGI.cpp`:
- Around line 7-13: Update the pull request metadata rather than the code: use a
Conventional Commit title in the format type(scope): lowercase description
without a trailing period, such as “feat(rendering): integrate NRD REBLUR for
SSGI and SSR”. Add an appropriate issue-reference keyword such as “Implements
#…” or “Closes #…” in the pull request body when applicable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f7c6d96c-7a6e-408e-bf2d-fe0cd52976b6

📥 Commits

Reviewing files that changed from the base of the PR and between bc2cb33 and d5716e7.

📒 Files selected for processing (54)
  • .gitmodules
  • CMakeLists.txt
  • extern/NRD
  • features/Dynamic Cubemaps/Shaders/DynamicCubemaps/DynamicCubemaps.hlsli
  • features/Dynamic Cubemaps/Shaders/Features/DynamicCubemaps.ini
  • features/Exponential Height Fog/Shaders/Features/ExponentialHeightFog.ini
  • features/IBL/Shaders/Features/ImageBasedLighting.ini
  • features/IBL/Shaders/IBL/IBL.hlsli
  • features/NRD/CORE
  • features/NRD/Shaders/Features/NRD.ini
  • features/NRD/Shaders/NRD/prepareNRDGuides.cs.hlsl
  • features/Screen Space GI/Shaders/Features/ScreenSpaceGI.ini
  • features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/common.hlsli
  • features/Screen Space GI/Shaders/ScreenSpaceGI/composite.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/diffuseGI.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/prefilterDepths.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/prefilterNormal.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/prefilterRadiance.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/upsample.cs.hlsl
  • features/Screen Space Reflections/Shaders/Features/ScreenSpaceReflections.ini
  • features/Screen Space Reflections/Shaders/ScreenSpaceReflections/common.hlsli
  • features/Screen Space Reflections/Shaders/ScreenSpaceReflections/depthDownsample.cs.hlsl
  • features/Screen Space Reflections/Shaders/ScreenSpaceReflections/prefilterHiZDepth.cs.hlsl
  • features/Screen Space Reflections/Shaders/ScreenSpaceReflections/specularGI.cs.hlsl
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/SKSE/Plugins/CommunityShaders/Translations/ru.json
  • package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
  • package/Shaders/Common/SharedData.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
  • package/Shaders/DistantTree.hlsl
  • package/Shaders/Lighting.hlsl
  • package/Shaders/NRD/NRDReblurSH.hlsli
  • package/Shaders/RunGrass.hlsl
  • package/Shaders/Water.hlsl
  • src/Deferred.cpp
  • src/Feature.cpp
  • src/FeatureBuffer.cpp
  • src/Features/IBL.cpp
  • src/Features/IBL.h
  • src/Features/NRD.cpp
  • src/Features/NRD.h
  • src/Features/NRDReblurIntegration.cpp
  • src/Features/NRDReblurIntegration.h
  • src/Features/ScreenSpaceGI.cpp
  • src/Features/ScreenSpaceGI.h
  • src/Features/ScreenSpaceReflections.cpp
  • src/Features/ScreenSpaceReflections.h
  • src/Features/Skylighting.h
  • src/Globals.cpp
  • src/Globals.h
  • src/SceneSettingsManager.cpp
💤 Files with no reviewable changes (7)
  • src/Features/Skylighting.h
  • package/Shaders/DistantTree.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/radianceDisocc.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/blur.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/upsample.cs.hlsl
  • features/Screen Space GI/Shaders/ScreenSpaceGI/gi.cs.hlsl
  • package/SKSE/Plugins/CommunityShaders/Translations/ru.json

Comment on lines +265 to +268
const float3 viewVec = normalize(-pixCenterPos);

if (dot(viewVec, pixCenterPos) > 0)
viewspaceNormal = -viewspaceNormal;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE='features/Screen Space GI/Shaders/ScreenSpaceGI/diffuseGI.cs.hlsl'

# Show surrounding context with line numbers
sed -n '230,290p' "$FILE" | cat -n

# Find definitions/usages of the relevant symbols in the file
rg -n --context 3 'pixCenterPos|viewVec|viewspaceNormal' "$FILE"

Repository: community-shaders/skyrim-community-shaders

Length of output: 5553


Dead normal-flip: this branch never runs. dot(normalize(-pixCenterPos), pixCenterPos) is always <= 0, so viewspaceNormal is never re-oriented here. This should test the normal instead of the position.

🤖 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 `@features/Screen` Space GI/Shaders/ScreenSpaceGI/diffuseGI.cs.hlsl around
lines 265 - 268, Update the conditional normal-orientation check in the diffuse
GI shader to test viewspaceNormal rather than pixCenterPos. Preserve the
existing viewspaceNormal flip, but compare it against viewVec so the branch can
correctly reorient normals facing away from the view direction.

data.FrameIndex = globals::state->frameCount;

data.SpecMaxSteps = settings.SpecMaxSteps;
data.SpecMaxMips = std::min((uint)settings.SpecMaxSteps, numHiZMips);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

SpecMaxMips clamped by SpecMaxSteps couples unrelated controls.

SpecMaxMips represents the available Hi-Z mip count, but it's clamped by SpecMaxSteps (max ray-march iterations). With a low Max Steps value (slider allows down to 1), this unintentionally shrinks the depth hierarchy (SSRT_DEPTH_HIERARCHY_MAX_MIP), degrading traversal quality rather than just iteration count. Consider clamping by numHiZMips alone (or a dedicated mip control).

Proposed change
-	data.SpecMaxMips = std::min((uint)settings.SpecMaxSteps, numHiZMips);
+	data.SpecMaxMips = numHiZMips;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
data.SpecMaxMips = std::min((uint)settings.SpecMaxSteps, numHiZMips);
data.SpecMaxMips = numHiZMips;
🤖 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 `@src/Features/ScreenSpaceReflections.cpp` at line 340, Update the SpecMaxMips
assignment in the ScreenSpaceReflections setup to depend only on the available
numHiZMips, removing the SpecMaxSteps clamp so ray-march iteration limits do not
reduce the depth hierarchy mip count.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
package/SKSE/Plugins/CommunityShaders/Translations/en.json (1)

793-794: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a scoped conventional commit title and link the tracked issue.

Consider renaming the PR to feat(rendering): add SSGI, SSR, and NRD. If this implements a tracked feature, add Implements #<id> or Addresses #<id> to the PR body.

As per path instructions, use type(scope): description titles and appropriate GitHub issue keywords for feature work.

🤖 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/SKSE/Plugins/CommunityShaders/Translations/en.json` around lines 793
- 794, Rename the pull request using the scoped conventional format
`feat(rendering): add SSGI, SSR, and NRD`, and add the applicable tracked issue
reference to the PR body using `Implements #<id>` or `Addresses #<id>`.

Source: Path instructions

🤖 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/SKSE/Plugins/CommunityShaders/Translations/en.json`:
- Around line 793-794: Rename the pull request using the scoped conventional
format `feat(rendering): add SSGI, SSR, and NRD`, and add the applicable tracked
issue reference to the PR body using `Implements #<id>` or `Addresses #<id>`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 65007d8e-1823-4dbc-a1c0-1c43ab98cd10

📥 Commits

Reviewing files that changed from the base of the PR and between d5716e7 and 896760c.

📒 Files selected for processing (2)
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package/SKSE/Plugins/CommunityShaders/Translations/zh_CN.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
package/Shaders/Lighting.hlsl (2)

2944-2947: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Guard the grazing-angle projection denominator.

layerViewProjection.z can reach zero when the view direction is parallel to the layer plane, causing invalid UV coordinates and corrupted multi-layer-parallax samples.

Proposed fix
 float3 layerViewProjection = -layerNormal.xyz * layerViewAngle.xxx - tangentViewDirection.xyz;
-float2 layerUv = uv * MultiLayerParallaxData.zw + (0.0009765625 * (layerValue / abs(layerViewProjection.z))).xx * layerViewProjection.xy;
+float layerProjectionZ = max(abs(layerViewProjection.z), EPSILON_DIVISION);
+float2 layerUv = uv * MultiLayerParallaxData.zw + (0.0009765625 * (layerValue / layerProjectionZ)).xx * layerViewProjection.xy;
🤖 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/Lighting.hlsl` around lines 2944 - 2947, Guard the
denominator in the layerUv calculation within the multi-layer parallax
projection, using a small nonzero epsilon while preserving the denominator’s
sign so layerViewProjection.z cannot reach zero. Keep the existing projection
and UV offset behavior unchanged for non-grazing angles.

2951-2956: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply the multi-layer attenuation after populating indirect lobe weights.

GetIndirectLobeWeights runs at Line 3070 and resets the output before assigning its diffuse lobe, so this multiplication is overwritten and multi-layer-parallax surfaces retain the full base diffuse indirect contribution. (raw.githubusercontent.com)

Proposed fix
-    indirectLobeWeights.diffuse *= 1.0 - mlpBlendFactor;
...
 GetIndirectLobeWeights(indirectLobeWeights, indirectContext, material, uvOriginal);
+#if defined(MULTI_LAYER_PARALLAX)
+indirectLobeWeights.diffuse *= 1.0 - mlpBlendFactor;
+#endif
🤖 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/Lighting.hlsl` around lines 2951 - 2956, Move the multi-layer
attenuation of indirectLobeWeights.diffuse from the current block to after
GetIndirectLobeWeights has populated the weights, ensuring the multiplication is
not overwritten while preserving the existing mlpBlendFactor calculation.
🧹 Nitpick comments (1)
package/Shaders/Lighting.hlsl (1)

3032-3036: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Improve the PR metadata before merge.

The current title is conventional, but feat(rendering): add SSGI, SSR, and NRD is more descriptive for this cross-layer rendering change. If a separate tracking issue exists, add Implements #<issue> or Addresses #<issue> to the PR body. (github.com)

As per path instructions, “When reviewing PRs, please provide suggestions for Conventional Commit Titles” and “Issue References.”

🤖 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/Lighting.hlsl` around lines 3032 - 3036, Update the pull
request metadata rather than the shader code: use the Conventional Commit title
“feat(rendering): add SSGI, SSR, and NRD” and, if a tracking issue exists, add
an “Implements #<issue>” or “Addresses #<issue>” reference to the PR body.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@package/Shaders/Lighting.hlsl`:
- Around line 2944-2947: Guard the denominator in the layerUv calculation within
the multi-layer parallax projection, using a small nonzero epsilon while
preserving the denominator’s sign so layerViewProjection.z cannot reach zero.
Keep the existing projection and UV offset behavior unchanged for non-grazing
angles.
- Around line 2951-2956: Move the multi-layer attenuation of
indirectLobeWeights.diffuse from the current block to after
GetIndirectLobeWeights has populated the weights, ensuring the multiplication is
not overwritten while preserving the existing mlpBlendFactor calculation.

---

Nitpick comments:
In `@package/Shaders/Lighting.hlsl`:
- Around line 3032-3036: Update the pull request metadata rather than the shader
code: use the Conventional Commit title “feat(rendering): add SSGI, SSR, and
NRD” and, if a tracking issue exists, add an “Implements #<issue>” or “Addresses
#<issue>” reference to the PR body.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 331d3714-82ed-4fa3-a93e-5a51e18bcbe6

📥 Commits

Reviewing files that changed from the base of the PR and between 896760c and 09804fd.

📒 Files selected for processing (3)
  • package/Shaders/Lighting.hlsl
  • package/Shaders/RunGrass.hlsl
  • src/Features/Skylighting.h
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Features/Skylighting.h
  • package/Shaders/RunGrass.hlsl

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package/Shaders/RunGrass.hlsl (1)

583-585: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply the IL ambient suppression to both grass shader variants.

The non-GRASS_LIGHTING pixel-shader path at Lines 747-759 still adds directionalAmbientColor when SharedData::ssgiSettings.EnableIL != 0. Since both paths are deferred variants, grass lighting changes based solely on the permutation. Mirror this gate in the alternate path or factor the shared ambient handling into one helper.

Proposed fix
  if (SharedData::iblSettings.EnableIBL) {
    ...
  }

+ if (SharedData::ssgiSettings.EnableIL != 0)
+   directionalAmbientColor = 0;
+
  diffuseColor += directionalAmbientColor;
🤖 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/RunGrass.hlsl` around lines 583 - 585, Apply the same
EnableIL ambient suppression to the non-GRASS_LIGHTING pixel-shader path near
its directionalAmbientColor contribution, matching the existing gate in the
GRASS_LIGHTING variant. Ensure both deferred grass shader permutations set
directionalAmbientColor to zero when SharedData::ssgiSettings.EnableIL is
nonzero, while preserving their existing behavior otherwise.
🧹 Nitpick comments (1)
package/Shaders/RunGrass.hlsl (1)

583-585: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an issue reference to the PR description if one exists.

The title already follows Conventional Commit style. Because this PR implements features, add Implements #<issue> or Addresses #<issue> to the PR body when a tracking issue is available.

As per path instructions, feature PRs should include an appropriate GitHub issue keyword when applicable.

🤖 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/RunGrass.hlsl` around lines 583 - 585, Update the pull
request description to include “Implements #<issue>” or “Addresses #<issue>”
when a tracking GitHub issue exists; no code changes are needed in the RunGrass
shader.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@package/Shaders/RunGrass.hlsl`:
- Around line 583-585: Apply the same EnableIL ambient suppression to the
non-GRASS_LIGHTING pixel-shader path near its directionalAmbientColor
contribution, matching the existing gate in the GRASS_LIGHTING variant. Ensure
both deferred grass shader permutations set directionalAmbientColor to zero when
SharedData::ssgiSettings.EnableIL is nonzero, while preserving their existing
behavior otherwise.

---

Nitpick comments:
In `@package/Shaders/RunGrass.hlsl`:
- Around line 583-585: Update the pull request description to include
“Implements #<issue>” or “Addresses #<issue>” when a tracking GitHub issue
exists; no code changes are needed in the RunGrass shader.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a071b39a-c3ae-4459-8fe2-f7cc3f9ab8c2

📥 Commits

Reviewing files that changed from the base of the PR and between 09804fd and 69bb977.

📒 Files selected for processing (2)
  • CMakeLists.txt
  • package/Shaders/RunGrass.hlsl
🚧 Files skipped from review as they are similar to previous changes (1)
  • CMakeLists.txt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/Features/ScreenSpaceGI.cpp (1)

758-761: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix half-resolution SSGI NRD input handling.

SSGI_HALF computes checkerboard pxCoord from the compact dtid, but uavs.at(0) still receives the full-resolution texNRDInput. This places samples only in the left half of the NRD input and can carry over stale pixels. Clear texNRDInput before half-resolution dispatch and map the generated SSGI samples back to their original checkerboard positions, or move the entire SSGI/NRD pipeline onto one consistent half-width texture/format.

🤖 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 `@src/Features/ScreenSpaceGI.cpp` around lines 758 - 761, Update the SSGI_HALF
dispatch path so texNRDInput is cleared before use and generated samples are
written to their original checkerboard positions rather than the compact
left-half coordinates. Keep the full-resolution path unchanged, and ensure stale
NRD input pixels cannot persist between half-resolution dispatches.
features/IBL/Shaders/IBL/IBL.hlsli (2)

152-162: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply DALCMode consistently in both convenience helpers.

GetIBLColor and GetIBLColorOccluded always use GetEnvIBLColor. When DALCMode >= 2, the main diffuse path uses vanilla DALC instead. This makes these helpers ignore the DALC + Sky mode.

VolumetricFogLightScatteringCS.hlsl calls GetIBLColorOccluded, so volumetric fog can use a different environment source from the main diffuse path. The new setting is documented to affect the environment/DALC contribution. (raw.githubusercontent.com)

Select the same DALC or environment source in both helpers. Use a shared helper, or pass the caller's vanilla DALC value into these functions.

Proposed direction
 float3 GetIBLColor(float3 rayDir)
 {
-	return GetEnvIBLColor(rayDir) + GetSkyIBLColor(rayDir);
+	float3 envColor = SharedData::iblSettings.DALCMode >= 2 ?
+		Color::IrradianceToLinear(Color::Ambient(max(0, SharedData::GetAmbient(rayDir))) *
+		                          SharedData::iblSettings.DALCAmount) :
+		GetEnvIBLColor(rayDir);
+	return envColor + GetSkyIBLColor(rayDir);
 }
🤖 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 `@features/IBL/Shaders/IBL/IBL.hlsli` around lines 152 - 162, Update
GetIBLColor and GetIBLColorOccluded to select the environment or vanilla DALC
source consistently with the main diffuse path when
SharedData::iblSettings.DALCMode is at least 2. Reuse a shared source-selection
helper or accept the caller’s vanilla DALC value, while preserving each helper’s
existing sky contribution and visibility handling.

119-129: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the irradiance color-space conversions.

GetDiffuseIBL and GetDiffuseIBLOccluded assign the DALC value directly to linEnv and return the sum without the irradiance transfer functions. GetFogIBLColor makes the same raw DALC addition. This mixes source-space and linear-space values and changes IBL and fog brightness.

The preceding implementation used Color::IrradianceToLinear for DALC and Color::IrradianceToGamma after diffuse accumulation. (raw.githubusercontent.com)

Proposed fix
-			linEnv = vanillaDALC * SharedData::iblSettings.DALCAmount;
+			linEnv = Color::IrradianceToLinear(vanillaDALC * SharedData::iblSettings.DALCAmount);
...
-		return linEnv + linSky;
+		return Color::IrradianceToGamma(linEnv + linSky);

Apply the same changes in GetDiffuseIBLOccluded, and restore the conversion in GetFogIBLColor:

-			iblColor = dalc0 * SharedData::iblSettings.DALCAmount + GetSkyIBLColor(float3(0, 0, 0));
+			iblColor = Color::IrradianceToLinear(dalc0 * SharedData::iblSettings.DALCAmount) + GetSkyIBLColor(float3(0, 0, 0));

Also applies to: 138-145, 177-177

🤖 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 `@features/IBL/Shaders/IBL/IBL.hlsli` around lines 119 - 129, Restore the
irradiance color-space conversions in GetDiffuseIBL, GetDiffuseIBLOccluded, and
GetFogIBLColor: convert DALC values with Color::IrradianceToLinear before adding
them to linear environment lighting, and apply Color::IrradianceToGamma to the
accumulated diffuse result before returning it. Preserve the existing occlusion,
sky, and fog calculations while ensuring all DALC contributions use the same
transfer functions as the preceding implementation.
🧹 Nitpick comments (1)
features/IBL/Shaders/IBL/IBL.hlsli (1)

13-14: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Update the PR metadata to match the repository convention.

The current title is feat: new SSGI and SSR + NRD. (github.com)

Use a title such as feat(rendering): add nrd, ssgi, and ssr. If an issue tracks this feature, add Implements #<issue> or Fixes #<issue> to the PR description.

As per path instructions: use type(scope): description titles and add issue references when applicable.

🤖 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 `@features/IBL/Shaders/IBL/IBL.hlsli` around lines 13 - 14, Update the pull
request metadata rather than the shader code: rename the PR title to follow the
type(scope): description convention, such as “feat(rendering): add nrd, ssgi,
and ssr,” and add an “Implements #<issue>” or “Fixes #<issue>” reference to the
description when a tracking issue exists.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@features/IBL/Shaders/IBL/IBL.hlsli`:
- Around line 152-162: Update GetIBLColor and GetIBLColorOccluded to select the
environment or vanilla DALC source consistently with the main diffuse path when
SharedData::iblSettings.DALCMode is at least 2. Reuse a shared source-selection
helper or accept the caller’s vanilla DALC value, while preserving each helper’s
existing sky contribution and visibility handling.
- Around line 119-129: Restore the irradiance color-space conversions in
GetDiffuseIBL, GetDiffuseIBLOccluded, and GetFogIBLColor: convert DALC values
with Color::IrradianceToLinear before adding them to linear environment
lighting, and apply Color::IrradianceToGamma to the accumulated diffuse result
before returning it. Preserve the existing occlusion, sky, and fog calculations
while ensuring all DALC contributions use the same transfer functions as the
preceding implementation.

In `@src/Features/ScreenSpaceGI.cpp`:
- Around line 758-761: Update the SSGI_HALF dispatch path so texNRDInput is
cleared before use and generated samples are written to their original
checkerboard positions rather than the compact left-half coordinates. Keep the
full-resolution path unchanged, and ensure stale NRD input pixels cannot persist
between half-resolution dispatches.

---

Nitpick comments:
In `@features/IBL/Shaders/IBL/IBL.hlsli`:
- Around line 13-14: Update the pull request metadata rather than the shader
code: rename the PR title to follow the type(scope): description convention,
such as “feat(rendering): add nrd, ssgi, and ssr,” and add an “Implements
#<issue>” or “Fixes #<issue>” reference to the description when a tracking issue
exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c3e93426-991a-42b9-bce1-304dd76cfd87

📥 Commits

Reviewing files that changed from the base of the PR and between 69bb977 and 25fe1d2.

📒 Files selected for processing (15)
  • CMakeLists.txt
  • features/IBL/Shaders/Features/ImageBasedLighting.ini
  • features/IBL/Shaders/IBL/IBL.hlsli
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • package/Shaders/Common/SharedData.hlsli
  • package/Shaders/Lighting.hlsl
  • package/Shaders/RunGrass.hlsl
  • package/Shaders/Water.hlsl
  • src/Deferred.cpp
  • src/Feature.cpp
  • src/FeatureBuffer.cpp
  • src/Features/IBL.cpp
  • src/Features/ScreenSpaceGI.cpp
  • src/Globals.cpp
  • src/Globals.h
🚧 Files skipped from review as they are similar to previous changes (13)
  • features/IBL/Shaders/Features/ImageBasedLighting.ini
  • src/Globals.cpp
  • src/FeatureBuffer.cpp
  • package/Shaders/Lighting.hlsl
  • src/Features/IBL.cpp
  • package/Shaders/Common/SharedData.hlsli
  • package/Shaders/Water.hlsl
  • package/SKSE/Plugins/CommunityShaders/Translations/en.json
  • src/Globals.h
  • package/Shaders/RunGrass.hlsl
  • src/Feature.cpp
  • CMakeLists.txt
  • src/Deferred.cpp

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.

4 participants