Stylized Water 2 [URP] ☑️ Desktop/Mobile/Consoles/VR

I believe, based on your screenshot, you are using included “HighPoly_Plane” mesh, by default, this has 10.200 vertices. If each tile is 1x1 unit in size that would yield 102 million vertices in the scene in total :stuck_out_tongue: If that is the case, using a mesh with fewer vertices is an instant win. A simple quad mesh with 4 vertices would likely be sufficient.

1 Like

Thanks for a great asset.

I have a slight issue - it seems the underwater speed multiplier is not picked up by the underwater extension. Basically the above water caustics move at a different rate to the underwater extension caustics. Have I missed something or is this a bug?

Will it be possible to turn off dynamic effects on some materials. Because we have added a ripple effect to the player when they are in the ocean. But it also appears on the frozen material ocean we have in the environment.

Thanks for bringing this to my attention, this appears to be an oversight on my part! I’ve made a note to correct this. For the time being, you can leave the animation speed to 1, and modify the “Speed multiplier” of the caustics instead.

Ah not quite! On the ice material, you could turn off the Normals feature, and assign a black texture to the Dynamic Effects foam slot (under Surface Foam). This combined, makes the effect virtually invisible on the material. Is that a viable solution?

1 Like

I turned off normals and assigned a black texure but i am still getting ripple effects. In the end i added a trigger box to turn off the effect gameobject attached to the player.

It would be cool if there was a simple checkbox on the material to turn off dynamic effects.

Is it possible to change the direction of the water in real-time, for something like high winds/storms?

I’m currently using the boat attack water which has a float of 0 to 360 for the wave direction, curious if this is doable with this system, and if it’ll change smoothly in real-time.

Thanks for checking! I think a “Receive Dynamic Effects” checkbox may be useful in this case, it is rather simple to incorporate. I’ll make a note of this for next update.

Unfortunately not no, dynamic changes to the animation direction will induce visual jittering as the UV coordinates are rapidly rotated around the world origin.

It is possible to do this, but facilitating this appears to require quite a rework to the way time and animation speeds are handled in the shader. I’ll jot this down on the wishlist, and will focus some R&D time on this for v1.7 (Unity 6+) :slight_smile:

Note that the wave height can be altered in realtime by altering the related material property through script, this works as it would for any other material in Unity

Hello Staggart,

Really nice asset for water rendering !
I have some issues with underwater rendering.

You can see in the picture attached that my camera is underwater, the underwater fog works well on the map objects but not on the waterfall that used a water material different from the water my camera is in (it obviously use river mode), is there an option to have the river & the waterfall affected by the underwater fog ?

This is quite unavoidable unfortunately. It is related to the nature of transparent materials, and the fact that the waterfall is technically also a water shader.

What may work (better) is to comment out this line in the water shader file:
9802962--1407309--upload_2024-4-29_13-27-22.png
If so, the waterfall will also receive underwater fog. But it’s difficult to predict if this will offer an improvement in your particular case.

Submitted version 1.6.3!

