feat: add raindrop ripples on water
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
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.
I feel that this needs more work
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
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 c8407daa1dbec5fa58098940f2d4b9fea74a742a and 6f21811d7508c764f6de3e55d77a605952ccb7dc.
β Files ignored due to path filters (1)
package/Shaders/Water.hlslis 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.
πͺ§ 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
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere 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.
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 #744 or other changes
- Removed dds since we're disabling in engine.
Not ready to merge yet, but much closer.
β A pre-release build is available for this PR: Download
β A pre-release build is available for this PR: Download
β A pre-release build is available for this PR: Download
β A pre-release build is available for this PR: Download
@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.
β A pre-release build is available for this PR: Download
You also have a weird setting. Did you default your settings for ripple lifetime? They don't happen that fast now.
β A pre-release build is available for this PR: Download
@doodlum Flowmap works from my testing, take a look and see if you think it should be disabled by default. That would require some additional work as there's no setting for water ripples yet. DEBUG_WETNESS_EFFECTS to see the flow easier.
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.