Stylized Water 2 documentation

Stylized Water 2

Stylized Water 2
Version: 1.3.1
Review

8.Roadmap #

There really is no shortage of ideas, and there are still plenty of things I want to work on! These are some features that are slated for R&D or are in an early stage. A general design principle if that everything should remain plug & play, and can be disabled entirely to avoid a performance impact for unused features.

Upcoming updates

1.4.0

Waves & Buoyancy update. Slight rework of the API, so that it returns a struct (containing wave height and normal).

  • Improved waves, by using a precomputed set of parameters through the use a “Wave Profiles”
  • Coupling of vertical movement with horizontal movement. Higher waves should means that they start to create crests.
  • Addition of a “Global Water Level” component. Script using the Buoyancy API can up to use this as a reference for the water level.
  • Support for waves on rivers.

This version will be see an update for the Underwater Rendering extension, in order to keep it functional

Extensions

This is all to share some ideas and experiments, they may end up never being released, or are indefinitely on hold. There’s also a limit to how much you can cram into a shader, historically many water assets have been deprecated due to rising complexity, which is to be avoided

Features that are complex, and require a sizeable amount of development time will be published as separate paid extensions. Rather than making a single high priced asset, the intend is to keep things modulair.

In order of importance/completion:

Surface Modifiers (extension asset)
A decal-like system that allows the water surface Albedo/Displacement/Normals/Foam to be modified. They are projected from a top-down perspective onto the water surface. It is comparable to Deferred Rendering, which also means the water shader just has to sample a few textures. Modifiers can be made as complex as you see fit.

This opens to the door to virtually unlimited effects. Static textures or custom shaders can be created using Amplify Shader Editor to control the behaviour of what a modifier does. These could be used to create:

– Ocean waves (and localized waves)
– Whirlpools
– Water ripples through particles
– Boat wakes
– Shoreline waves
– Advanced rivers with dynamic flow directions
– Debris floating on the water (duckweed, grime, oil spills, blood, etc…)

Modifiers are rendered using a custom Cascaded rendering system. Which allows for high resolution near the camera, whilst also supporting large rendering distances.

Status: In cold storage, there doesn’t seem to be a good balance between performance, quality and functionality possible. Rendering the practical implementation too niche.

Todo:

Displacement height to normal map conversion
Allow one modifier to output to multiple layers (eg. both displacement and foam)
Instanced rendering with culling (should be no more than 16 draw calls at maximum quality)
• Option for a modifiers to be “global” and fill up the entire view (eg. ocean waves)
• Shader Graph node to read Displacement/Normal from other modifiers (eg. foam based on height, or surface curvature)
• Support for custom meshes (rather than just a quad). Could be used to create spline-based shorelines.
Support for particle systems

Stretch goals (or post-release)

• Displacement readback in C# for buoyancy effects (working prototype!)
• Compute shader-based particle system, spawns particles on wave crests

Interactive water (extension asset)
A personal favorite, an approximated wave simulation is run based on the shape of meshes that touch the water, allowing small-scale waves to be dynamically created. Similar to what’s seen in games such as The Witcher 3 or Assassin’s Creed https://twitter.com/_staggart_/status/1371390591645401088.

This goes beyond simply rendering particle effects into the water, which wouldn’t support waves bouncing off each other, or having entire 3D shapes create waves (character limbs or boats).

Status: On hold, Surface Modifiers provides similar functionality

Todo:

Needs conversion to a compute shader, since this opens up the possibility of reading back the wave height in C# for the buoyancy API.
• (Vital) Render area should move with the camera, and the simulation should account for the shift (open world usage)
• Figure out how to make the simulation speed framerate independent. It currently speeds up at high framerates as well.
• Still needs a form of collision detection, so objects above/below the water don’t render into the simulation.
• Adding a dedicated foam layer to the shader, drawn only through a separate foam simulation.
• Motion vectors, tells the simulation in which direction the object (or rather a pixel) is moving, and how fast. This should make directional waves possible, next to velocity-based foam. This will also allow waves to be created when an object is translated through rotation.

Flowmap painter (extension asset)
Create a flowmap object, with a specific box-size and enables you to paint a flow map within this area. The painter is GPU based, so isn’t per-vertex, and allows for greater detail. This allows the use of brushes (modeled after Substance Painter).

Splines can be used to drive the flow, next to manual painting. But this specific feature would be rebuilt on Unity’s native spline tool when it releases.

Status: Prototype, basic functionality works, but painter needs a lot more UX work. Feature is also doubtfully useful, the flow of the water will mainly be noticeable when using surface foam and strong reflections. Not unimportant: every texture that uses the flow map requires to be sampled twice. In many AAA games you’ll mainly see this used on rivers.

Color gradient
Rather than using a 2 colors to set the deep and shallow color, a gradient can be used.

Status: Binned, mainly because it visually makes a very minor difference, unless going for an rainbow-colored lake. It also creates a troublesome situation where it’s no longer clear to tell what exactly the deep and shallow color is, for underwater rendering and translucency.

Released

Underwater rendering (extension asset)

Allows a camera to be partially submerged, and draws a waterline effect on the camera lens. Underneath the water surface, fog and caustics are drawn and the water refracts the scene above the water.

Status: Released!

Tessellation
Dynamically subdivides the water geometry to create more vertices near the camera. This allows to have very detailed waves near the camera, without needing a high-poly mesh.

Status: Added in version 1.1.2 through a free update

Yes No Suggest edit
Last updated on February 21, 2023
6 of 6 users found this section helpful
Suggest Edit