Page 1 of 1

Water, lava, grass…

PostPosted: 26 Jan 2012, 01:16
by MCMic
SuperTuxKart is becoming quite pretty these times, but some elements are still ugly.
The water is one of them, it's particularly weird, flat and unrealistic!
The lava have the same problem (because it have the same look, but it should be less liquid)

Would it be possible/easy to have a nice water appearance in SuperTuxKart?
The main problem is the limit between water and ground which is highly unrealistic.
Could STK have something like this : http://youtu.be/QzVELl-ugf8 (it's made with irrlicht too)

And an other little thing that could add some beauty to STK would be some 3D grass.
Something like that : http://youtu.be/IbLm3t_dCa8

Of course these features would be deactivable in the graphic options, but it would help SuperTuxKart to have a better look.

What do you think?

Re: Water, lava, grass…

PostPosted: 26 Jan 2012, 01:50
by Auria
Hi,

I sure agree, especially about water. Unfortunately the one you linked to is written in HLSL (DirectX) while we use GLSL (OpenGL). So we'd need to find a GLSL water shader or write one (but frankly I personally have no idea how to write a good water shader)

3D grass could be interesting, I could check if it's hard to integrate. Unfortunately this extension you linked to has not been updated in years so I assume some work will be needed

Re: Water, lava, grass…

PostPosted: 26 Jan 2012, 10:00
by MCMic
Ok, thanks for the informations.

I'll see if I find any GLSL water shader.

Re: Water, lava, grass…

PostPosted: 26 Jan 2012, 10:23
by acme_pjz
Hi,

Auria {l Wrote}:So we'd need to find a GLSL water shader or write one


Check 0 A.D. it must have a nice GLSL water shader :D

Re: Water, lava, grass…

PostPosted: 27 Jan 2012, 00:50
by Funto
Unfortunately, making a good water effect needs a bit more work than just applying a shader...
A possibility I know is to:
- render the scene without water to a FBO - color results go in a texture A, depth goes in a texture B
- render the scene with the camera vertically reversed to a texture C
- render a quad with a custom fragment shader that, for each pixel, samples A for refraction, B for making a fog effect (darker for deep points), and C for reflection. We generally use a Fresnel term (camera angle dependent) to determine the amount of reflection and of refraction at each point, + use a normal map and a dudv map for distortion. Finally, we need to translate the normal map and the dudv map for simulating the water current.

I have a code that does just that somewhere, but it needs to be adapted to Irrlicht, if you feel like doing it Auria :)

Re: Water, lava, grass…

PostPosted: 27 Jan 2012, 01:52
by Auria
Funto, I think we can start with something simpler ^^ Maybe just the classic moving normal map, and a bit of specular highlights and some reflections from an environment map

Re: Water, lava, grass…

PostPosted: 28 Jan 2012, 00:11
by Funto
Sure :)

Re: Water, lava, grass…

PostPosted: 29 Jan 2012, 17:57
by Auria
Hi,

I started some work on water : http://imageshack.us/photo/my-images/37/watert.jpg/
It looks much nicer animated than on a static screenshot however. It's still not as nice as in recent games but at least a good improvement

Re: Water, lava, grass…

PostPosted: 29 Jan 2012, 18:23
by MCMic
Good to hear :-)
The lava of the overworld is also really weird, while approaching it it feels like it's retracting or something like that.

(Can your work be tested in the overworld with the svn version?)

Re: Water, lava, grass…

PostPosted: 29 Jan 2012, 21:23
by Auria
MCMic {l Wrote}:Good to hear :-)
The lava of the overworld is also really weird, while approaching it it feels like it's retracting or something like that.

(Can your work be tested in the overworld with the svn version?)


Yes latest SVN features the new water

Re: Water, lava, grass…

PostPosted: 30 Jan 2012, 15:15
by MCMic
I've been able to try it.
The main problem is still the water edge…
I really don't know how to fix tart but it's highly weird looking, especially with its animation.
The water should have little opacity near the edge, we should see some gradient of opacity or something like this.

Re: Water, lava, grass…

PostPosted: 30 Jan 2012, 16:47
by Auria
agreed, there is still room for improvement