Question

I'm trying to understand how to use glsl's refract function for ray tracing. Let's say that I have an object with a refractive index of 1.5. If I want to generate a refracted ray, I call refract(rayDir, surfNorm, 1.0/1.5) correct?

However, I'd like to know how to handle the resulting transmission ray when it reaches the other side of the object and leaves. What is the eta value for this function call? Is it 1.5/1.0?

Was it helpful?

Solution

Frankly, I'm not highly familiar with this, but since nobody else is answering:

The 3rd argument of refract() is documented as "the ratio of indices of refraction eta". So what you're suggesting makes sense to me. It the ratio is eta going from material A to material B, the ratio would be 1.0 / eta going from material B to material A.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top