Tweaking The Waterfall Visuals

Tweaking Waterfall Visual Aspect Example

Waterfall Body Properties

Tweaking Waterfall Body Color And Texture In The Waterfall Material Inspector

Body Color

Waterfall Material Color Properties

We can set the waterfall body color to either a Solid Color or a Gradient Color. If we choose to use a Gradient Color, the Gradient Offset property controls how much to shift the gradient-line midpoint position (where the middle of the color transition should be).

Info

The Gradient Offset property range: -0.5 → 0.5

Body Textures

Waterfall Material Texture Properties

We could apply up to 2 textures (main and secondary) across the waterfall body.

Warning

The texture should have its wrap-mode set to Repeat or Mirror in the texture import settings.

Body Texture Sheet Properties

The main or the secondary texture could be a regular texture, or a texture-sheet (a texture consisting of many frames) by toggling the Is A Texture Sheet property on, and then specifying the number of columns and rows and also setting how many frames to play per second.

Body Texture Opacity

The Opacity property controls the visibility of the texture.

Body Texture Scrolling Speed

We can make the texture scroll vertically by tweaking the Scrolling Speed property.

Body Texture Tiling Mode

Regarding the texture tiling properties, there are two tiling modes:

  • Stretch: The texture stretches when the waterfall object size changes, always keeping the same number of tiles we specify for the X and Y directions.

    Texture Stretch Tiling Mode Properties

  • Repeat: The texture repeats when the waterfall object size changes. In this mode, we specify the scale in units of a single tile.

    Texture Repeat Tiling Mode Properties

Body Texture Offset

We can provide a texture offset regardless of the selected texture Tiling Mode.

Body Texture Distortion Effect

Waterfall Material Distortion Effect

Distortion Scale - Offset

The Mathf.PerlinNoise(x,y) function is used to sample the Perlin noise texture values. The Scale and Offset properties controls the sampled area size and origin, respectively.

Warning

The Scale And Offset properties are used to generate the noise texture (which actually happens only in the editor), and as such they are not animatable.

Distortion Strength

The Strength property, as the name suggests, controls how strong the distortion effect is.

Distortion Speed

The Speed property controls the noise texture scrolling speed.

Distortion Tiling

The Tiling property controls the scale of a texture noise texture tile relative to a waterfall body texture tile.

Example

A value of 0.5, for both the X and Y axis, will apply the noise texture across 4 waterfall body texture tiles.

Distortion Tiling Property Example

Tip

We can use the Tiling property to lower the distortion strength across one axis, and keep the full strength across the other.

Waterfall Left-Right Edges Properties

Waterfall Material Left Right Edges Properties

Left-Right Edges Thickness

Waterfall Material Left Right Edges Thickness

We first specify how thick the left and the right edges are.

Left-Right Edges Texture(s)

Waterfall Material Left Right Edges Same Texture Properties

We can use two different textures for the left and right edges, or we can simply use the same texture for both edges by toggling the Use Same Texture property on.

In case we decided to use the same texture, the Flip Texture property controls whether or not we want to flip the texture when it gets applied across the specified edge horizontally.

By toggling the Alpha Cutoff property on and tweaking the cutoff value, any pixels with the alpha value below the cutoff threshold will be considered invisible. This might be useful if we would like to add some irregularities to the left and the right edges.

Example

Waterfall Material Left Right Edges Alpha Cutout example

The description of the left-right edges texture(s) properties is the same as the waterfall body texture properties, as discussed here.

Waterfall Top-Bottom Edges Properties

Waterfall Material Top Bottom Edges Properties

Top-Bottom Edges Thickness

Waterfall Material Top Bottom Edges Thickness

We first specify how thick the top and the bottom edges are.

Top-Bottom Edges Texture(s)

Waterfall Material Top Bottom Edges Properties

We can use two different textures for the top and bottom edges, or we can simply use the same texture for both edges by toggling the Use Same Texture property on.

In case we decided to use the same texture, the Flip Texture property controls whether or not we want to flip the texture when it gets applied across the specified edge vertically.

The description of the top-bottom edges texture(s) properties is the same as the waterfall body texture properties, as discussed here.

Waterfall Refraction Effect

Under the Refraction Properties in the waterfall material inspector, we set the refraction effect distortion properties.

Waterfall Material Refraction Effect Properties

The refraction distortion properties description is the same as the waterfall body distortion effect properties, discussed here.

Waterfall Refraction Layers

Under the Refraction Properties* in the waterfall component inspector, we use the Objects To Render*** property to select which layers to include in the refraction rendering.

Waterfall Component Refraction Effect Properties

Script Reference

1
waterfallObject.RenderingModule.Refraction.CullingMask = LayerMask.GetMask("Default", "TransparentFX");

Waterfall Refraction Render-Texture Properties

If the Use Fixed Size property is toggled on, the Size property sets the refraction render-texture width and height.

Use Refraction Render-Texture Fixed Size

Script Reference

1
2
waterfallObject.RenderingModule.Refraction.RenderTextureUseFixedSize = true;
waterfallObject.RenderingModule.Refraction.RenderTextureFixedSize = 512;

But, if the Use Fixed Size property is toggled off, the refraction render-texture will have a dynamic size, and the render-texture width and height are in this case equal to the the waterfall object visible area on screen width and height. We can even downscale this computed size by lowering the Resizing Factor property value.

Use Refraction Render-Texture Dynamic Size

Script Reference

1
2
waterfallObject.RenderingModule.Refraction.RenderTextureUseFixedSize = false;
waterfallObject.RenderingModule.Refraction.RenderTextureResizingFactor = 0.75f;

Lastly, We can set the refraction render-texture Filter Mode property to either Bilinear or Point.

Script Reference

1
waterfallObject.RenderingModule.Refraction.RenderTextureFilterMode = FilterMode.Bilinear;