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

That is great, waiting for the update to be live!

Hi!

What could be the reason, I place the Ocean prefab in the scene, in scene mode everything is fine, but when I start the game, it immediately turns brown, only the ripples are visible. All other Prefab is fine.

Ah my mistake, I was looking at the main asset. :smile: I have updated the under water asset and it looks perfect rn.

One thing I can’t figure out is the jittery motion when I set the custom time in the update method. Any idea what might be the issue? I just set the custom time to Network Time like below:

private void Update()
{
    WaterObject.CustomTime = NetworkManager.Singleton.LocalTime.TimeAsFloat;
}

The wave movement and the objects with Align Transfrom component becomes jittery when I do so.

Brown is a very specific color. For the shader, there’s no difference between Edit & Play mode in the editor in terms of rendering. So if I’d have to speculate, a script in your project executes some logic that changes something.

Jittering, in regards to animations, typically means you’re running into floating point rounding errors. It’s possible to induce this when passing in a really high value for the time index (>10k).

It’s best to limit the value you pass into CustomTime to never exceed ~5000, and reset it back to 0 when it does. Or reset it to 0 at a strategic moment where it won’t be noticeable.

Thank you for the suggestion, I had a look at the NetworkManager.Singleton.LocalTime.TimeAsFloat and is starts from 0. Waves seem to look fine but a boat with “Align Transform To Waves” component does a jitterry movement. It works smoothly when there is no custom time is provided though.

Hi! There is a problem with showing water both in the Unity Editor and in the build on the phone. When i move camera water is glitching but when camera is static water is fine.
Unity version is 2022.3.14 and according to the documentation it should be suitable. I also tried 2022.2.15 but same result. I cant move to 2021 unity because project will broke. So maybe you can help me with version number of 2022 unity that work fine with this water? thanks

Strange, the shader and wave API are both different domains, but the calculations are mirrored and use the same time index. I’m using this script to test a custom time inputs where I’m unfortunately not seeing anything out of the ordinary.

If you could share a video, or better yet a reproduction project, that’d be most helpful as to remove guesswork.

Hi staggart, we wonder if it would be possible to have special effects visible under the water plane. I mean particles or any other fx. this is for a top down game, we never go underwater ( although we have the extension) so then only view is from above the water plane. It would be great if we could add some bubbles or any other effect as we use clear water material. Many thanks

That’s certainly possible!

Because both the water material and the particles are transparent, transparency sorting comes into play. There’s a detailed explanation about this here (1st item).

You’d want your particles to render on the 2999 render queue, which puts it behind every other transparent material (3000).

Excited to announce the release of a new asset!

This tool can be used with Stylized Water 2, as both of them mediate effects through vertex colors. The river tool can procedurally assign them to draw foam on the river surface.

Asset store link

A waterfall and lake mesh tool is still under development, but set to release this year as well.

Hello Starggart, I was getting strange translucency behavior that would change based on the point light processing order. I tracked it down to a possible bug in the ApplyLighting point light loop where ApplyTranslucency is repeatedly called and the strength and exponent values in translucencyData are modified by each point light but re-used for the next iteration of the loop. Keeping a copy of the original values from the translucencyData and using those instead seems to fix the issue for me. I’m on 1.5.5 but didn’t notice this mentioned in the latest release notes. Thanks for your great work on this asset

Excellent, thanks for the headsup! That does indeed sound like an oversight. I’ve made a note of this to correct this in a future update :slight_smile:

Any idea on how to fix this? I don’t believe I got this error on my Windows setup but will verify tomorrow

Shader error in 'Stylized Water 2/Standard': undeclared identifier '_FOVEATED_RENDERING_NON_UNIFORM_RASTER' at /Library/PackageCache/com.unity.render-pipelines.universal@14.0.10/ShaderLibrary/Clustering.hlsl(30) (on metal)

Compiling Subshader: 0, Pass: ForwardLit, Fragment program with FOG_EXP2 _ADDITIONAL_LIGHT_SHADOWS _ADVANCED_SHADING _CAUSTICS _DISTANCE_NORMALS _FOAM _FORWARD_PLUS _MAIN_LIGHT_SHADOWS_CASCADE _NORMALMAP _REFLECTION_PROBE_BLENDING _REFLECTION_PROBE_BOX_PROJECTION _REFRACTION _SHADOWS_SOFT _SHARP_INERSECTION _TRANSLUCENCY _WAVES
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_NEEDS_RENDERPASS_FBFETCH_FALLBACK UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DEBUG_DISPLAY DOTS_INSTANCING_ON DYNAMICLIGHTMAP_ON EVALUATE_SH_MIXED EVALUATE_SH_VERTEX FOG_EXP FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SHADOWMASK UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _CLUSTERED_RENDERING _DISABLE_DEPTH_TEX _ENVIRONMENTREFLECTIONS_OFF _FLAT_SHADING _LIGHT_LAYERS _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_SCREEN _RECEIVE_SHADOWS_OFF _RIVER _SMOOTH_INTERSECTION _SPECULARHIGHLIGHTS_OFF _UNLIT _WRITE_RENDERING_LAYERS

This is due to a bug in URP I’m afraid, not sure which versions specifically it occurs in or in which ones its been fixed. Possibly only when using Forward+ rendering.

There’s a VR-specific code path mixed into the Metal graphics API path, which should be impossible, Mac doesn’t support VR :stuck_out_tongue:

Upgrading to the latest LTS version may resolve this.

Hey There! I was wondering if we could have distortion for the intersection foam texture? Currently the texture just slides along in the specified direction, and looks odd with certain settings. I really want to be able to apply some distortion like we can with surface foam. Is this doable in some way?

Want to be able to distort a texture like this so its not as clearly just sliding along the surface.

I’ve added SW2 with the underwater extension to my project, and it looks great … until I take my character for a swim :-/ Is there any way to exclude my character from getting the edge foam rendered on top of it? (I will eventually add particles around the character when they are swimming/treading water)

– pryankster

SW2 + DWP2 works really well when using a boat on the ocean where the water level is well level, but would it be possible to for it to work on a river were water height varies. I’m thinking of using either colliders so the boat just glides o the river or raycast

You can change line 466 in the StylizedWater2/Shaders/Libraries/ForwardPass.hlsl file from

water.intersection = SampleIntersection(uv.xy, etc…

to
water.intersection = SampleIntersection(uv.xy + saturate(water.offset.yy + water.tangentWorldNormal.xz * 0.2), etc…

Note that waves also shifts the effect around, so adding a single wave layer with a subtle height also enhances the effect.

The intersection foam effect is based on the scene’s depth information by default, so it draws on top of any opaque geometry intersecting with the water. It can also be painted onto a mesh, or baked in, using vertex colors.

I believe for this you can forgo the SW2 integration altogether, since it relies on a specific water level for physics. I vaguely recollect DWP2 featuring a raycast-based water sampler? That would work quite well for a river with a mesh collider.

Perfect! Thank you! I wanted to expose the mutl value, but that doesn’t seem to be straight forward because of the shaders being generated.

But thank you so much for your time.

Hi @StaggartCreations !
I am thinking about buying your asset, but there is one use case I would want to know:

  • Is it possible to have the intersection foam (shoreline) WITHOUT having the Depth and Opaque textures turned on in the URP pipeline? Mainly because having both of them on a mobile (Android) game seems to hit the CPU/GPU use and more importantly the game RAM usage. If it’s necessary to do some manual setup it’s no problem at all, just having a nice (as possible) water visual without having this performance impact is what i’m looking for

Thanks!