Skip to content

fix(LL): pbr specular brightness with dalc#1695

Closed
Dlizzio wants to merge 1 commit into
community-shaders:devfrom
Dlizzio:linear+pbr+dalc-specular-fix
Closed

fix(LL): pbr specular brightness with dalc#1695
Dlizzio wants to merge 1 commit into
community-shaders:devfrom
Dlizzio:linear+pbr+dalc-specular-fix

Conversation

@Dlizzio
Copy link
Copy Markdown
Contributor

@Dlizzio Dlizzio commented Jan 12, 2026

The Problem:
When using Linear Lighting with PBR materials and DALC instead of IBL, surfaces appeared too shiny/glossy - especially metals. Everything had an excessive "wet look" or mirror-like sheen.

Solution:

  1. ReflectionNormalisationScale is now always 0.65 instead of switching between 1.0 (with Linear Lighting) and 0.65 (without).

Turns down the overall reflection brightness from 100% to 65% with DALC.

  1. Added Color::Ambient() around the DALC (Directional Ambient Lighting Color) calculation.

Made sure the ambient light feeding into reflections goes through the same "dimming filter" that other parts of the lighting system use.

Summary by CodeRabbit

  • Refactor
    • Simplified reflection normalization constant handling across rendering configurations
    • Updated ambient color calculation method in the rendering pipeline for improved consistency

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

… using Linear Lighting without IBL.

The Problem:
When using Linear Lighting with PBR materials and DALC instead of IBL, surfaces appeared too shiny/glossy - especially metals. Everything had an excessive "wet look" or mirror-like sheen.

Solution:
1) ReflectionNormalisationScale is now always 0.65 instead of switching between 1.0 (with Linear Lighting) and 0.65 (without).

Turns down the overall reflection brightness from 100% to 65% with DALC.

2) Added Color::Ambient() around the DALC (Directional Ambient Lighting Color) calculation.

Made sure the ambient light feeding into reflections goes through the same "dimming filter" that other parts of the lighting system use.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

Two shader files are modified: a constant in the Color namespace is changed from a conditional value to a fixed value of 0.65, and the directional ambient color specular computation is wrapped with a Color::Ambient function before luminance calculation.

Changes

Cohort / File(s) Summary
Shader Constants & Lighting
package/Shaders/Common/Color.hlsli
ReflectionNormalisationScale constant changed from conditional (ENABLE_LL ? 1.0 : 0.65) to fixed value 0.65, removing compile-time dependency
Deferred Composite Rendering
package/Shaders/DeferredCompositeCS.hlsl
directionalAmbientColorSpecular computation wrapped with Color::Ambient() function before luminance calculation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • chore: gamma space normalisation #1535: Modifies identical shader files (Color.hlsli and DeferredCompositeCS.hlsl) with the same constant and luminance computation changes.
  • feat: linear lighting #1359: Updates Color namespace constants and ambient-to-Color::Ambient luminance usage patterns affecting the same shader infrastructure.
  • perf(ssgi): optimize  #1499: Alters directional ambient computation in DeferredCompositeCS.hlsl that relates to the same SSGI and ambient integration logic.

Suggested reviewers

  • doodlum
  • alandtse

Poem

🐰 A constant held steady, no longer a choice,
From one-point-zero down, let ambient rejoice!
With Color::Ambient wrapped 'round the glow,
These shader tweaks dance with a luminous flow ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing PBR specular reflections specifically when using Linear Lighting with DALC, which matches the core objectives of reducing reflection brightness and applying ambient filtering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Using provided base ref: 94f854f
Using base ref: 94f854f
Base commit date: 2026-01-12T11:16:56+10:00 (Monday, January 12, 2026 11:16 AM)
No actionable suggestions for changed features.

@davo0411 davo0411 changed the title Fixes the PBR specular reflections when using Linear Lighting with DALC. fix(LL): pbr specular brightness when using linear lighting with dalc Jan 12, 2026
@davo0411 davo0411 changed the title fix(LL): pbr specular brightness when using linear lighting with dalc fix(LL): pbr specular brightness with dalc Jan 12, 2026
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)
package/Shaders/DeferredCompositeCS.hlsl (1)

174-174: Logic is correct – specular DALC now matches diffuse handling.

Wrapping with Color::Ambient() ensures specular reflections receive the same gamma/dimming treatment as the diffuse ambient calculation on line 121. This should resolve the excessive shininess issue.

Minor nit: this line uses spaces for indentation while surrounding code uses tabs.

🔧 Suggested fix for indentation consistency
-        float directionalAmbientColorSpecular = Color::RGBToLuminance(Color::Ambient(max(0, mul(SharedData::DirectionalAmbient, float4(R, 1.0))))) * Color::ReflectionNormalisationScale;
+	float directionalAmbientColorSpecular = Color::RGBToLuminance(Color::Ambient(max(0, mul(SharedData::DirectionalAmbient, float4(R, 1.0))))) * Color::ReflectionNormalisationScale;
📜 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 94f854f and a9d7f61.

📒 Files selected for processing (2)
  • package/Shaders/Common/Color.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
🧰 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:

  • package/Shaders/Common/Color.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
**/*

⚙️ CodeRabbit configuration file

**/*: When reviewing PRs, please provide suggestions for:

  1. Conventional Commit Titles (if not following https://www.conventionalcommits.org/ or
    if the existing title does not describe the code changes):
    Format: type(scope): description
    Length: 50 characters limit for title, 72 for body
    Style: lowercase description, no ending period
    Examples:

    • feat(vr): add cross-eye sampling
    • fix(water): resolve flowmap bug
    • docs: update shader documentation
  2. Issue References (if PR fixes bugs or implements features):
    Suggest adding appropriate GitHub keywords:

    • "Fixes #123" or "Closes #123" for bug fixes
    • "Implements #123" or "Addresses #123" for features
    • "Related to #123" for partial implementations

