Refraction

Started by
12 comments, last by Aeluned 18 years, 9 months ago
Quote:Original post by Ademan555
1. Render underwater with the water plane as a clip plane
2. render normals (or some kind of perturbation values) into a texture for the water
3. render this somehow perturbing texture coordinates with the perturbation values


follow step 1 as you said and store into an image. step 2, render the interpolated normals into a normal map. step 3 use the normal map and the underwater image, using the normal map as an offset map, access the underwater map. it sounds kinda confusing but read it a few times and it will make perfect sense
Advertisement
Quote:Original post by James Trotter
There's an example shader in glsl for a reflection/refraction effect in RenderMonkey. You might like to have a look at how it's done.

Hope this helps.


Sorry, I couldn't quite find the demo you were referring to. Got a link?

@Ademan555: that would be ideal. For my purposes, I'm always just trying to refract a background image...it's seems wasteful to have to upload 6 textures for that.
Quote:Original post by Aeluned
Quote:Original post by James Trotter
There's an example shader in glsl for a reflection/refraction effect in RenderMonkey. You might like to have a look at how it's done.

Hope this helps.


Sorry, I couldn't quite find the demo you were referring to. Got a link?


Actually, it might be a little awkward. You need to download and install RenderMonkey. It's a pretty big download as well. But, if you choose to do so, then load the "Glass.rfx" file, and have a look at how they implemented reflection/refraction. I believe they use a cube map, so it might not be what you're looking for.
Yay. Well, I got it working using nothing more than a GL_TEXTURE_2D.
Thanks for the help/references/discussion.

I think it looks OK: screenshot

This topic is closed to new replies.

Advertisement