Tutorial: Realistic (well, almost) water with Hook5
Introduction
As you may know there are 2 ways of making water in Hook5. They both have pros and cons
1. Using water object
Pros: transparency, quite realistic water depth and refraction, environment reflection
Cons: lack of object reflections
2. Using mirror
Pros: object and environment reflections
Cons: lack of refractions & transparency (by default)
To clarify, we can make the mirror semi-transparent - as shown below in method section - but it still there is no refraction and object beneath the water level look like seen through a thin glass.
Concept
So I had this idea to combine those two effect and after some unsuccessful attempts I've finally came with a solution. Here is the...
Method
What we need:
Spoiler
- Obviously Hook5 - full version
-
Some water ripple normals. You can get them somewhere around here, google them or simply download this pack water_normals.7z
Put them in your _hook5data folder - A flat H5 object such as grass_texture_01.h5m from Siberia object pack. You can get it here water_h5_object.7z
- Text editor (Notepad will do)
- Any photo editing software (Photoshop, Paint.net, Gimp etc)
Step 1: water object
Let's put an water object first. For those who are not familiar with the process, here are the instructions
- Click 'Create Water' in level pop-up
- Select flat H5 object as a model file. For instance grass_texture_01.h5m mentioned above
- Position, rotate & scale a water object to fit your scene
-
Now we need to apply some water ripple normals. Unfortunately we can't do this in H5 interface, we need to use a text editor. Save the level and open _level_definition.txt in text editor. Find the water object we just added and add these 2 lines at the end of its section
override.0.diffuse.texture = _hook5data\water\water_noise.dds override.0.normals.texture = _hook5data\water\water_noise2_4x4.dds
Experiment with different textures from water folder to match your scene. Reload level after each change in the text editor.
-
Set up other water parameters to your liking. Mine from the screen above are as follows:
Spoiler[water_still] enable = true type = hook_water style = object file = _hook5data\water\grass_texture_01.h5m position = 0.000000, 0.155000, 0.000000 rotation = 180.000000, 90.000000, 0.000000 scale = 10.000000, 0.010000, 10.000000 shallow_color = 0, 0, 0, 255 deep_color = 36, 37, 52, 255 wave1_scale_normal = 1.000000 wave1_scale_uv = 4.000000, 4.000000 wave1_speed = 0.000000, 0.000000 wave2_scale_normal = 2.000000 wave2_scale_uv = 6.000000, 6.000000 wave2_speed = 0.000000, 0.000000 fog_distance = 2.000000 reflection_amount = 1.000000 reflection_colorize = 1.000000 refraction_amount = 1.000000 glow_intensity = 0.000000 cull_mode = 1 parent_name = override.0.diffuse.texture = _hook5data\water\water_noise.dds override.0.normals.texture = _hook5data\water\water_noise2_4x4.dds
Note that X rotation is set to 180 & cull_mode set to 1 (reversed normals). I don't know why, but it works better than default 0 & 0. But it may not for you so again, experiment.
Step 2: Mirror object
Now hide the water plane and let's create the mirror object.
- Click 'Create mirror plane' in level popup
- Scale position, rotate & scale mirror to fit your scene. Make sure the mirror is just below the water plane. Y value should be 5mm (0.005) less that the water plane's Y.
-
Apply water normal of your choosing to the mirror (normals map file) and set the distortion scale to some low value, 0.005 for instance - or more for more disturbed water.
My settings are as follows.Spoiler[water_mirror]
type = mirror
enable = false
position = 0.000000, 0.150000, -1.069999
rotation = 90.000000, 90.000000, 0.000000
scale = 4.000000, 4.000000, 1.000000
own_render = true
darkness = 0.000000
diffuse_map =
normal_map = _hook5data\water\water_noise2_8x8.dds
distortion_scale = 0.005000
specular_map =
script_name =
parent_name =
You should end up with something like this
Step 3: Mixing
Unhide the water plane object and you should have scene like this
Note that the water distorts the mirror even more but the mirror is not transparent and water distortion & depth is missing. The trick is to make the mirror a little bit transparent. To do that we need to create custom specular texture for the mirror.
- Open photo editing program and make new texture. It doesn't need to be big. 128x128 px will do.
-
Select Red channel. This channel is responsible for mirror transparency. Fill it with about 50% grey.
Note that this value works for certain camera angles only (around 45 degrees). Real water reflections are more prominent when you look along it (low angle) than if you look down. You should change this according to your scene. If you look at water from above then it should be darker (about 30%). If along the water it should be lighter (about 85-100%). Experiment with the brightness of this channel to fit your scene. - Select Green channel. This channel controls mirror fuzziness. The darker it is the blurrier is the reflection. I've set mine to 85% to make nice soft reflection.
- Select Blue channel. This one controls mirror glow. We don't want any, so fill it with pure black.
- If you've done it right, you should end with some yellow-green-ish texture. If you're too lazy to follow the tutorial - which I recommend to understand the RGB values - you can download some prepared ones here water_specs.7z
- Save the texture to _hook5data/water
- Finally, select the texture for specular map file of the mirror object
Voila! Ta Daa, Bum Bada Bum! Crash!
We have a nice water with both reflections & refractions!
Downloads
Here are all the files mentioned in the tutorial + a level definition for water object and mirror. Just copy to your room folder and include in your _level_definition.txt OR copy/paste into it.
water_normals.7z water_specs.7z water_definition.7z water_h5_object.7z
Conclusion
Although the results are not perfect they IMO are better than using just one method. You can tweak the effects to your liking by tinkering with all the parameters and different textures.
You can also make the water animated by changing wave1_speed & wave2_speed but bear in mind you can only animate the ripples on the water object. The ripples on the mirror object are static and can't move. However because the water plane distorts the mirror as well they look like they animated too.
Let me know in comments what do you think and if you have any questions about the process I'm happy to answer.
Have fun and don't get wet
-
7
-
2
-
14
-
5
9 Comments
Recommended Comments