You can use the Refract node to give a shader a refraction effect. The Refract node generates a refraction using the following to produce a new refracted vector:
- A normalized incident vector.
- A normalized normal vector of the surface.
- The refractive index of the source and the medium.
The Refract node uses the principles described in [Snell's Law](https://en.wikipedia.org/wiki/Snell%27s_law). A medium's refractive index has an angle where the surface behaves like a perfect mirror. This angle is called total internal reflection. To avoid a NaN result, set the Refract node's **Mode** to **Safe**. This makes the Refract node generate a null vector when it reaches the critical angle before total internal reflection.
## Ports
| Name | Direction | Type | Binding | Description |
|:------------ |:-------------|:-----|:---|:---|
| Incident | Input | Vector | None | The normalized vector from the light source to the surface.<br/>For example, this could be from a light source to a pixel, or from the Camera to a surface. |
| Normal | Input | Vector | None | The normalized normal of the surface that causes the refraction. |
| IOR Source | Input | Float | None | The refractive index of the medium the light source originates in. |
| IOR Medium | Input | Float | None | The refractive index of the medium that the light refracts into. |
| **Mode** | Select a mode to handle results at the point of critical angle refraction. The options are: <ul><li>**Safe:** Returns a null vector result instead of a NaN result at the point of critical angle refraction.</li><li>**CriticalAngle:** Avoids the **Safe** check for a potential NaN result.</li></ul>|