PDA

View Full Version : a bubble with refraction effects?



usfish
02-26-2008, 08:54 PM
I am new to openGL.. I wanna write a transparent bubble that can have refraction effects, just like a real one in the air, could any one give me some hints to do that?

I heard that we can't actually implement the refraction effects in openGL directly, what we might do is to use another software to build another model and use texture matching skills to put it back. is that true?

Thank you

-NiCo-
02-27-2008, 02:49 AM
You mean something like this (http://http.download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/dispersion.zip)?

N.

behe0815
02-27-2008, 04:38 AM
ATI has an older demo showing a soap bubble. http://ati.amd.com/developer/samples/bubbleshader.html

dorbie
02-27-2008, 07:05 PM
Bubbles tend not to have a visible refraction displacement due to their infinitessimal thickness, other effects dominate.

They have significant reflection contributions, internal and external governed by Fresnel's law and exhibit thin film optical effects due to the self interference of light at different wavelengths (due in part to internal reflection).

http://en.wikipedia.org/wiki/Thin-film_optics

It may help you if you know specifically what effects you're trying to model and the accuracy your require going into this project.

A first order approximation would be 2 pass (just to keep arithmetic simple):

Draw BG first then:

spheremap (on back bubble surface) * Frensel's coefficient of reflection. (with 1-Fresnel's alpha to diminish scene behind bubble)

Then repeat for the front surface (would be geometry and different normal).

Actually when I think about it there's another Fresnel's on the way in and out of each of these passes if you want to calculate it(my head hurts now).

Anyhoo add to this some noisy rainbow modulation to each of these terms and it'd probably look pretty good.

Beyond this it'd get very tricky and you'd have to model varying bubble thickness and wavelenght phase shifts, I don't think you want to go there. It's somewhat random anyway.

usfish
02-29-2008, 02:52 PM
Thank you so much! :)