Sign in to follow this  
mk1x86

Rendering refraction and transparent objects

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
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
[quote name='Lauris Kaplinski' timestamp='1353161719' post='5001762']
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.
[/quote]

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
[quote name='mk1x86' timestamp='1353168344' post='5001775']
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 :-(
[/quote]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this