# refract

> Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Mathematics](/engine/6000.7/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule

## refract(float2, float2, float)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static float2 refract(float2 i, float2 n, float indexOfRefraction)
```

### Parameters

**** (\[float2]\(/engine/6000.7/script-reference/unity/mathematics/float2)): Incident vector.**** (\[float2]\(/engine/6000.7/script-reference/unity/mathematics/float2)): Normal vector.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Index of refraction.

### Returns

| Type                                                                  | Description        |
| --------------------------------------------------------------------- | ------------------ |
| [float2](/engine/6000.7/script-reference/unity/mathematics/float2.md) | Refraction vector. |

## refract(float3, float3, float)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static float3 refract(float3 i, float3 n, float indexOfRefraction)
```

### Parameters

**** (\[float3]\(/engine/6000.7/script-reference/unity/mathematics/float3)): Incident vector.**** (\[float3]\(/engine/6000.7/script-reference/unity/mathematics/float3)): Normal vector.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Index of refraction.

### Returns

| Type                                                                  | Description        |
| --------------------------------------------------------------------- | ------------------ |
| [float3](/engine/6000.7/script-reference/unity/mathematics/float3.md) | Refraction vector. |

## refract(float4, float4, float)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static float4 refract(float4 i, float4 n, float indexOfRefraction)
```

### Parameters

**** (\[float4]\(/engine/6000.7/script-reference/unity/mathematics/float4)): Incident vector.**** (\[float4]\(/engine/6000.7/script-reference/unity/mathematics/float4)): Normal vector.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Index of refraction.

### Returns

| Type                                                                  | Description        |
| --------------------------------------------------------------------- | ------------------ |
| [float4](/engine/6000.7/script-reference/unity/mathematics/float4.md) | Refraction vector. |

## refract(double2, double2, double)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static double2 refract(double2 i, double2 n, double indexOfRefraction)
```

### Parameters

**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): Incident vector.**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): Normal vector.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Index of refraction.

### Returns

| Type                                                                    | Description        |
| ----------------------------------------------------------------------- | ------------------ |
| [double2](/engine/6000.7/script-reference/unity/mathematics/double2.md) | Refraction vector. |

## refract(double3, double3, double)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static double3 refract(double3 i, double3 n, double indexOfRefraction)
```

### Parameters

**** (\[double3]\(/engine/6000.7/script-reference/unity/mathematics/double3)): Incident vector.**** (\[double3]\(/engine/6000.7/script-reference/unity/mathematics/double3)): Normal vector.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Index of refraction.

### Returns

| Type                                                                    | Description        |
| ----------------------------------------------------------------------- | ------------------ |
| [double3](/engine/6000.7/script-reference/unity/mathematics/double3.md) | Refraction vector. |

## refract(double4, double4, double)

Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.

```csharp
public static double4 refract(double4 i, double4 n, double indexOfRefraction)
```

### Parameters

**** (\[double4]\(/engine/6000.7/script-reference/unity/mathematics/double4)): Incident vector.**** (\[double4]\(/engine/6000.7/script-reference/unity/mathematics/double4)): Normal vector.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Index of refraction.

### Returns

| Type                                                                    | Description        |
| ----------------------------------------------------------------------- | ------------------ |
| [double4](/engine/6000.7/script-reference/unity/mathematics/double4.md) | Refraction vector. |
