Simulating Windows with Refraction
Some months ago I was approached by the Berlin-based Window-Manufacturing-Company “ISOGON” to help them program an app that let’s you configure orders for new windows (In case you want to build a house or modernize your current windows to waist less energy). Get it for free on the app-store.
So, for people mostly interested in 3D-Gems, I did some shader-programming in this app.
We were able to scan our structured windows so I could get some 3D-Meshes of those. Then I had a look into OpenGL ES 2.0 Shader-Programming and the “refract(vec3, vec3, float)” function to calculate the refraction of the scanned surface.
Later I just had to set the iPhone’s Camera Video Images as the current background texture and the result looks like this:
And the corresponding undistorted picture (featuring my beautiful Hagström Super Swede
)
If you guys are interested in the technical details I highly recommend PowerVR’s OpenGL programming SDK. They have some tutorials on how to program Shaders, and a C++-framework to import Blender-exports into your iOS project that were really helpful to me.


October 26, 2011 at 12:33 am
Hi, I have been googling everywhere for a good OpenGL refract example. Would you mind sharing some code example?
Thanks
Peter
October 27, 2011 at 9:08 am
Hey there,
there’s the PowerVR SDK: http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES2xSGX.asp
they have a lovely example on Refraction, its the third last in the list. They have the Shaders inside there too.