Jump to content
  • Advertisement
Sign in to follow this  
zurekx

Refractions

This topic is 3600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on an landscape engine, and Im about to add water. I just wonder, is it possible to get "perfect" refractions (assuming that the water is just a single plane)? For reflections it's easy, but is there any way for the refractions?

Share this post


Link to post
Share on other sites
Advertisement
Perfect is a rather subjective word. You can certainly get nice looking refractions. The usual way of rendering the refraction is very similar to reflection. You render your scene to a texture, project this onto the water plane and then disturb it along the water normal (can come from a normal map) with the projected texture coordinates.

Share this post


Link to post
Share on other sites
Yes, basically just grab the backbuffer before rendering the water, stretch it onto a texture, then project it...just like reflections.

Is this perfect? I don't think its optically correct...usually its good enough.

Share this post


Link to post
Share on other sites
solution that Matt Aufderheide and glaeken described is very good looking and used almost always today.
Although it's not physically correct (I'd rather say physically than optically ... because it's not just the refraction, which makes water look nice ... but more things - caustics, scattering, etc. etc.) ... if you want something physically correct, you'd need to use ray tracing.
But there are several solutions how to use rasterizers, cube mapping and some calculations with index of refraction to get almost correct refraction without ray tracing.
You just use cube map around the water, calculate refraction direction from eye direction and use this vector as lookup into this cube map texture ... then you'll have much more correct refraction

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!