Skip to content

feat: add raindrop ripples on water#577

Merged
doodlum merged 22 commits into
community-shaders:devfrom
TheRiverwoodModder:dev-optimized
Jun 18, 2025
Merged

feat: add raindrop ripples on water#577
doodlum merged 22 commits into
community-shaders:devfrom
TheRiverwoodModder:dev-optimized

Conversation

@TheRiverwoodModder
Copy link
Copy Markdown
Contributor

@TheRiverwoodModder TheRiverwoodModder commented Sep 30, 2024

Added the raindrop ripple effect to water:

  • Expanded the range of the effect on water by 3 which did not have a noticable impact on performance
  • Added rippleStrengthModifyer which is used for skylighting-based occlusion and distance-based fade out
  • Added a transparent waterrainripples.dds to remove the vanilla water raindrop effect
  • Removed the (defined(FLOWMAP) && !defined(BLEND_NORMALS)) check which was breaking vanilla and did not appear to have a benefit in my testing

Summary by CodeRabbit

  • New Features
    • Added option to enable or disable Skyrim's default water ripples alongside wetness effects.
    • Introduced settings to control vanilla ripple activation and raindrop effect range.
    • Updated UI to include controls for vanilla ripples, with compatibility awareness for certain mods.
    • Enhanced ripple visuals with varied ripple sizes and flow-aware ripple positioning for more natural water effects.
    • Added debug visualization options for wetness and ripple effects to assist with development and tuning.
  • Refactor
    • Improved shader behavior to better handle specific environmental conditions.

Copy link
Copy Markdown
Collaborator

@alandtse alandtse left a comment

Choose a reason for hiding this comment

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

What's the source of the dds file?

@TheRiverwoodModder
Copy link
Copy Markdown
Contributor Author

TheRiverwoodModder commented Sep 30, 2024

What's the source of the dds file?

It is just a blank 32x32 image that I created. It overwrites the one vanilla uses to show the default rain ripple effect.

@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Sep 30, 2024

I feel that this needs more work

Comment thread features/Wetness Effects/textures/water/waterrainripples.dds Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2025

Walkthrough

The wetness effects shader function GetRainDrops was extended with optional parameters for ripple strength modification and flow-aware ripple offset, including per-ripple size variation. Debug visualization functions were added. The WetnessEffectsSettings struct gained new members for vanilla ripple control. The WetnessEffects feature added settings, UI controls, runtime hooking for vanilla ripples, and compatibility checks for the "Splashes of Storms" mod.

Changes

File(s) Change Summary
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli Modified GetRainDrops signature; added ripple size variation and flow-aware offset; added debug visualization functions; refined preprocessor condition in GetWetnessAmbientSpecular.
package/Shaders/Common/SharedData.hlsli Added EnableVanillaRipples (uint) and RaindropFxRange (float) to WetnessEffectsSettings; changed pad0 from float3 to float.
src/Features/WetnessEffects.cpp Added vanilla ripple toggle settings, UI controls, cached ripple state, thunk hook for splash toggling, and compatibility check for "Splashes of Storms" mod.
src/Features/WetnessEffects.h Extended WetnessEffects::Settings with ripple-related members; increased default RippleLifetime; added virtual methods (PostPostLoad(), GetFeatureModLink(), DrawUnloadedUI()); added private mod detection flag; reduced padding in PerFrame struct.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WetnessEffectsFeature
    participant WaterSystem

    User->>WetnessEffectsFeature: Toggle EnableVanillaRipples checkbox
    WetnessEffectsFeature->>WetnessEffectsFeature: UpdateSettings() caches ripple states
    WetnessEffectsFeature->>WaterSystem: ToggleWaterSplashes thunk intercepts splash toggling
    WaterSystem-->>WetnessEffectsFeature: Splash toggle modified based on cached settings
Loading

Poem

