Skip to content

fix(water): TAA water black edge line#2489

Closed
davo0411 wants to merge 2 commits into
community-shaders:devfrom
davo0411:fix/taa-water-black-edge
Closed

fix(water): TAA water black edge line#2489
davo0411 wants to merge 2 commits into
community-shaders:devfrom
davo0411:fix/taa-water-black-edge

Conversation

@davo0411

@davo0411 davo0411 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 8, 2026 10:57

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces height-aware wetness effects for water simulation by adding a new HLSL shader header with displacement-based cavity detection, gradient normal computation, and pool mask shaping logic, alongside C++ allocation of TAA water history render targets to store the computed effects.

Changes

Height-Aware Wetness Effects and TAA Water Rendering

Layer / File(s) Summary
Displacement height sampling and cavity detection
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli
Introduces GetHeightAwareDistanceFade, SampleMeshDisplacementHeight, GetMeshHeightCavity, and terrain/mesh gradient normal functions using ddx/ddy neighborhood sampling to detect pooling cavities and compute height-gradient normals for tangent-space normal mapping.
Pool masks and puddle/raindrop effects
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli
Converts raw cavity and distance fade into a neutral/peak/depression pool mask via lerp(0.5, cavity, distanceFade), applies the mask to scale puddle intensity, and generates raindrop height placement from pool mask and flatness parameters.
Height gradient normal blending
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli
Blends incoming wetness normals toward height-gradient normals scaled by wetnessPuddleDepth * distanceFade * 0.65, with early-exit for minimal depths; closes shader header guards.
TAA water history render targets
src/Deferred.cpp
Allocates kWATER_1 and kWATER_2 as RGBA16 float render targets with shader resource binding; alpha channel stores premultiplied coverage for water blending passes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • doodlum
  • jiayev
  • alandtse

Poem

🐰 A shader sprite hops through terrain deep,
sampling heights where puddles seep.
With gradients dancing and normals bent,
the wetness flows—through pixels, down, spent.
Pools form cavities, droplets gleam,
in TAA's blur of a water dream. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix(water): TAA water black edge line' is somewhat vague and does not clearly convey the substantial changes made, which include adding height-aware wetness effects and TAA water history buffers. Consider clarifying the title to better reflect the main changes, such as 'fix(water): Add height-aware wetness effects and TAA water history buffers' or similar to make the scope of changes clearer.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.22.0)

OpenGrep fatal error (exit code 2): [00.12][ERROR]: Error: exception Unix_error: No such file or directory stat src/Deferred.cpp
Raised by primitive operation at UTmp.replace_named_pipe_by_regular_file_if_needed in file "libs/commons/UTmp.ml", line 145, characters 8-27
Called from Scan_CLI.replace_target_roots_by_regular_files_where_needed.(fun) in file "src/osemgrep/cli_scan/Scan_CLI.ml", lines 1086-1087, characters 19-65
Called from List_.fast_map in file "libs/commons/List_.ml", line 81, characters 17-20
Called from Scan_CLI.re

🔧 Infer (1.2.0)
src/Deferred.cpp

Usage Error: Failed to execute compilation command:
'/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/clang/install/bin/clang++'
-c src/Deferred.cpp -o /tmp/coderabbit-infer/9aac6da5ffddefdc/file.o

Error message:
clang++: error: no such file or directory: 'src/Deferred.cpp'

*** Infer needs a working compilation command to run.


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

github-actions Bot commented Jun 8, 2026

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: 1

🧹 Nitpick comments (1)
src/Deferred.cpp (1)

114-116: ⚡ Quick win

Add an issue-closing keyword in the PR description (if tracked).

Since this PR is a bug fix, please add a reference like Fixes #<id> / Closes #<id> when there is a linked issue.

As per coding guidelines, bug-fix PRs should include issue references using 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/Deferred.cpp` around lines 114 - 116, Update the PR description to
include a GitHub issue-closing keyword referencing the tracked bug (e.g., add
"Fixes #<id>" or "Closes #<id>") so the fix in Deferred.cpp (see
SetupRenderTarget calls for RE::RENDER_TARGETS::kWATER_1 and kWATER_2) will
automatically close the linked issue; if there are multiple related issues list
each with its own keyword and ensure the PR description is saved/updated before
merge.

Source: Coding guidelines

🤖 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/Wetness` Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli:
- Around line 57-68: GetTerrainHeightGradientNormal currently performs an unused
center height sample (hCenter) causing an extra texture fetch; remove the
hCenter declaration and its SampleTerrainDisplacementHeight call from
GetTerrainHeightGradientNormal so only the neighbor samples (used to compute hX
and hY) remain, leaving the ddx/ddy, hX/hY computation and final normalization
(mul(tbn, gradTS)) unchanged; verify no other references to hCenter in that
function.

---

Nitpick comments:
In `@src/Deferred.cpp`:
- Around line 114-116: Update the PR description to include a GitHub
issue-closing keyword referencing the tracked bug (e.g., add "Fixes #<id>" or
"Closes #<id>") so the fix in Deferred.cpp (see SetupRenderTarget calls for
RE::RENDER_TARGETS::kWATER_1 and kWATER_2) will automatically close the linked
issue; if there are multiple related issues list each with its own keyword and
ensure the PR description is saved/updated before merge.
🪄 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: 7c2f3e29-58be-45a5-aab8-d8e9db44cb16

📥 Commits

Reviewing files that changed from the base of the PR and between b74dedf and 92e1d19.

📒 Files selected for processing (2)
  • features/Wetness Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli
  • src/Deferred.cpp

Comment thread features/Wetness Effects/Shaders/WetnessEffects/WetnessEffectsHeight.hlsli Outdated
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

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

@doodlum doodlum closed this Jun 8, 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.

3 participants