Jump to content
  • Advertisement
Sign in to follow this  
Hermes

Refraction

This topic is 5118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is a paragraph from a tutorial i've read Next, we calculate the refraction. If you remember your highschool physics, you know that: refraction index = sin( angle of incoming light ) / sin( angle of refracted light ) so that the angle of the refracted beam can be calculated like this: angle of refracted light = arcsin( sin( angle of incoming light ) / refraction index ) where the refraction index is that of water: 1.33. Third, we need to calculate where the refracted beam hits the image, or its relative position to the place where the incoming light beam originally entered: displacement = tan( angle of refracted beam ) * height difference Could you tell me how is the displacement computed,i can't understand it.[looksaround] Thanks!

Share this post


Link to post
Share on other sites
Advertisement

No refractive difference.

\ /
\ /
\ /
----------------
\ /
\/
----------------


Some refractive difference.


\ /
\ /
\ /
----------------
`. .`
`.`
----------------


Notice the path of the light once it exits the substrate, compared to the original it has displaced to the right. If you do the trig to find the difference then its the above equation.

Share this post


Link to post
Share on other sites
Well i'm intereasted in both :how it would look and how to implement it into code.
Let's say i have a newspaper under the water and a source of light:

L
\a
\ | n - ----------------------------
\| - /---- /----------------------water
| -------- /--------------water
|. -/----------------------------
| ./ /
b _ _ _

"a" is the angle between the light source and the surface normal
"b" is the angle of refraction(that thing under the water is the newspaper)
L n(normal)
\a|
\D
--------------- |A
|.\ |
|b'\ |height
|--'\*---------- |B
C N M

-lets say bis greater than air 1.003 so the light does not hit*M but N
so does this means that tan(b)=(CM-displacement)/height;so
displacement=........How do i light the underneath surface..(texture)
Do i have to bring the refracted ray into the texture space?
How do i do that ??[looksaround] or if you have a better idea please let me know .

Thanks a lot!
>
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!