Skip to main content
GameDev.net gamedev.net
🔒 Locked

Refraction

Started by McGyverDK Jul 23, 2003 at 9:21 AM 0 replies 900+ views
Original Post
McGyverDK
McGyverDK
I was told the best way to simulate glas is by using a technic called refraction. Refraction is when you make a surface 100% transperant, but when lights goes through the surface is will change the objects behind. Does anybody know how to do refraction in DirectX or how to simulate glas in another way? /Yours, Anders
S1CA
S1CA
Refraction is the bending of light when it passes though different materials (air, water, glass etc). Try getting a glass half full of water and put a pencil in it - look at the glass side on, the angle of the pencil in the top part without water on looks different than the part in the water. That''s refraction.

You can get an example of a few ways of achieving it with D3D and sample source code at the nVidia developer website: developer.nvidia.com

Another thing you might want to look out for (and you''ll find sample code for above) is the Fresnel effect. This is where the amount of light reflected by something like a pool of water and how transparent is looks depends on the angle you look at it from.

Find a puddle of water (or make one) on a clear day. Look straight down at the puddle, now move your head down so that you''re looking at the puddle at a fine grazing angle. You''ll notice that as you move your head the amount of the reflection of the sky changes and the amount of transparency changes.

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.