Page 1 of 1

Realistic water

Posted: 2012-01-17, 23:21
by Haimi
Hi guys'n'gals

I thought about making the Water more realistic. I only did the normal water in CaWE... but it does not move and when the camera is inside the water, there is no water visible. So I think this list could tell about all the things that are needed for creating realistic water:
  • Water surface waving like on wind I don't know if it is possible right now or if it can be done vie textures but that would be one thing to make it very realistic
  • Water texture from inside When the camera is underwater, it seems like there is no water. Is there another possibility to see the surface from the inside, other than to hollow the water "block"?
  • Camera filter underwater When the camera is under water, there should be a blue-filter on the camera, maybe with little particles floating... Can this be done with cafu or do I need to implement it myself?
  • Underwater-Sound-shader Like a shader that allies to every sound that is hearable from the camera's position, but changes the sounding.
  • Moving speed Okay, the simplest in the end, the character animations and the moving speed should be slower in the water, but I think this must be implemented in the specific game.
So, I hope i named everything. If anyone else has got something I've forgotten or I got wrong, please add to this post.

Re: Realistic water

Posted: 2012-01-18, 08:16
by scott
You forgot proper reflections, right now the water only uses a cube map which isnt suitable for all situations.

Re: Realistic water

Posted: 2012-01-18, 16:13
by Carsten
Good points -- each of which would make a nice ticket in the issue tracker. ;-)

About your first point: you have seen the (fake) waves on the water in the TechDemo map, have you? (Just making sure, these waves are not visible with old OpenGL drivers or hardware.)

About your third point: I happened to play "Rage" recently, and what I really liked where the small particles representing dust or fine sand/dirt in the air, reflecting the sun but barely visible. Same concept as for floating particles underwater.

So carrying these into the tracker would be more helpful than keeping them here, as they won't be forgotten or lost in the tracker.

Note however that, at this time, you would have to spend some work on them yourself, as my own schedule is filled with other tickets that for me, at this time, have higher priority.
On the other hand, each of these points is probably a good, nicely isolated topic that is well suited to dive into hacking the Cafu Engine. :up:

Re: Realistic water

Posted: 2012-01-18, 18:02
by Haimi
Just double checked and - yes, the water surface looks rather realistic, even on my linux machine on software rendering :)

I am just created the tickets.

Re: Realistic water

Posted: 2012-01-22, 13:28
by HWGuy
When the graphics system is updated I'll have a simple water shader made available for Cafu, unless someone beats me to it.

Re: Realistic water

Posted: 2012-03-29, 04:37
by Kai
Hi guys

Water in general can be a pretty complicated task.
I would keep things short and refer to your ideas above :)

Water surface waving like on wind
Can be done using either real vertex shader based displacement (using screenspace grid deformation) or with use of some fancy pixel shader displacement
Or both XD

Wave algorithms are available in many ways, some gamedevs use other apps to simulate and then compress the motion in a map or a vertex solver ( like Killzone 3 waves using a prebaked simulation made in Houdini )
There is also a nice idea about having multiple normalmaps to emulate different flowspeeds and directions for the water ( like around obstacles)
Left for Dead 2 uses a quite nifty way to control flow based on a texturemap blending and some precalculated vectorsmaps)

Water texture from inside
usually that would just require to flag the water surface as two sided so it renders both sides, but since the surface itself is treated as a special object type that would require some code modification (?).
Also, you would not see the "outside" as the surface is not transparent or refractive as far as i remember. And it would need a render to texture function.

Camera filter underwater
You are referring to a volume using a post render filter
Usually engines can use custom volumes to create a different effect or behavior when the player enters it. In case of water it usually involves a drag effect and some lower gravity. In addition with some post render effects like fog, render to texture distortion, blur or fade effects.

Moving speed
Same idea again with the volume type, it would alter motion, camera as well as sound (dampening down all high frequencies)