Photorealistic flowing water

Started by AW999, April 11, 2010, 10:59:51 PM

Previous topic - Next topic

AW999


I'm wondering if anyone has any idea how to produce an effect similar to the flowing water you can see in the following video of "Big Game Hunter 2010" at c. 4:26 onward and again c. 5:07 onward - http://www.youtube.com/watch?v=H458jdZov48&feature=related

It looks like they've got a refraction effect as well as the obvious surface foam flowing along (which is easy enough). I guess my question is: how do you produce the refraction effect?

EgonOlsen

It's a shader effect, i.e. you have to write yourself some pixel/vertex shaders for this.

AW999

Quote from: EgonOlsen on April 11, 2010, 11:23:42 PM
It's a shader effect, i.e. you have to write yourself some pixel/vertex shaders for this.

  I've been reading a bit on the subject of shaders, and apparently they have to be coded in assembly language?  I know assembly, but how is that done via jPCT ?  Is there a tutorial somewhere?

EgonOlsen

No, you don't have to do it this way. You can use GLSL, which is more like a high level language...like a variant of C. You can find a simple example here: http://www.jpct.net/wiki/index.php/Shaders

However, creating a realistic water shader is an art form and once you enable shaders on an object, you'll have to do a lot on your own that the fixed function pipeline will do for you otherwise (like lighting and stuff).

AW999

Quote from: EgonOlsen on April 15, 2010, 09:10:31 PM
No, you don't have to do it this way. You can use GLSL, which is more like a high level language...like a variant of C. You can find a simple example here: http://www.jpct.net/wiki/index.php/Shaders
However, creating a realistic water shader is an art form and once you enable shaders on an object, you'll have to do a lot on your own that the fixed function pipeline will do for you otherwise (like lighting and stuff).

  You know, I'll bet they produced that flowing water effect just by making an animated texture for the underwater rocks etc, with a moving refraction pattern; then placed another object above that for the surface foam patterns etc.  Or wouldn't that work very well?

AW999

Since shader code runs on the 3D graphics card (correct?), what happens if another program is also running shader code at the same time?  I would think multitasking would really foul things up here...

EgonOlsen

No problem. The different contexts will separate this. In fact, even non-shader graphics are using some pre-defined shaders on current hardware, so from the hardware's point of view, this makes no difference.