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?
You mean something like this?
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).
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.