Skip to main content
gamedev.net
🔒 Locked

post process underwater effect

Started by paulshady Sep 10, 2006 at 4:39 PM 2 replies 1.2k views
Original Post
paulshady
paulshady
Guys, I'm tryin to get this underwater effect going for a little demo. Basically the camera will be above the water, the water has animated waves and is partially transparent, and i want anything drawn below the water surface to have a sine-like wave to it....so heres what i was thinking. 1) render ONLY the water and anything behind it onto a texture 2) render everything EXCEPT the water to the back buffer 3) draw the texture with the water drawn to it over everything and add a sin-wave Is this how its done? If so, does my rendersurface need to be entirely transparent except for the water area? Thanks for any help guys!
paulshady
paulshady
hmmm, can anyone point me in the right direction....heres an image of what i mean:

wavy image

i want anything behind/under the water to have a post-processing sine-wave kinda thing happening. pretty much where the yellow square is where i mean.

thanks for any help.
Ezbez
Ezbez
Well, that's not really the best way to do it. Here's some steps that should be beter:

1. Render everything beneath the water normally (no distortions, no transparent-blue, just as if there was no water) from the perspective of the camera.
2. Copy the screen (which is right now just what is beneath the water) to a texture
3. Render the water with the above texture as its texture.
4. Apply a pixel shader that:
A. Calculates which point on the texture it should be based on the normal of the water at that point and the vector from the camera to the water. Then use the point on that texture as it's texture.
B. Adds some blue, or whatever other color

4A is the only really tough part. The normals for the water could be calculated from sines or similiar (though not very realistic, sines are better than nothing!). I'd be willing to bet that there's a gamasutra article about this if you search. :)
paulshady
paulshady
i kinda get what your saying
thanks man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.