Tweaking The Waterfall Visuals¶
What we'll cover on this page?¶
- Waterfall Body Properties
- Waterfall Left-Right Edges Properties
- Waterfall Top-Bottom Edges Properties
- Waterfall Refraction Properties
- Waterfall Rendering Properties
Waterfall Body Properties¶
Body Color¶
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¶
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.
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.
Example
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.
-
Repeat: The texture repeats when the waterfall object size changes. In this mode, we specify the scale in units of a single tile.
Body Texture Offset¶
We can provide a texture offset regardless of the selected texture Tiling Mode.
Body Texture 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.
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¶
Left-Right Edges Thickness And Offset¶
The thickness and offset of the left and right edges can be set to absolute fixed values (specified in Unity units), or values that are relative to the width of the waterfall object (specified in the 0..1 range).
Left-Right Edges Texture(s)¶
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
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¶
Top-Bottom Edges Thickness And Offset¶
The thickness and offset of the top and bottom edges can be set to absolute fixed values (specified in Unity units), or values that are relative to the height of the waterfall object (specified in the 0..1 range).
Top-Bottom Edges Texture(s)¶
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.
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.
Script Reference
1 |
|
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.
Script Reference
1 2 |
|
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.
Script Reference
1 2 |
|
Lastly, We can set the refraction render-texture Filter Mode property to either Bilinear or Point.
Script Reference
1 |
|
Rendering Properties¶
Rendering Properties - Material Inspector¶
Under the Rendering Options in the waterfall material inspector, the Mask Interaction property controls how the waterfall object behaves when interacting with a Sprite Mask or with the Mesh Mask. We can set the mask interaction to one of the following options:
- None : No interaction
- Visible Inside Mask : the waterfall is visible where the Sprite Mask or the Mesh Mask overlays it, but not outside of it.
- Visible Outside Mask : the waterfall is visible outside the Sprite Mask or the Mesh Mask, but not inside it.
The Apply Tint Color(s) On Top Of Texture(s) property controls in which order the tint colors and textures are applied. If this property is toggled on, the textures are applied first and the tint colors are applied second, otherwise textures are applied last.
Rendering Properties - Component Inspector¶
Under the Rendering Properties in the waterfall component inspector, the Far Clip Plane property sets the furthest point relative to the waterfall object position that gets included in the refraction rendering.
The Render Pixel Lights property controls whether or not the rendered objects are affected by pixel lights.
Info
The Render Pixel Lights property is ignored when working with the URP/LWRP.
We can also activate/deactivate the High Dynamic Range (HDR) and the Multisample Anti-Aliasing (MSAA) rendering.
Info
The MSAA rendering is activated only if the Antialiasing is enabled in the project quality settings or in the URP/LWRP settings asset.
Script Reference
1 2 3 4 |
|
Note
The Sorting Properties and the Mesh Mask Properties are discussed in the Getting Started section of this guide.