Finally have some progress to share on the state of Stylized Water 2, most of the functionality makes up water is there. There’s still a few painpoints that need addressing, next to a whole lot of polishing/UI.
wastefuleverlastingamericantoad
The main differences between the current version:
Built for URP (hand-written for maximum performance)
Single shader, scalable from mobile to desktop
Separate controls for sun/environment reflection
Depth calculation through scene depth, baked texture or vertex colors
Improved GPU waves (should make buoyancy support possible in the future)
Improved intersection effect
Wave/foam painting through particle effects
Caustics in shallow water
Shoreline waves
Translucency rendering on high waves
The scope remains the same, not aiming for a water/ocean simulation. But rather something that can fit a wide range of stylized/cartoony art directions and performance targets.
(Mobile) Enable Depth Texture toggle under Advanced tab. If the scene camera is intentionally not rendering the depth texture, this can be toggled. This ensures the water does not render as invisible when built on the devices (depth/intersection effects will be lost either way)
Changed:
Removing the “Enable Depth Texture” component from a camera will have the camera stop rendering a depth texture
Height- and normal maps textures are now in Linear-space by default
Fixed:
Not being able to enable the Gradient color option
Hm, testing out Enable Depth Texture toggle. It seems that it have to be toggled on to even be able to use vertex color intersections. If you just toggle it off you cannot paint intersections anymore.
And btw using green vertex color for transparency works fine. So it is just red for intersections that does not work when depth texture toggle is disabled.
Afraid not, breaking waves so far have been more of a demo scene type of thing, given the complexity. Or it has to be based on a baked fluid simulation. Either way it requires some trickery, which is why it isn’t very common in games.
The water color can be changed. There’s a parameter for deep, shallow and horizon color.
There’s no underwater effect included. However my post effect pack contains several effects that can be combined to achieve this (namely blurring, fog, screen waving). These could be added to a post processing volume that’s placed underneath the water surface, so they become active once the camera goes underwater. Though this is simply a switch, underwater rendering with a partly submerged camera is a different beast
Added basic buoyancy support for Stylized Water 2. With the technique used for waves in the current package, this was never possible. This time around, I kept this in mind from the start.
dirtycourteousarcticseal
This allows objects to float on the water. I won’t go as far as to extend it with true buoyancy physics or boat controllers, as that’s a different focus entirely. I’ll see if I can add an integration for Dynamic Water Physics 2 package, which has all the bells and whistles.
You have a very interesting asset, pretty good job. I have a couple of questions:
1- Does the asset have underwater effects or do you plan to add it?
2- Do you know if it’s compatible with Tenkoku?
There’s no underwater effects included in the package. There is an underwater post processing preset in this package, which has effects for fog, screen waving and blurring, which is essentially what an underwater look amounts to. This is for the Post Processing Stack, so a box volume could be placed underneath water so it becomes active when the camera goes beneath the water surface. But there’s no special rendering to cover the scenario where the camera is half submerged, this is a different beast
The shader doesn’t pick on any third party fog effects, because the same code requires to be incorporated into the water shader. The same goes for any other transparent material/shader really. For shallow water, this is never really an issue, since the amount of fog you’ll see on the water always matches whatever is behind/below it.
And you don’t plan on adding those effects to this asset? I mean, so you could create a more detailed underwater effect (for example where the camera is half submerged) and in addition we don’t have to buy 2 assets. Anyway, do you have an example of how it would all look together? The effect under water using SC Post Effects Pack and Stylized Water Shader.
I’m looking for a water shader that fits in my game better, for now I’m using a free shader, but so far out of all the ones I’ve seen, yours is the one that fits the best.
No plans to add this I’m afraid, as it’s outside of the scope for this package. Here’s a mockup of using a post-processing volume under water with the Ripples, Color Split, Radial Blur and Fog effects combined: legalneighboringarmadillo
Perfect, looks nice, I like it.
I’m pretty sure I’ll go for your water shader in the end, and I’ll probably buy the SC Post Effects Pack for underwater effects as well.
Im really not used to particle shaders btw.
How do you handle the set up?
The deer cross water animation you showed up looks amazing but i cant get it to work right.
Added the shader to a material, the material to the trail renderer, but not really looking any good.
It unfortunately won’t work with a trail renderer. The meshes created for the particle effects have a second UV channel, which controls the scale for the dissolve effect, since this had to be tweaked per effect. The mesh a trail renderer creates won’t have this information, so it ends up giving the shader a scale of 0 to work with.
Particle systems for this sort of effect actually work best:
joyousfriendlykangaroo
Since the particles spawn evenly behind the player based on distance traveled. While a Trail Renderer creates a strip mesh based on velocity, unless the character moves at a fixed speed, you’ll get varying results. If you move really fast, the trail will retract at the same speed. While particles stay true to their lifetime, no matter how fast the emitter moves
Mmmm i understood what you explained but im far away from getting the same result.
im trying to dig into how the particle system works…
Is it too much to ask how you set it up or an example?
i would like to learn how to do it
Some of it’s settings like “Texture Sheet Animation” or “Color over Lifetime” shouldn’t be changed. But you can freely adjust the size, lifetime of spawn rate of the particles.
I checked, and I triggered the water splash and activated the swimming effects using this script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SwimEffects : MonoBehaviour {
[Header("Effects")]
public ParticleSystem swimEffect;
public ParticleSystem waterEnterEffect;
public ParticleSystem waterCirclesEffect;
void OnTriggerEnter(Collider other)
{
//Checking against a tag
if (other.CompareTag("Water"))
//Checking against layer
//if (other.gameObject.layer == LayerMask.NameToLayer("Water"))
{
if(!waterEnterEffect.isPlaying) waterEnterEffect.Play();
swimEffect.Play();
waterCirclesEffect.Play();
}
}
void OnTriggerExit(Collider other)
{
waterEnterEffect.Stop();
swimEffect.Stop();
waterCirclesEffect.Stop();
}
}
This has to be attached to a GameObject that has a BoxCollider with the “Trigger” checkbox ticked and a Rigidbody, your player likely already has these. So the OnTriggerEnter and OnTriggerExit functions actually fire.
Additionally, a BoxCollider (also trigger) has to be added to the water surface as well. You can see I added a “Water” tag to the project, and assigned this to the water object, in order to identify it. The result should be that the effects start to play when touching the water, and stop when leaving it. As I recall, it didn’t work perfectly, since the water splash effect would also play when leaving the water, but it was only a demo.
@StaggartCreations
Hey there, Recently added the v.2.1.3 package to our project and wanted to look at some of the _Demo versions for examples.
The Unity version:2019.3.06f
Had issues that all Shaders where broken on fresh install. Fixed some of them example of how below. But the shaders and prefabs for the stylized water themselves are still broken. Any thoughts for trouble shooting and fixing?
To fix them I went to the materials. Selected them and updated them to the Universal IRP Materials. Edit>RenderPipline>UniversalRenderPipline>UpgradeSelectedMaterialsTo Universal IRP Materials.
Took any other Straggler Speed tree files and changed their Shader to Speed tree… 7 shader.
Would be nice to get an update that addresses the above fixes.
This package isn’t compatible with the URP, so this simply won’t work. The upgrade materials menu option only swaps out Unity’s built-in shaders with their URP variant, but doesn’t affect any custom shaders.
If you intend to use URP, you can send me a DM and I’ll forward a download to link a preview version of Stylized Water 2, which is specifically built for URP. It’s not finished, but is currently definitely usable as far as a water shader goes
This appears to relate to an entirely different water shader asset, I’m not its developer