Jump to content
  • Advertisement
Sign in to follow this  
mk1x86

Rendering refraction and transparent objects

This topic is 2194 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

Hello there, I'd like to implement refractive objects (water, glass etc) and two problems arise:

1) In order to use refraction I need to render everything else to a texture. Is that correct or is there another way?

2) Since glass is transparent I need to order it back to front. If 1) applies I'd have to render the multiple times. In case of three transparent objects where the second one is refractive:

a) render solid geometry to texture
b) render 1st transparent object to texture
c) render refractive object using the texture from a) and b)
d) render 2nd transparent object

Now this seems like a performance killer and I suspect there're better ways to do this. I don't know how though and my search didn't come up with anything informative. Maybe you have a solution to my problem?

Share this post


Link to post
Share on other sites
Advertisement
I do not know any other way.
Even worse - to have proper refraction it is not enough to simply render all your scene to texture, because you have to render it using "refracted" camera viewpoint. There may be areas that are not directly visible to camera but become visible via refraction.

Normally such problems are solved via level design - avoid placing too many semitransparent objects in such way that they need expensive processing.

Share this post


Link to post
Share on other sites

Even worse - to have proper refraction it is not enough to simply render all your scene to texture, because you have to render it using "refracted" camera viewpoint.


You can often cheat with this though, the illusion of refraction can still be quite believable even if it's not completely correct. Getting physically correct refractions will open up a nice large box of headache inducing issues, so maybe cutting some corners here and there is the way to go.

Share this post


Link to post
Share on other sites
Indeed I don't need proper refraction, just the illusion. But ordering transparent and refractive objects is certainly an issue. I expect to have refractive objects on top of everything else most of the time but specifically for water planes this is an issue :-(

Share this post


Link to post
Share on other sites

Indeed I don't need proper refraction, just the illusion. But ordering transparent and refractive objects is certainly an issue. I expect to have refractive objects on top of everything else most of the time but specifically for water planes this is an issue :-(


At least you can usually avoid transparent objects behind water plane. And you never need two water planes behind each other ;-)

Share this post


Link to post
Share on other sites
Then replace water plane by window pane. Unfortunately it's still the same problem. There must be a solution :-(

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!