3rd August 2018

CASCADE DOC

SHADER SETTING

The Shader Generator section of the material interface contains all the feature options for the shader. Changing any of these options will regenerate the shader code, rewriting the shader your material is using.

  • Name
    • This is the shaders name and path in the shader menu.
  • Refraction
    • This enabled refraction of the surface below the water, distorting what’s under the river. This is a relatively expensive effect, since it has to cache the rendering below the terrain into a texture, but is rather fundamental for transparent water.
  • MultiCam Support
    • When rendering with multiple unique cameras, such as rendering into each eye of a VR rendering or doing split screen multiplayer, this option will capture the frame buffer for each eye. When this option is enabled, refraction will not work in the editor view.
  • Water Motion
    • By default, water flows along the UVs. However, this can be set to Flow Map instead, which will read the direction and velocity of flow from the UV2.zw parameters, allowing water to flow at uneven rates or in different directions. Using flow mapping causes the number of water samples to be doubled.
  • Turbulence
    • Turbulence gives wave motion to the vertices of the mesh. It’s a very cheap effect, and used well can add a very nice subtle effect to the river.
  • Slosh Water
    • This causes a swirl effect on the water. Once enabled, it’s best to turn it up high and get the parameters correct, then turn it down again. It can add a very complex twisting and rolling motion to the water. It is cheap as well.
  • Sparkles
    • Sparkles produces specular highlights on calm water, and mist like foam coming off the surface of rougher areas. Sparkles causes a second pass of the water, rendering the mesh a second time with the sparkle effect, but is a much simpler shader than the first pass.
  • Sparkles Motion
    • Switches the motion for sparkles between UV and FlowMap. See Water Motion for more details.
  • Caustics
    • Caustics cause a patterning from refracted light on the surface under the water, which fades based on water depth. This is reasonably cheap.
  • Raindrops
    • Raindrops allow rain to appear on the water surface.
  • Waterfalls
    • When enabled, separate controls are available for a waterfall effect, which is blended in based on the slope of the water.
  • Lakes
    • When enabled, a second water system can be setup in the same shader. A control is available on each node to say if the water should use the regular water system or lake water system. This runs the calculations for water a second time and blends the result.
  • Lake Ripples
    • Samples the normal map an extra 2, 4, or 6 times to produce a complex counter motion which simulates waves bouncing off the shoreline, creating a directionless ripple. Each set of samples happens at a different frequency and motion.
  • Flotsam
    • Flotsam allows you to put small bits of debris into the water. You can use up to 3 Flotsam systems, each with their own textures or sprite sheets. Flotsam is rendered in the order of the flotsam systems, so later flotsam will appear on top of previous flotsam.

 

Main Material Properties

The normal and foam texture controls the primary look of the water surface. This texture tends to look best uncompressed, even if it means you have to keep it lower resolution to save memory. The red and green channels of the texture are the same as the red and green channels of a normal map, and the foam texture is packed into the blue channel. A waterfall cascade texture is packed into the Alpha channel.

Note that when Lakes are enabled, a tab control appears at the top of the next few sections, allowing you to adjust these values independently for lakes and rivers. This can let you have a calm lake, while having a raging river which flows into it.  

  • UV Scale
    • Controls the scale of the Normal/Foam texture
  • Normal Strength
    • Controls the strength of the normal map
  • Flow Speed
    • Controls the overall speed of the water
  • Fresnel Opacity
    • Controls how transparent the water is based on the viewing angle
  • Depth Calming
    • When higher, deeper areas of the river will have have less normal, foam, and other effects caused by the water interacting with surfaces.
  • Relectivity
    • How reflective the water surface is of the environment. Placing light probes, or running Screen Space Reflections using the Unity Post Processing stack can greatly improve the quality of this effect.
  • Refraction
    • Controls how much the terrain under the water is distorted by the water’s normal

The surface tint and depth tint control the color of the water over a depth range, specified by the Tint Depth parameter. In this case, our surface will have a light blue tint, while terrain at 50 meters in depth will be tinted a dark blue.

Depth Edge controls the alpha blend between the terrain and the river.

