Thursday, 22 November 2012

Water... a lot of it!!


The first challenge at White Paper Games came in the form of water. Replicating realistic water is quite a feat on its own, however, for Ether, we required the water to make sense with the world and follow the artistic style that we had already established for the game. This created a number of challenges that needed to be solved:

-          How do we make the water hold up to the visual style of Ether?

-          How can we make water using the minimum amount of resources possible?

-          Can we make the water reusable and applicable to non-ocean instances?

-          How can we animate the water without any physics simulations?

This set of questions had to be answered and here is the result we have come up with:


The first and foremost concern I had was to keep the visual style of Ether intact. Therefore, the normal map that would create the ripples would have to be hand painted.

I used Corel Painter for this instead of Photoshop. In Corel, you can adjust the amount of paint added to the brush and make it lit so that it feels thick and painted on canvas; I felt this was crucial in order to get a good painterly effect on the water. The result was pretty bad for the first set of tries but I ended up getting an effect that was quite nice:


Now I just had to mix a couple of sets of normal and pan them in different directions and a subtle effect was created!



Now that the ripples were sorted, I needed to focus on animation… an ocean has waves and this couldn’t be simulated with physics considering our limitations, so a workaround had to be found. I started doing a lot of research into how to solve this and began to create a solution to this problem.

Using the world displacement node in the material, I could displace certain parts of the mesh based on a mathematical expression. The fastest way to do this was using a Sine wave. In short, it creates a wave that varies from black to white, making everything that’s white push up, and everything that’s black go down. The good thing about this is that it’s extremely cheap (only 4 instructions in the material).  The only downside to this is that it works based on the amount of verts the mesh has, so it meant our water shader had to be quite highpoly. In the end, we went with a 2048 triangle mesh, which is still pretty low poly for a whole Ocean!

Here is a small picture of the wave expression:


 The next problem was to make the oceans depth believable and also make the foam for the water when it hits other meshes.

For the foam, using a depth biased alpha with a foam texture worked fine. For the translucency, playing with a few values did the trick and the results were quite convincing.

Here are a couple of videos, one explaining my approach, another just showing the water in action, inside the game:





This expression is highly reusable, in fact, it became the base for all foliage and wind based materials in the game! So I’m very happy I took the time to make sure this material was spot on and game ready as soon as possible.

Next, I will begin to talk about the foliage for Ether!

Stay tuned!!

No comments:

Post a Comment