Menu

Welcome, Guest. Please login or register.
April 08, 2020, 11:50:13 pm

Login with username, password and session length

Author Topic: [TUTORIAL] WotLK "Procedural" Water  (Read 3479 times)

inico

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 243
    • View Profile
    • http://www.youtube.com/inicocustom
[TUTORIAL] WotLK "Procedural" Water
« on: November 04, 2016, 08:02:05 am »
In this tutorial we will learn how the so called wotLK procedural water works, and how to activate it.
This water was added to the game files in patch 3.0 for internal testing only, so keep in mind that it's not perfect. It's called procedural but actually isn't, because nothing is created algorithmically, it's just a group of textures that interact with each other and give a nice visual effect.
There are some patches available online with this water activated, but most of them have errors or look bad (based on my own judgment). We will also learn how to improve it and customize it.

Tools


-MPQ Editor (or any other MPQ reader)
-Any DBC to CSV converter, such as Wow Parser
-Notepad
-Any BLP converter
-Photoshop (or any other image editor)

Step One - Editing the DBCs


Open MPQ editor and extract the file "DBFilesClientLiquidtype.dbc".
Convert this file to CSV (you can't edit it directly with a DBC editor for some reason) and open it with notepad.
Each line corresponds to a liquid type. The one with ID 100 is the procedural water. We will do a line swap.
You have to delete these entries: 1 (Water), 2 (Ocean), 5 (Slow Water), 6 (Slow Ocean), 9 (Fast Water), 10 (Fast Ocean).
Now copy the line with the procedural water and give it the same name and ID of the entries you deleted.


http://i.imgur.com/cC87I59.jpg

You will notice that there are 2 kinds of water: simple water and ocean water.
If the entry has "Water" in its name, replace the "1" in the 4th column with "0". It should look like this:

http://i.imgur.com/a484Hvl.jpg

Also, if the entry has "Water" in its name, go to column 20 and replace "proceduralOceanDepthTex" with "proceduralRiverDepthTex". The game uses a special illumination for the ocean, so this step is important or your water could look weird.



Technically we are done, but there is one last thing we can do:
Go to the column 21 (it's the last texture in the line) and replace "XTextures\ocean\ocean_h.%d.blp" with this transparent texture: "World\GENERIC\PASSIVEDOODADS\ParticleEmitters\DemonGlow04.blp".



Doing so will remove this pointless reflection:


It's quite annoying and unnatural because it goes against the position of the sun. It's better to remove it, but totally optional.

Now you can save your CSV and convert it back to DBC.

Note: you can also swap the wintergrasp and hyjal water if you want. Just check the spell id in column 6.

Step Two - Extracting the missing textures


As you may already noticed, the procedural water uses a few textures that don't exist in-game.
Blizzard tested this new water internally, that's why they never added the textures to the WotLK client, but they are present in updated client versions.
You can download the missing textures HERE.

If you want to extract them by hand, just open an updated wow client (4.x or beyond) and extract the following textures:
XTexturesoceanbasicReflectionMap.blp
XTexturesoceanbasicWaterHeightTex_X.blp ("X" is a number between 1 and 32, you must extract them all)

Rename the folder called "ocean" to "procWater" and it's done. You should have 33 textures, something like this:
XTexturesprocWaterbasicReflectionMap.blp
XTexturesprocWaterbasicWaterHeightTex_1.blp
XTexturesprocWaterbasicWaterHeightTex_2.blp
XTexturesprocWaterbasicWaterHeightTex_3.blp
etc.

Note: the reflection texture has a unique compression and most blp converters can't read it. If you are having trouble trying to convert this image, install BLPView, preview the texture in the Windows preview pane, take a screenthot and paste it in a new document (768x128).

Step Three - Tweaking the Textures


Reflecting Texture


Now you can test the water in-game. If you did everything right, it should be working correctly. BUT it can look much better.
Before starting, it's important that you understand how the reflection texture works. The game only reads the texture if it's 768x128 (width x height). Bigger or smaller images won't work.
The texture is divided into 3 sections:


The 1st section is a panoramic photo, the reflection itself. The texture bends to form a ring around your character (from another point of view, it wraps around a cylinder). Then, the 2nd section of the texture fills the gap at the center of the ring.
The 3rd section overlays all layers. The farther from the center, the more it becomes distorted. Also, it creates some small waves.



Now that we know how it works, let's analyze this image:



This is how the procedural water looks with the default texture. Yes, it looks like radioactive waste. We have a reflective texture with a lot of green, and the 3rd section of the texture overlays even more green, messing the original color of the water (it should be blue, not yellow).

-The first thing we must do is opening the texture with photoshop and removing the sun, because the water is always reflecting the sun, even at night, and it doesn't look good.
-Then, we must desaturate it. If the image is in black and white it doesn't mess the original color of the water (if the water is blue and your reflective texture is red, you will get purple water). You should avoid using color.
We can also darken it a little bit and give some yellow to the third section of the texture. This will give us subtle golden reflections.



Now it looks much better.
In case you want to remove the 3rd section because you don't like the overlay reflection or waves, just open the texture in photoshop and fill the 3rd section with black (or replace the texture in column 16 with a transparent texture).
You can even make a lot of new water ids, each one for a different zone, with a different reflective texture (you just need to change the texture name in the DBC), or you can make new liquids, as this "mana water":



The "wave effect"


You will notice that after some time the water starts doing some kind of fractal movement, creating a weird wave effect. It can look good in the ocean, but a little out of place in ponds or lakes.
This is caused by texture tiling. In order to repeat the reflective texture, the game tiles it. Since the texture has different contrast levels, it makes an optical illusion similar to a succession of waves:


This effect is hardcoded into the shader (even filling all collumns with 0 in Liquidtype.dbc won't change it), however you can make it less noticeable by using a dark texture with homogeneous contrast, like THIS ONE. You will see less reflections, but the "wave effect" is almost gone:


You can use the default texture for the ocean and the one with less reflections for small bodies of water, but it's a matter of taste.

Ripples


The ripples are created by the sequence of 32 textures named "BASICWATERHEIGHTTEX". They distort the reflection texture. Each one of them is a frame. Basically these textures are normal maps simulating movement and depth.



You can also try to apply other textures, but I won't get deeper into that, because I think it looks good with the default sequence, and it's quite difficult to make a new animated normal map.



Player wakes and splashes


If you want to update the old wake and splash textures, you have to replace the following files:
XTEXTURES\Splash\splash.blp
XTEXTURES\Splash\wake.blp

Here are some textures I made that match procedural water way better than the default ones:

(You can download them HERE)

Water brightness


Procedural water is brighter than classical water. This is more noticeable at night (specially in places like Theramore or Booty Bay).
This happens because the texture is not affected by the diffuse and ambient lighting (the same occurs with the default water, but since it has transparency and the material beneath is indeed affected by lighting, you don't notice this effect).
There are a few things you can do to counter this issue:
-Darken the reflection texture.
-Decreasing the water color lightness by half in the DBCs (LightIntband.dbc, last 4 IDs, more information HERE).



Conclusion


That's all the basic information you need to know about this "procedural" water. You can also download a few custom textures I made HERE, so you can see how different the water looks with different environments. Feel free to make your own textures and explore this topic even further.
Also, remember that this water is some kind of alpha testing phase for the liquid system released with Cataclysm, so you can find some artifacts like random lines in the ocean.
My goal with this tutorial is to stop people from asking for procedural water mods, it's fairly simple to do it yourself.
If you have more information to contribute, please send me a private message and I will add it to the tutorial.

Thank you. Have fun!
« Last Edit: June 24, 2017, 09:13:33 pm by inico »

Uthil

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 283
    • View Profile
Re: [TUTORIAL] WotLK "Procedural" Water
« Reply #1 on: November 04, 2016, 08:26:56 am »
Great piece of work mate. Really good explanation on how to. Thanks for the tut!!!!! :o  :P  :P
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Like my project and you like to support me, you can do it here!

inico

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 243
    • View Profile
    • http://www.youtube.com/inicocustom
Re: [TUTORIAL] WotLK "Procedural" Water
« Reply #2 on: November 19, 2016, 11:06:04 pm »
Post updated. Added information about the "wave affect" or "lava lamp effect" that some people complain about.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [TUTORIAL] WotLK "Procedural" Water
« Reply #3 on: November 20, 2016, 12:22:03 pm »
This is a great tutorial. Good job.  :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

inico

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 243
    • View Profile
    • http://www.youtube.com/inicocustom
Re: [TUTORIAL] WotLK "Procedural" Water
« Reply #4 on: April 23, 2017, 12:56:36 am »
Post updated. Added HD textures for player wakes and ripples. Fixed some broken links.

terrorbringer

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 6
    • View Profile
Re: [TUTORIAL] WotLK "Procedural" Water
« Reply #5 on: May 25, 2017, 04:58:24 am »
Hi, I followed the tutorial, but the canals in Stormwind and the water of the valley of spirits in Orgrimmar is green and white, other than that, this tutorial worked great.