# refrection of a vector

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

## Recommended Posts

so, heres my reference page: http://en.wikipedia.org/wiki/Snell's_law so i do incidence vector dot normal and get: -0.019998666 then i do: float cosRefraction = sqrt(1.0f - (refractionIdx * refractionIdx) * (1.0f - cosIncidence * cosIncidence)); but: 1.0f - (refractionIdx * refractionIdx) * (1.0f - cosIncidence * cosIncidence) comes out as a negative number! refractionIdx = 1.33 (which is the refraction idx of water) vector is pointing in to the water, the normal is pointing up from the waters surface. have i got the equation wrong?

##### Share on other sites
I think u'd better use this instead to obtain the same result.
RefractedAngle = asin( ( air_r_index * sin(IncidentAngle) ) / water_r_index );CosRefractedAngle = cos( PI*RefractedAngle/180);

##### Share on other sites
Looking at the image, the ray comes from a medium with n1 and goes into a medium with n2. The author says that n1 < n2, i.e. this could be air to water refraction.

So n1/n2 should be 0,77 and not 1,3.

What you calculated was that total reflection works ;-)

• 12
• 9
• 13
• 41
• 15