Otherwise, use your standard review approach focusing on code quality.

Files:

  • package/Shaders/Common/Color.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
🧠 Learnings (7)
📓 Common learnings
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: src/Features/SnowCover.cpp:515-515
Timestamp: 2025-10-02T14:20:33.454Z
Learning: In the Community Shaders codebase (skyrim-community-shaders repository), hardcoded shader resource slot numbers are used directly in code rather than being defined as named constants. This is the established convention and should not be flagged as an issue.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 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.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent 4-byte size, proper 16-byte alignment in constant buffers, and cross-platform compatibility when passing data between C++ and HLSL shaders.
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 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
Repo: doodlum/skyrim-community-shaders PR: 577
File: src/Features/WetnessEffects.h:36-36
Timestamp: 2025-06-08T11:25:14.536Z
Learning: In the skyrim-community-shaders project, boolean flags in C++ structs that interface with HLSL shaders use `uint` type instead of `bool` for compatibility reasons. This ensures consistent size, alignment, and cross-platform compatibility when passing data to shader constant buffers.
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: src/Features/SnowCover.cpp:260-260
Timestamp: 2025-08-05T18:13:03.123Z
Learning: In the skyrim-community-shaders SnowCover feature, the time calculation uses division by 61.0 instead of 60.0 for seconds conversion in the perFrame.Month calculation. The original author ThePagi indicated this was intentional and makes no discernible difference to the snow cover functionality, suggesting it may be related to game-specific timing mechanics or balance considerations.
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-18T15:21:03.641Z
Learning: In the skyrim-community-shaders rendering pipeline, materials with alpha < 1 or alpha blending enabled are rendered in non-deferred mode rather than deferred mode. This means issues with dynamic cubemaps on transparent materials are actually non-deferred rendering issues.
📚 Learning: 2025-08-03T18:37:19.690Z
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-08-03T18:37:19.690Z
Learning: ISReflectionsRayTracing.hlsl and ISWorldMap.hlsl in the skyrim-community-shaders repository are image-space post-processing shaders that perform color sampling and blending operations that need proper linear color space handling for the linear lighting system. ISReflectionsRayTracing handles screen-space reflections and should use conditional Color::IrradianceToLinear/Gamma conversions similar to ISCompositeLensFlareVolumetricLighting.hlsl. ISWorldMap performs 7x7 color accumulation that should be done in linear space similar to the pattern used in ISSAOComposite.hlsl.

Applied to files:

  • package/Shaders/Common/Color.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
📚 Learning: 2025-07-01T18:01:07.079Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-01T18:01:07.079Z
Learning: In the skyrim-community-shaders project, simple scalar constants in HLSL shaders use #define (e.g., #define NTHREADS 128), while more complex constants use static const within namespaces (e.g., Math namespace in Math.hlsli). For epsilon standardization, #define is the appropriate choice since epsilon values are simple scalar constants.

Applied to files:

  • package/Shaders/Common/Color.hlsli
📚 Learning: 2025-10-02T14:20:33.454Z
Learnt from: ThePagi
Repo: doodlum/skyrim-community-shaders PR: 1369
File: src/Features/SnowCover.cpp:515-515
Timestamp: 2025-10-02T14:20:33.454Z
Learning: In the Community Shaders codebase (skyrim-community-shaders repository), hardcoded shader resource slot numbers are used directly in code rather than being defined as named constants. This is the established convention and should not be flagged as an issue.

Applied to files:

  • package/Shaders/Common/Color.hlsli
  • package/Shaders/DeferredCompositeCS.hlsl
📚 Learning: 2025-06-17T05:40:22.785Z
Learnt from: alandtse
Repo: doodlum/skyrim-community-shaders PR: 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.

Applied to files:

  • package/Shaders/DeferredCompositeCS.hlsl
📚 Learning: 2025-08-17T18:37:35.839Z
Learnt from: CR
Repo: doodlum/skyrim-community-shaders PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-17T18:37:35.839Z
Learning: Applies to features/*/Shaders/**/*.{hlsl,hlsli,fx,fxh} : Avoid GPU register/buffer conflicts in HLSL; verify register usage (e.g., with hlslkit buffer scanning)

Applied to files:

  • package/Shaders/DeferredCompositeCS.hlsl
📚 Learning: 2025-07-18T15:21:03.641Z
Learnt from: jiayev
Repo: doodlum/skyrim-community-shaders PR: 0
File: :0-0
Timestamp: 2025-07-18T15:21:03.641Z
Learning: In the skyrim-community-shaders rendering pipeline, materials with alpha < 1 or alpha blending enabled are rendered in non-deferred mode rather than deferred mode. This means issues with dynamic cubemaps on transparent materials are actually non-deferred rendering issues.

Applied to files:

  • package/Shaders/DeferredCompositeCS.hlsl
⏰ 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). (4)
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
  • GitHub Check: Run Shader Unit Tests
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (1)
package/Shaders/Common/Color.hlsli (1)

113-114: LGTM – unified reflection scale regardless of Linear Lighting mode.

The simplification from a conditional to a fixed 0.65 ensures consistent reflection normalization when using DALC. This aligns with the PR objective to reduce the excessive shininess on metallic surfaces.

@github-actions
Copy link
Copy Markdown

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

Comment thread package/Shaders/Common/Color.hlsli
@Dlizzio Dlizzio closed this Jan 12, 2026
@Dlizzio Dlizzio deleted the linear+pbr+dalc-specular-fix branch January 12, 2026 04:43
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