Skip to content

feat: terrain blending ready for release#1405

Merged
doodlum merged 7 commits into
devfrom
terrain-blending-ready
Aug 17, 2025
Merged

feat: terrain blending ready for release#1405
doodlum merged 7 commits into
devfrom
terrain-blending-ready

Conversation

@doodlum
Copy link
Copy Markdown
Collaborator

@doodlum doodlum commented Aug 17, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Terrain blending now uses a noise-influenced, smoothed per-pixel blend for more natural transitions and reduced visual artifacts (including excessive gloss).
  • Chores
    • Removed an obsolete Terrain Blending deprecation entry to reduce unnecessary warnings and streamline issue reporting.
    • Project version updated to 1.3.5.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 17, 2025

Walkthrough

Updated terrain blending in the pixel shader to compute a per-pixel stochastic blend (used for NormalGlossiness.w and Albedo.w); removed the TerrainBlending entry from the obsolete feature map; bumped project version in CMakeLists from 1.3.4 to 1.3.5. No public API changes.

Changes

Cohort / File(s) Summary
Shader terrain blending logic
package/Shaders/Lighting.hlsl
Replaced fixed TERRAIN_BLENDING weight with a per-pixel stochasticBlend computed from screenNoise and blendFactorTerrain (smoothed via lerp(..., 0.1)); applied to psout.NormalGlossiness.w and psout.Albedo.w.
Feature issue registry update
src/FeatureIssues.cpp
Removed the TerrainBlending entry from the s_obsoleteFeatureData static initializer; internal data change only, no API/signature changes.
Project metadata
CMakeLists.txt
Bumped project VERSION from 1.3.4 to 1.3.5 in the project(...) declaration.

Sequence Diagram(s)

sequenceDiagram
  participant PS as Pixel Shader
  participant SN as screenNoise
  participant BF as blendFactorTerrain
  participant OUT as psout

  PS->>SN: sample screenNoise
  PS->>BF: read blendFactorTerrain
  PS->>PS: compute stochasticBlend = lerp(screenNoise, blendFactorTerrain, 0.1)
  PS->>OUT: set NormalGlossiness.w = stochasticBlend
  PS->>OUT: set Albedo.w = stochasticBlend
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • jiayev

Poem

A hop, a pixel, a noisy tune,
I scatter blends beneath the moon.
Old flags dropped, new lerps take flight,
I nibble artifacts into light.
Thump—stochastic fields delight! 🐇✨


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e212255 and 1355d47.

📒 Files selected for processing (1)
  • CMakeLists.txt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CMakeLists.txt
⏰ 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). (3)
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
  • GitHub Check: Build plugin and addons
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch terrain-blending-ready

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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: 2a9e819
Using base ref: 2a9e819
Base commit date: 2025-08-16T00:16:27-07:00 (Saturday, August 16, 2025 12:16 AM)
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 (2)
package/Shaders/Lighting.hlsl (2)

3380-3385: Stochastic terrain alpha looks good; verify alpha consistency across all GBuffer targets

Nice improvement switching to a noise-thresholded alpha and lightly biasing toward the analytic factor. One concern: only NormalGlossiness.w and Albedo.w are switched to the new stochastic value, while psout.Diffuse.w remains the analytic blendFactorTerrain. Earlier in the deferred path, several targets’ .w channels (e.g., MotionVectors.zw pack psout.Diffuse.w; Specular.w, Reflectance.w, Masks.w, and SNOW Parameters.w) are set from psout.Diffuse.w before this block.

If downstream passes assume the terrain-blend alpha is consistent across GBuffer attachments, these divergent alphas can produce subtle edge artifacts or halos. Please verify the consumer expectations and, if necessary, unify:

  • Option A (preferred): Compute stochasticBlend immediately after blendFactorTerrain is computed (near Lines 1020–1033) and set psout.Diffuse.w to it before any target writes; keep NormalGlossiness/Albedo referencing psout.Diffuse.w as before; remove this late override.
  • Option B: If you intend different alphas per target, add a brief comment explaining the rationale to prevent future regressions.

Also, since screenNoise includes FrameCount, the dither pattern is animated. That’s usually fine with TAA, but can shimmer when TAA is off. Consider gating the temporal component or using a blue-noise sequence if you see visible flicker.


3381-3384: Minor: prefer step() and name the smoothing constant

Pure nit, but step() reads a bit clearer and avoids a conditional; also, name the smoothing to make it tunable.

Apply this diff within this block:

- float stochasticBlend = screenNoise < blendFactorTerrain ? 1.0 : 0.0;
- stochasticBlend = lerp(stochasticBlend, blendFactorTerrain, 0.1);
+ const float kTerrainBlendSmoothing = 0.1;
+ float stochasticBlend = step(screenNoise, blendFactorTerrain);
+ stochasticBlend = lerp(stochasticBlend, blendFactorTerrain, kTerrainBlendSmoothing);
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a9e819 and c12d3f7.

📒 Files selected for processing (2)
  • package/Shaders/Lighting.hlsl (1 hunks)
  • src/FeatureIssues.cpp (0 hunks)
💤 Files with no reviewable changes (1)
  • src/FeatureIssues.cpp
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-03T18:37:19.690Z
Learnt from: jiayev
PR: doodlum/skyrim-community-shaders#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/Lighting.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). (3)
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
  • GitHub Check: Build plugin and addons

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 17, 2025

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

@doodlum doodlum merged commit 38008a1 into dev Aug 17, 2025
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Sep 22, 2025
@alandtse alandtse deleted the terrain-blending-ready branch February 6, 2026 05:20
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.

1 participant