The Foam settings control the foam across the surface of the water. Foam is based on an internally calculated turbulence amount along the spline, which is based on the slope of the water and velocity built up from previous points. Settings are available at spline points to increase or decrease the overall foam level as well.

  • Foam Speed
    • How fast the foam texture scrolls
  • Foam Scale
    • Scale for the foam texture UVs
  • Foam Strength
    • Overall foam strength for the water
  • Foam Edge Width
    • Uses the depth buffer to add foam to areas near the shoreline
  • Foam Edge Strength
    • A separate foam strength for the edge foam
  • Foam Color
    • Tint color of the foam
  • Foam Edge Color
    • Tine color for the edge foam

Sparkles provide a glistening foam like effect on the surface of the water.

  • Sparkle Strength
    • Overall strength of the sparkle effect
  • Sparkle Scale
    • UV scale of the sparkle texture, which is derived from the foam texture in channel B
  • Sparkle Edge
    • Uses the depth buffer to remove sparkles from the edge of the water
  • Sparkle Speed Boost
    • Modifies the UV motion of the sparkle texture vs. the foam texture

If Turbulence is enabled, the amplitude of the turbulence effect is controlled by this property.

If Water Slosh is enabled, you can control the speed, scale, and strength of the twisting motion applied to the water surface.

Properties below this point are shared by both lakes and rivers.

  • Turbulence Rate
    • How fast the water vertices move up and down
  • Turbulence Frequency
    • How big the waveform applied to the vertices is

If Waterfall’s are enabled, a section of controls for waterfalls is displayed.

  • Waterfall UV Scale
    • Scale for the waterfall texture, which is stored in the alpha of the Normal/Foam texture
  • Waterfall Speed
    • UV speed of the waterfall effect
  • Waterfall density
    • Controls the overall contrast of the waterfall effect
  • Waterfall Threshold
    • Controls the slope at which waterfalls begin
  • Waterfall opacity
    • Overall alpha of the waterfall effect

 

Each flotsam effect (max 3) has a copy of these controls for the effect. Flotsam comes in two modes, Image or Sprite Sheet. When flotsam is in Image mode, a texture is scrolled in the water surface and controlled by these parameters. If flotsam is set to Sprite Sheet, then a procedural technique is used to randomly splat images from a texture atlas into the water. This can be very powerful, as it can prevent tiling, allow you to use a lower res flotsam texture, and also allows you to control the density without adjusting the texture.

  • Flotsam Speed
    • Speed of motion for the flotsam in the river
  • Flotsam Depth
    • How deep does the flotsam appear (at the surface, or below). Note that flotsam is rendered in order, so for the best depth effect when using multiple flotsam systems, have the depth of earlier flotsam systems be higher than later ones.
  • Flotsam Scale
    • Scale for the flotsam texture
  • Flotsam Frequency (only in Sprite Sheet mode)
    • Controls how much flotsam is in the water
  • Flotsam Sheet Size (only in Sprite Sheet mode)
    • How big are the UVs for each sprite on the flotsam texture? When set to 0.25, 0.25 like in the example, the texture atlas is expected to be dividied into 4×4 flotsam images.
  • Flotsam Max Index (only in Sprite Sheet mode)
    • This lets you prevent unused images on the sheet from being used. For instance, a 4×4 sheet can have 16 images on it, arrange across then down. If the last few images were unused, you could use this property to prevent them from being selected.

 

If Caustics are enabled, you can define a look for the caustics with a texture. The Red and Blue channels of this texture contain two patterns to use for the caustics, with the green channel being filled with a general noise pattern.

Caustics generally fade out at some depth, which can be controlled by the Caustic Depth parameter. The Caustic Scale controls the UV scale of the caustic texture. The strength controls how strong the caustic effects are, while the frequency and amplitude control the size and amount of distortion applied to the caustic effect.

If Rain is enabled, a rain intensity and UV scale can be used to control the intensity and size of the raindrops.

If Lake Ripples are enabled, additional properties are shown for each lake ripple. An overall strength and scale for the effect are shown, along with an intensity and direction slider for each octave.

 

Last updated on 7th August 2018
Suggest Edit
YouTube
LinkedIn