Raindrops ripple with strength anew,
A modifier now in shaders grew.
Wetness gleams, but only when
Water’s not defined, my friend!
Vanilla ripples toggle with care,
Compatibility checks are there.
A bunny’s touch on rain and splash,
Code flows forward, smooth and rash.
🐇💧


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c8407da and 6f21811.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Water.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (1)
  • features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli
⏰ Context from checks skipped due to timeout of 90000ms (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

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

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

@alandtse
Copy link
Copy Markdown
Collaborator

alandtse commented Jun 8, 2025

Ok current status:

  • Vanilla ripples start disabled and can be toggled on. But they're not toggling back off.
  • I can't see the actual effect from ripples. It may have been broken by feat: better rain fx #744 or other changes
  • Removed dds since we're disabling in engine.

Not ready to merge yet, but much closer.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4450145 and 1a5c8d4.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Water.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (3)
  • package/Shaders/Common/SharedData.hlsli (1 hunks)
  • src/Features/WetnessEffects.cpp (5 hunks)
  • src/Features/WetnessEffects.h (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (6)
src/Features/WetnessEffects.cpp (6)

33-74: Well-implemented runtime hooking with proper attribution.

The Ripples namespace implementation correctly:

  • Caches settings to avoid performance overhead
  • Properly intercepts water splash toggling through thunk hooking
  • Includes appropriate attribution to the original MIT-licensed code

76-86: Excellent mod compatibility handling.

The implementation properly detects the "Splashes of Storms" mod and conditionally installs hooks to avoid conflicts. The logging provides clear feedback about the compatibility state.


91-93: Proper cache synchronization on settings change.

Good practice to update the cached values immediately when settings change.


119-131: Excellent UI implementation with clear user feedback.

The implementation provides great user experience by:

  • Disabling the control when managed by external mod
  • Showing descriptive label explaining why it's disabled
  • Maintaining proper cache synchronization

349-349: Correct cache synchronization after loading settings.


362-376: Well-designed unloaded feature UI.

The UI clearly communicates that the feature is not installed and provides a good overview of what it offers.

Comment thread package/Shaders/Common/SharedData.hlsli Outdated
Comment thread src/Features/WetnessEffects.h
Comment thread src/Features/WetnessEffects.cpp
@alandtse alandtse self-requested a review June 8, 2025 11:13
alandtse and others added 3 commits June 8, 2025 04:14
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
Comment thread package/Shaders/Common/SharedData.hlsli
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2025

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

3 similar comments
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2025

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2025

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2025

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

@alandtse
Copy link
Copy Markdown
Collaborator

alandtse commented Jun 8, 2025

@doodlum Ok, confirmed vanilla rain ripples can be disabled by the setting. Enabling is like instant and depends on the water. Disabling may take a change of location/weather to see.

I also tweaked the lifetime. The .15 looked really unrealistic to me, but .5 secs seems better. May want to based it off a vanilla weather setting though.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2025

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

@alandtse alandtse requested a review from doodlum June 10, 2025 03:27
Copy link
Copy Markdown
Collaborator

@doodlum doodlum left a comment

Choose a reason for hiding this comment

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

.

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

🧹 Nitpick comments (2)
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli (2)

112-118: Deterministic size randomisation is biased

sizeRandom = frac(dot(floatHash.xy, float2(12.9898, 78.233)));

floatHash.xy are already high-quality random values. A linear-dot/frac pair collapses the 2-D entropy to 1-D and can introduce visible banding on large water bodies.

Use the existing Random::pcg utilities (or hash the timestep) to keep full 32-bit entropy:

uint sizeHash = Random::iqint3(hash.xy);
float sizeRandom = (float)sizeHash * uintToFloat;

178-258: Debug helpers: mark inline to avoid code bloat

These helpers are great, but each call currently emits a standalone function body.
Prefix them with inline (or static inline) to ensure they are inlined and discarded
when DEBUG_WETNESS_EFFECTS is undefined.

-float2 GetDebugEffectIntensities(...)
+inline float2 GetDebugEffectIntensities(...)

-float3 GetDebugWetnessColor(...)
+inline float3 GetDebugWetnessColor(...)

...
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f0dd6e and 90ffd50.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Water.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (2)
  • features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli (4 hunks)
  • src/Features/WetnessEffects.h (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Features/WetnessEffects.h
⏰ Context from checks skipped due to timeout of 90000ms (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
🔇 Additional comments (3)
features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli (3)

146-156: Guard change looks correct

Adding !defined(WATER) prevents the dynamic cubemap path from firing for water
passes, reducing GPU cost and eliminating self-reflection artefacts.
Good catch.


59-61: ```shell
#!/bin/bash
set -e

Locate the HLSL file

fd WetnessEffects.hlsli

Show context around worldPos usage

echo "=== worldPos usage ==="
rg -n 'worldPos' -C 5 "features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli"

Show context around ripple logic

echo "=== ripple usage ==="
rg -n 'ripple' -C 5 "features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli"

Show context around splash logic

echo "=== splash usage ==="
rg -n 'splash' -C 5 "features/Wetness Effects/Shaders/WetnessEffects/WetnessEffects.hlsli"


---

`274-291`: ```shell
#!/bin/bash
rg -n "GetFlowAwareRippleOffset" .
rg -n "reflectionTimingScale" .

@alandtse
Copy link
Copy Markdown
Collaborator

I'm going to look at whether we can extend ripples/splashes longer on water since you're right they don't last long enough and can seem weird.

Copy link
Copy Markdown
Collaborator

@doodlum doodlum left a comment

Choose a reason for hiding this comment

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

Approved! Flow I think has some grid alignment issues but its barely noticeable

@doodlum doodlum merged commit 7063f74 into community-shaders:dev Jun 18, 2025
12 checks passed
alandtse added a commit that referenced this pull request Jun 20, 2025
* feat: add raindrop ripples on water

* style: 🎨 apply clang-format changes

* feat: ripple effect now supports water parallax

* style: 🎨 apply clang-format changes

* fix: fix compilation errors

* fix: fix wrong type

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: sync cache on defaults

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: vanilla ripple display

* refactor:  add flowmap functions

* feat: add flow maps to ripples

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: fix ripple and splash flows

* fix: remove dupe GetFeatureModLink

* style: fix lint

* refactor: address further ai comments

* fix: avoid entropy collapse in ripple hash

* style: restore function names and lines

---------

Co-authored-by: TheRiverwoodModder <TheRiverwoodModder@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
davo0411 pushed a commit to davo0411/skyrim-community-shaders that referenced this pull request Jun 21, 2025
* feat: add raindrop ripples on water

* style: 🎨 apply clang-format changes

* feat: ripple effect now supports water parallax

* style: 🎨 apply clang-format changes

* fix: fix compilation errors

* fix: fix wrong type

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: sync cache on defaults

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: vanilla ripple display

* refactor:  add flowmap functions

* feat: add flow maps to ripples

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: fix ripple and splash flows

* fix: remove dupe GetFeatureModLink

* style: fix lint

* refactor: address further ai comments

* fix: avoid entropy collapse in ripple hash

* style: restore function names and lines

---------

Co-authored-by: TheRiverwoodModder <TheRiverwoodModder@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
alandtse added a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
* feat: add raindrop ripples on water

* style: 🎨 apply clang-format changes

* feat: ripple effect now supports water parallax

* style: 🎨 apply clang-format changes

* fix: fix compilation errors

* fix: fix wrong type

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: sync cache on defaults

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: vanilla ripple display

* refactor:  add flowmap functions

* feat: add flow maps to ripples

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

* fix: fix ripple and splash flows

* fix: remove dupe GetFeatureModLink

* style: fix lint

* refactor: address further ai comments

* fix: avoid entropy collapse in ripple hash

* style: restore function names and lines

---------

Co-authored-by: TheRiverwoodModder <TheRiverwoodModder@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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