As [previously outlined]( Stylized Water 2 [URP] ☑️ Desktop/Mobile/Consoles/VR page-16#post-9528775), this asset is moving into a new development cycle starting from version 1.7.0.

Features slated for R&D for version 1.7+

  • Refractored waves, by using a precomputed set of parameters through the use a “Wave Profile”, this allows using up to 32 individual wave layers

  • Support for waves on rivers.

  • MicroVerse content prefabs.

  • Foam bubbles, creates a slightly lighter color underneath the surface foam effect.

  • Further improvement of screen-space reflections.

  • Ocean component, with high vertex density near the camera that taper of into large triangles on the horizon.

  • Water effect trigger script functionality.

  • Refactored Planar Reflections to adhere to URP best practices (currently relies on an obsolete API, soon to be deprecated entirely).

  • Support for Tessellation when URP’s “GPU Resident Drawer” is enabled.

Because some changes (specifically, Waves) also require changes to the Underwater Rendering and Dynamic Effects extensions these two will be split off into a separate asset. This is mainly to that their older versions remain available for users who wish to stick with Stylized Water 2 v1.6.x.

Both extensions will literally stop working in the initial, or later versions, of Unity 6 (due to the introduction of the Render Graph API)

Hopefully this table will clarify the upgrade paths:
9803043--1407345--upload_2024-4-29_14-8-1.png

This sort of logistical change is something I’ve wanted to avoid for years, but it seems ultimately inevitable. To avoid confusion about which asset supports what, the older versions will be deprecated so that they no longer appear on the asset store (they’ll remain downloadable through the Package Manager).

If there are any questions about this, please feel free to ask :slight_smile:

Thanks for the answer, well commenting this line has the same effect as enabling the Depth writing on the water material used for underwater rendering, that means the waterfall and the river is just not rendered at all, it would be okay for the river far away but for a waterfall it would be weird for it to disappear when the player swim near it and can unhide secret behind it if it’s part of the gameplay. There is no way to add the same code used to adapt other shaders to underwater fog only if River mode is enabled for example ?

Oh and also, I was trying to create a particle transparent effect shader that used underwater fog when above the water but it seems the documentation is not up to date or may be there is something I don’t get. I can’t find the “Apply Underwater Fog” sub-graph , the only thing I can find from the graph is “Shader Underwater Material” used in the shader for underwater particles. I can find the method ApplyLitUnderwaterFog in Underwatershading.hlsl but it doesn’t have the same input & output and there is an error shown in the graph.

9803181--1407369--GraphIssue.png

@StaggartCreations I’m experiencing two issues with this shader:

  1. The planar reflections have jagged and blurry edges. Like the anti-aliasing on it is very poor even though my AA settings are maxed out and look good outside the water. Here’s an example: Imgur: The magic of the Internet
    How can this be improved? Is this an inherent limitation of this shader?

  2. The planar reflections are not always reflecting geometry correctly. Sometimes it looks broken and buggy like this:
    Imgur: The magic of the Internet
    Is there a way to make the reflections more accurate?

And a final question: Is there a shader that can be applied to objects under the water to make them appear dark? Like this: Imgur: The magic of the Internet
I’m trying to create that effect but with this water shader all the objects are appearing as whitish, not dark. I was hoping there was some kind of simple shader I could apply to submerged objects that changes their blend mode to get that dark effect.

Thanks for your help.

A comprise has to be made somewhere. Ideally, you’d increase the render queue value of your water, so that it always render in front of a waterfall.

You won’t see the waterfall when looking up through the water, since the water surface uses URP’s “opaque texture” to render the refraction effect. Transparent materials are never captured in this texture. If you are seeing it, it must mean that it is rendering in front of the water? Though it doesn’t seem like it in your initial screenshot. It gets a bit complicated to grasp with all the different factors at play (transparency sorting, namely). Worth noting that transparent materials (such as the water) always render on top of the underwater fog. The water shader appears to be the exception, only because it 1:1 mirrors the underwater fog shading.

About the shader graph node, I believe you have a few files that are remnants from an older version. Typically any file deleted from an asset, won’t be deleted on your end when you update. The folder currently looks like this:
9805119--1407771--upload_2024-4-30_11-54-2.png
You can safely delete anything else you find there :slight_smile:

The documentation was indeed not quite up to date regarding this, definitely an oversight on my part! I’ve just updated the page.

When it comes to Planar Reflections, every possible optimization is exploited. By default it renders at a resolution of 75%. Because water typically moves and distorts the reflection, it easy to get away with lower quality reflections. Yet when looking to achieve mirror-like reflections. You can otherwise increase the Render Scale on the component to 100%. Anti-aliasing will also be applied, if it is enabled on the source camera.

I’m not sure why a particular part of that branch cuts off, it may be worthwhile to set the “Offset” value to 0 on the component.

Regarding your last question, it unfortunately not trivial to achieve. Objects behind the water surface (underwater) aren’t actually visible. The water color is based on the deep/shallow colors, which in term is based on the scene’s depth information. So an object that sit close to the surface but appearing darker than deeper objects would be a contradiction in terms of shading.

You can, sort of, achieve this by using a Transparent material for the fish, and setting its Sorting Priority +1 (anything higher than 0). This way you are actually rendering it on top of the water, and it can have any sort of color.
9805119--1407855--upload_2024-4-30_13-43-30.png
(To make this work, the “Depth Writing” checkbox has to be disabled on the water material).

I think in the context of your reference (Creatures of the Deep?) that’s viable solution.

I’ve always had the Planar Reflections Render Scale set to 100%. The reflection’s edges are still pixeled and jagged. It’s not really usable in a published game with this level of quality.

How come I see published Unity games with water that has perfect planar reflections with no jagged edges and no glitches in the reflection geometry? Somehow they achieve it.

It’s not clear to me, where is this “Offset” value found? On which object?

So I tried as you suggested, but then the fish object does not look like it’s under the water. It doesn’t get refracted, it doesn’t get caustics, etc. It looks really bad.

Yes, I was referencing Creatures Of The Deep. Their water looks amazing and all the objects in the water look dark, not white. In real life, if you place an dark fish in the water, it will look dark, not white. So something isn’t quite right with the look. How does Creatures Of The Deep achieve such good looking water shader, and what’s more, it’s just a mobile game.

Been using Stylized Water Shader 2 for a while and love it! I just purchased the Dynamic Effects extension to get some shorelines and trails.

I’m a little confused in regards to the setup of the extension.
I have upgraded the Stylized Water 2 to 1.6.1 (Can be seen in the package text asset to the right on the img below).
However in the Hub window it still shows 1.3.1 ?
This is why I’m guessing that I don’t see any water on the water mesh inside the demo?

The manual refers to Window->Stylized Water 2->Set up Dynamic Effects in the demo scene.
I’m not getting that option in the menu either.

Any direction would be much appreciated.
Using Unity 2022.3.19f1

Before I upgrade the Stylized Water Shader 2 to 1.6.3 the SW2_backgroundTerrain text is red. It’s not read when I upgrade to the lastest Stylized Water Shader.
(Then again, it still says I have 1.3.1 in the Hub)
T

Very funky, you do indeed appear to have v1.3.1 installed (based on the help window UI). Version 1.4.0 was a major version update, it involves an auto-upgrade feature that removes obsolete files. It is possible, that when there are compile errors that none of this happens. The version number also comes from a script, so for the same reason it may not appear to change, until its allowed to compile.

Easiest course of action is to delete the StylizedWater2 folder, and reimport it from the asset store

Pleased to announce that I’ve opened a Discord server. It will serve as a centralized place to find announcements, discussions and support/feature request forums. Though Unity threads, such as this one, will still be monitored. And documentation will remain up to date. Moving forward, my attention will be focused on the server, in order to streamline continued support :slight_smile:

- Join -

In order to access support channels and feature requests, your invoice number is required. You can find this on your Order History page.

Hi, I’m using Stylized Water 2 [URP] and for the second day I can’t find the cause. Foam is displayed only on stage, but in game and on mobile device water is displayed without foam.

If you turn on gizmo display then the foam appears in the game as well, but it doesn’t help to display the foam on the mobile device.

Could you help?

I have an issue with underwater & Cozy & my water fall particles effect that I made to be shown underwater.
here is my waterfall normally rendered.

And after leaving the water I have this :

The water fall effect is not render anymore if it’s bellow the center of my screen and the cozy clouds & fog also not rendered. Do you have an idea what could be the issue here ?

[EDIT] I just tried to disable my particles effect and it seems that it’s the cause of the issue but I don’t understand why and I really need to render my particles effect differently when underwater. Here is the shader graph I made :