Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin
Creating a Blog? Don't Forget the Feature Photo!! ×

Tutorial: Realistic (well, almost) water with Hook5


amaronap

1,696 views

Introduction

As you may know there are 2 ways of making water in Hook5. They both have pros and cons

1. Using water object

water.jpg

Pros: transparency, quite realistic water depth and refraction, environment reflection
Cons: lack of object reflections

2. Using mirror

mirror.jpg

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

  1. Obviously Hook5 - full version
  2. 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
  3. A flat H5 object such as grass_texture_01.h5m from Siberia object pack. You can get it here water_h5_object.7z
  4. Text editor (Notepad will do)
  5. Any photo editing software (Photoshop, Paint.net, Gimp etc)

Step 1: water object

Spoiler

Let's put an water object first. For those who are not familiar with the process, here are the instructions

  1. Click 'Create Water' in level pop-up
  2. Select flat H5 object as a model file. For instance grass_texture_01.h5m mentioned above
  3. Position, rotate & scale a water object to fit your scene
  4. 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.

  5. 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.

    water_object.jpg

 

Step 2: Mirror object

Spoiler

Now hide the water plane and let's create the mirror object.

  1. Click 'Create mirror plane' in level popup
  2. 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.
  3. 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
  1. mirror_object.jpg

 

Step 3: Mixing

Spoiler

Unhide the water plane object and you should have scene like this

water+mirror.jpg

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.

  1. Open photo editing program and make new texture. It doesn't need to be big. 128x128 px will do.
  2. 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.
  3. 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.
  4. Select Blue channel. This one controls mirror glow. We don't want any, so fill it with pure black.
  5. If you've done it right, you should end with some yellow-green-ish textureIf 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
  6. Save the texture to _hook5data/water
  7. 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!

result.jpg

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 😋

  • Like 7
  • Love It 2
  • Thanks 16
  • Thumbs Up 5

9 Comments


Recommended Comments

That was incredible! So many thanks! I had played with water on two of my entries last month, Russalka and The Devil

For the first one I tried something that would really benefit from yout tutorial, so thank-you for this 🙂 

 

 

  • Thumbs Up 1
Link to comment

Looks very realistic!  Have you measured the fps drop effect of this H5 water?  If so, would you share your experience?

  • Thanks 1
Link to comment
4 hours ago, drmls said:

Looks very realistic!  Have you measured the fps drop effect of this H5 water?  If so, would you share your experience?

TBH, I haven't noticed any. But that's because I have FPS limiter on and my 2080Ti runs H5 on steady 60FPS almost all the time. I have turned off the FPS limiter though to test. With mirror on it gets down from 80FPS to 60 in that scene. Water plane has no influence on FPS at all.

  • Like 1
  • Thanks 1
Link to comment

What a good idea.


It looks fantastic 🙂. I have tested it in the Akko Bath and the result is phenomenal. Although the effect greatly alters the general room lighting.


Regarding the FPS, the mirror consumes around 20% for me (like any mirror do in other rooms). Perfectly acceptable for me, although I don't know for others.

Edited by aykekarallo
  • Like 1
  • Thumbs Up 2
Link to comment
×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.