Author Topic: Photorealistic flowing water  (Read 2336 times)

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Photorealistic flowing water
« on: April 11, 2010, 10:59:51 pm »

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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Photorealistic flowing water
« Reply #1 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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Photorealistic flowing water
« Reply #2 on: April 15, 2010, 09:05:48 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Photorealistic flowing water
« Reply #3 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).

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Photorealistic flowing water
« Reply #4 on: April 16, 2010, 12:43:18 am »
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?

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Photorealistic flowing water
« Reply #5 on: April 22, 2010, 01:58:59 am »
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...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Photorealistic flowing water
« Reply #6 on: April 22, 2010, 07:03:15 am »
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.