Unity Technologies Blog: Top Tips for water in Unity

Unity Technologies Blog
A glimpse inside Unity Technologies...
Top Tips for water in Unity
Oct 7th 2011, 09:45
This post will show you how to create water from a custom mesh, adjust the settings and gain some artist
insight into making water look nice. To keep up to date with the latest tech this post will primarily concentrate
on new Pro water stuff, but later on there are some general tips which should be useful to all.

What elements make water?

Hydrogen & Oxygen

in Unity?

There are many different types of water you can create or use from prefabs. To take advantage of the
latest water effects and scripts I will be concentrating on the Water4ExampleSimple assets which are
essentially A 3D mesh with:
  • WaterTile script
  • Water shader
An empty object parented to the mesh with:
  • A Water script which exposes the colours, normal texture and main parameters for the effect
  • A reflection script
  • A lighting script
  • A displacement script
A camera
A Transform value for Specular

How can I make some water?

The simplest way is to drag the prefab into your scene, and assign your custom mesh:
  • Assets > Import Package > Water (pro only)
  • In the project window open the  Standard Assets > Water (Pro only) folder
  • Drag the Prefab into your scene
  • Position approximately where you need it
  • Select one of  the tile meshes, go to the mesh component in the inspector > select the round
    target icon on the right and choose your mesh
  • Rotate the Water4ExampleSimple parent node 90 degrees if your mesh comes in at the wrong
    angle (this is caused when you export from a 3D app with a different co-ordinate system to Unity)
  • Place your mesh by moving the parent node
  • Remove the second tile mesh

Settings

Once you have your mesh as water you can begin to play with the settings. Select your
Water4ExampleSimple node, and check the parameters in the inspector

Water Base


Planar Reflection

Here you can enable the reflections to include (or not) the skybox

Specular Lighting

You can adjust the specular power from here

Gerstner Displace

Here you can adjust the settings for the wave generation created by a Gerstner algorithm

Water art tips

  • Water absorbs red light from the spectrum reflecting back more green and blue rays in additions
    to sky which gives it the impression of being Blue in colour so: 
    • Don’t make your surface blue, but if you use green and blue colours in shallow water such
      as pools on the surfaces below the water you can help with the illusion
    • (This is why Pool designers use green/blue/turquoise tiles)

Top with blue and green tiles/edging - Bottom with grey tiles and pink edging
  • Moderate the effects, subtlety can be everything to help suspend disbelief, be sure
    to experiment but moderate:
    • Scrolling speed of normals
    • Reflection
    • Refraction
    • Fresnel and Normal strengths
    • Displacement
  • One useful tip is to turn practically everything off /0 and then build up the effects to get the
    desired impact
Facebook LinkedIn StumbleUpon Twitter

No comments: