Tips for water in Unity
This post will show you how to create water with 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
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 couple of 3D meshes representing your water surface, with:
- WaterTile script
- Water shader
An empty object indicating the world space placement with:
- A Water script which exposes the colours, normal texture and main parameters for the effect
- A reflection script
- An optional lighting script for specular effects
- An optional displacement script
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
- Open up Water4 folder
- Drag the Water4Example (Simple) 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 (must be in your project)
- Rotate the Water4ExampleSimple parent node 90 degrees, if your mesh comes in at the wrong angle (this can be 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
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.
This script is for enabling/disabling realtime planar reflections. Reflections are claculated in relation to the height of the parent mesh that has this script attached to. So the local Y transform of child meshes should be 0. Here you can also enable the reflections to include (or not) the skybox.
You can adjust the specular power from here and drag’n’drop any transform to indicate a specular light source. This can be your directional light transform or any other game object (doesn’t need to be a light).
Here you can adjust the settings for the wave generation created by the Gerstner waves generation algorithm.
Water art tips
- Go and check out some actual water – its always wise to get some visual ref for what you are trying to do. Make a video if you can.
- Water absorbs red light from the spectrum reflecting back more green and blue rays, in additions to sky, which gives water the impression of being Blue in colour so:
- You can’t make your surface blue (and you probably shouldn’t) but if you use green and blue colours on the surfaces below the water such as a pool you can help with the illusion.
- (I guess this is why Pool designers use green/blue/turquoise tiles).
- The darker the blue, the deeper water appears – you can use a darker colour on the bottom and tint the refraction darker.
- Moderate the effects, subtlety can help suspend disbelief, be sure to experiment but think about moderating:
- Scrolling speed of normals
- Fresnel and Normal strengths
- One useful tip is to turn practically everything off e.g. set sliders to zero and then build up the effects to get the desired impact.
- If you have a convex mesh (such as water fall/pool lip) add poly detail to the curve to help the water ‘bend’.
Next time > Water 4 Advanced is the same tech but with foam and depth extinction.
15 코멘트코멘트 구독
코멘트를 달 수 없습니다.