# Thread: a bubble with refraction effects?

1. ## a bubble with refraction effects?

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

2. ## Re: a bubble with refraction effects?

You mean something like this?

N.

3. ## Re: a bubble with refraction effects?

ATI has an older demo showing a soap bubble. http://ati.amd.com/developer/samples/bubbleshader.html

4. ## Re: a bubble with refraction effects?

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.

5. ## Re: a bubble with refraction effects?

Thank you so much!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•