Skip to content

fix(emat): fix complex mat detection #2422

Merged
jiayev merged 1 commit into
devfrom
cpm-fix-26526
May 27, 2026
Merged

fix(emat): fix complex mat detection #2422
jiayev merged 1 commit into
devfrom
cpm-fix-26526

Conversation

@jiayev
Copy link
Copy Markdown
Collaborator

@jiayev jiayev commented May 26, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced material detection precision in complex lighting and environment-mapping scenarios through improved sampling accuracy and detail refinement.
    • Tightened parallax effect selection criteria to prevent unintended fallback behavior and ensure more predictable visual results across diverse material configurations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

The shader's EMAT complex-material env-map path refines two related checks: complexMaterial detection now samples at higher mip-level 15 directly, and the complexMaterialParallax condition is tightened to require the mask value within a bounded range rather than only above a lower threshold.

Changes

EMAT Complex-Material Path

Layer / File(s) Summary
Complex-material masking and parallax conditions
package/Shaders/Lighting.hlsl
complexMaterial detection switched to sample at mip-level 15 directly against (1.0 - kMaskEpsilon), and complexMaterialParallax condition now requires envMaskSample.w in the open interval (kMaskEpsilon, 1.0 - kMaskEpsilon) rather than only above the lower bound.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • doodlum

Poem

A shader tweak, precise and small,
Mip-level whispers through the hall,
Epsilon bounds now left and right,
Parallax gleams with clarity bright,
Hop hop 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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.
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.
Title check ✅ Passed The title clearly describes the fix being applied - it addresses complex material detection (abbreviation: 'cm') in the EMAT environment map path by using a higher-detail mip-level sample and tightening the parallax branch conditions.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cpm-fix-26526

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

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.

🧹 Nitpick comments (1)
package/Shaders/Lighting.hlsl (1)

1113-1123: Improve PR metadata clarity and run shader validation before merge.

Suggested title: fix(emat): refine complex-material mask checks

If this maps to a tracked bug, add Fixes #<id> (or Closes #<id>) in the PR description, and run the repository’s hlslkit validation/compilation step for this shader path before merging.

As per coding guidelines, "**/*.hlsl: Use hlslkit for shader validation and compilation during targeted development testing and before deploymentand**/*`: 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 1113 - 1123, Rename the PR to a
clear conventional-commit style title like "fix(emat): refine complex-material
mask checks", add "Fixes #<id>" or "Closes #<id>" in the PR description if this
change resolves a tracked bug, and run the repository's hlslkit
validation/compilation step against package/Shaders/Lighting.hlsl (the code
around complexMaterial, envMaskSample, TexEnvMaskSampler.SampleLevel and
kMaskEpsilon) to ensure the shader compiles cleanly before merging; if
validation reports issues, fix the shader errors reported by hlslkit and re-run
until successful.
🤖 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/Shaders/Lighting.hlsl`:
- Around line 1113-1123: Rename the PR to a clear conventional-commit style
title like "fix(emat): refine complex-material mask checks", add "Fixes #<id>"
or "Closes #<id>" in the PR description if this change resolves a tracked bug,
and run the repository's hlslkit validation/compilation step against
package/Shaders/Lighting.hlsl (the code around complexMaterial, envMaskSample,
TexEnvMaskSampler.SampleLevel and kMaskEpsilon) to ensure the shader compiles
cleanly before merging; if validation reports issues, fix the shader errors
reported by hlslkit and re-run until successful.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b7d5b87-bf09-4115-b7cf-bed798f3ff26

📥 Commits

Reviewing files that changed from the base of the PR and between d7e2fa4 and 4ed7a87.

📒 Files selected for processing (1)
  • package/Shaders/Lighting.hlsl

@doodlum doodlum changed the title fix(cm): complex detecting fix(cm): fix complex mat detect May 26, 2026
@doodlum doodlum changed the title fix(cm): fix complex mat detect fix(emat): fix complex mat detection May 26, 2026
@jiayev jiayev merged commit 66cfa42 into dev May 27, 2026
19 checks passed
@jiayev jiayev deleted the cpm-fix-26526 branch May 27, 2026 03:23
IgorAlanAlbuquerque pushed a commit to IgorAlanAlbuquerque/skyrim-community-shaders that referenced this pull request May 29, 2026
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