PDA

View Full Version : New demo of reflections and refractions with fragment shader


Humus
11-Apr-2002, 18:08
The almighty Humus releases yet another demo :P

It's a demo of a pretty realistic water surface. The waves are created dynamically by generating a texture with some perlin noise. The refraction is done by rendering the scene to a texture and then the wave texture is used to pertube the texture coordinates on a per pixel level in a fragment shader. Similarily for the reflections, except that they are rendered to the texture with y inverted. Finally, I combine the refraction and reflection by interpolating between them depending on the view angle.

Works on Radeon 8500 only at this time.
Get it here:

http://esprit.campus.luth.se/~humus/?page=3D

pascal
11-Apr-2002, 18:51
Works on Radeon 8500 only at this time.

My card is gf3 :(
Could someone post some pics? Thanks

edited: Humus if you have time why dont you converge all the tech from different demos in an single demo/engine? Something like the Ark demo but one that people can walk through it and control.

Humus
11-Apr-2002, 21:56
Well, my biggest problem is rather the lack of time. I coded this demo on time I really didn't have, or should have spent on more important stuff like school. Also, sometimes it's just hard to combine things into the same demo. For instance that StencilShadows demo, to put that shadows stuff into my GameEngine would have meant I'd have to rewrite a lot of stuff.


Anyway, here's pic:

http://esprit.campus.luth.se/~humus/3D/refraction2large.jpg

Entropy
11-Apr-2002, 22:40
Something is odd about the floor, or the floor/walls. It is difficult to see where the boundaries are. I get the feeling that you let the underside of the watersurface reflect light towards the camera. Or something like that. Or it may simply be that the parameters do not match life accurately enough. We have a lot of experience with water, after all. Difficult to judge, this late.

Entropy

nooneyouknow
12-Apr-2002, 04:49
1st off, looks great!!!
2nd, can you add some waves to the water? Just would likes to see water move up and down against the walls instead of it being straight.. I guess a water jet effect with some points sprites might be cool too :) heck, put a naked chick in there for good luck lol

Simon F
12-Apr-2002, 09:18
..I guess a water jet effect with some points sprites might be cool too :) heck, put a naked chick in there for good luck lol
Nah chickens don't float. What you want is a duck.

Kristof
12-Apr-2002, 09:39
Urmh... on what ATI 8500 driver does this demo work, I just tried the latest official one from ATI and it fails saying 2 extensions are missing. Help ?!

Randell
12-Apr-2002, 10:59
ditto on the 9x 9021's a GL_ARB one and an SGI one are missing (I think). I'm at work so cant remember for sure.

Dave B(TotalVR)
12-Apr-2002, 11:57
"Nah chickens don't float. What you want is a duck."

ROFLMAO

Hafnu
12-Apr-2002, 12:58
"Nah chickens don't float. What you want is a duck."


Would that be a fur covered duck?

Randell
12-Apr-2002, 13:07
would it even be a Videologic duck?

pascal
12-Apr-2002, 13:20
Thanks for the pic
Well, my biggest problem is rather the lack of time....Then congratulations again and go back to the books :wink:
And forget the Videologic ducks :lol:

Joe DeFuria
12-Apr-2002, 13:54
Kristof,

What OS are you using? I have been reading that Win 9x might have some issues with some of ATI's extensions on the Radeon 8500. If you are using Win 2K or XP, the latest Radeon 8500 drivers should work AFAIK.

Kristof
12-Apr-2002, 14:10
Win98, how can they have extensions that work in Win2K/XP but not in 98... odd, very odd... strange even... and there aren't even any ducks involved in this.... YET ;)

Bambers
12-Apr-2002, 14:51
Its the same with a lot of humus's demos. For some reason not all the extensions are supported in the 9x drivers. :-?

Humus
12-Apr-2002, 16:16
1st off, looks great!!!
2nd, can you add some waves to the water? Just would likes to see water move up and down against the walls instead of it being straight.. I guess a water jet effect with some points sprites might be cool too :) heck, put a naked chick in there for good luck lol

That would be possible. I do already tesselate the water into many smaller quads already to get better interpolation, so moving them a little in each vertex wouldn't be too hard.

Humus
12-Apr-2002, 16:24
And yes, the Win9x driver doesn't yet support the WGL_ARB_render_texture and GL_SGIS_generate_mipmap extensions. There are some "issues" with it (I have no insight in what those issues are), and since it still isn't supported I would almost say that it probably wont or can't be solved. I suppose I could workaround it though, for instance turning mipmapping off on the rendered textures, and use glCopyTexImage2d() as a fallback when the WGL_ARB_render_texture extension isn't available.

Randell
14-Apr-2002, 16:58
Excellent news Humus, the new leaked 9026 win 9x/Me drivers enable your refraction demo to work. So that area has been fixed.

Humus
14-Apr-2002, 21:26
Yeah, I just read on Rage3D that it works in Win9x with the 9026 driver. Guess I was all wrong then when I predicted that it probably wont be solved at all. :)

It's very great news!

Randell
14-Apr-2002, 21:31
BTW that was persoanl experience, I tried it out of curiousity with the new drivers and found it working.

Now if only Ground Control would work with 1 monitor :(

Basic
16-Apr-2002, 06:13
I realy hate it when this fora decides that you've been writing on a post for too long, and forces you to login again. (Flushing your post down the drain.)

So you get the short version:
It looks nice, but the specular highlights are placed on wrong places. The reflected highlight should not be further away from the water surface than the "direct" highlight.

There's also something odd about the blue tint in the reflection, and also in the ratio between reflectied and "refracted" light. I can't put my finger on it though, so I might be wrong.

Humus
16-Apr-2002, 11:09
It looks nice, but the specular highlights are placed on wrong places. The reflected highlight should not be further away from the water surface than the "direct" highlight.

I don't understand what you're trying to say here ... :-?


There's also something odd about the blue tint in the reflection, and also in the ratio between reflectied and "refracted" light. I can't put my finger on it though, so I might be wrong.

The reflection shouldn't have any blue tint in it, the refraction does though.

Basic
17-Apr-2002, 00:27
The upper left specular highlight is located ~2 wall-tiles above the water surface, which is slightly higher up than the camera. I assumed that the lower specular left highlight came from the same light, but going lightsource=>specular on wall=>reflection in water. But that highlight is placed ~4 wall-tiles below the surface (or equivalently ~4 wall-tiles above the surface before reflection).

It's not possible to place a light to give those two highlights, the lower left highlight must be somewhere 0-2 wall-tiles below the surface, or not be visible at all.

Hmmm, just realized something. Am I wrong when I think it's a specular highlight? Is it just a "firefly" in mid air? Then OK, the reflection could be right.

The reflection shouldn't have any blue tint in it, the refraction does though.

I agree. I just thought it looked like the reflection had a blue tint. In the part further away, you can't see anything from the texture below surface, but there's still a clear blue tint. Maybe it gives a different feeling when seen in motion.

Humus
17-Apr-2002, 09:19
Ah ... now I see what you mean, you're just judging the screenshot and haven't seen it in action :)
I was a little puzzled when you mentioned specular highlights ... there's only diffuse lighting in there. The white thingy is the light that's moving around in there. At the screenshot you're a little above the lights.

Tagrineth
17-Apr-2002, 18:09
You know what's missing though?

Those lights shouldn't just reflect, they should make the water's surface shine somehow. Ever looked in the general direction of the sun or moon over water?

Humus
22-Apr-2002, 00:11
You're right. Maybe I'll implement it sometime, don't count on it though.