# IntegrateValidity(IDeviceContext, int, int, int, BufferSlice<float>)

> Computes validity factors indicating the reliability of each probe position.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.LightTransport](/engine/6000.5/script-reference/unityengine/lighttransport.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
IProbeIntegrator.Result IntegrateValidity(IDeviceContext context, int positionOffset, int positionCount, int sampleCount, BufferSlice<float> validityEstimateOut)
```

### Parameters

**** (\[IDeviceContext]\(/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext)): Device context for computation and memory operations.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Starting index in the probe position buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of probe positions to process.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of directional samples to take per probe.**** (\[BufferSlice\<float>]\(/engine/6000.5/script-reference/unityengine/lighttransport/bufferslice1)): Output buffer for validity values (one float per probe).

### Returns

| Type                                                                                            | Description                                                           |
| ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [Result](/engine/6000.5/script-reference/unityengine/lighttransport/iprobeintegrator/result.md) | Result indicating success or failure with detailed error information. |

### Remarks

This method evaluates how reliable each probe position is for lighting interpolation by analyzing the geometric environment around the probe.

The validity calculation:

* Value 1.0: Probe is in an open area with good visibility.
* Values between 0-1: Probe has partial validity.
* Value 0.0: Probe is inside geometry or in an invalid location.

Validity is determined by whether rays hit front-facing vs back-facing surfaces. For more information, refer to [Material.doubleSidedGI](/engine/6000.5/script-reference/unityengine/material/doublesidedgi.md).

Invalid probes (low validity) should be excluded from lighting calculations or given reduced influence during interpolation.

### Examples

```csharp
// Compute validity for all probes
BufferID validityBuffer = context.CreateBuffer(probeCount, sizeof(float));
var validitySlice = new BufferSlice<float>(validityBuffer, 0);

var result = integrator.IntegrateValidity(context, 0, probeCount, 1024, validitySlice);

if (result.type == IProbeIntegrator.ResultType.Success)
{
    // Read back validity values
    var validityData = new NativeArray<float>(probeCount, Allocator.Temp);
    context.ReadBuffer(validitySlice, validityData);
    context.Flush();

    // Identify invalid probes
    for (int i = 0; i < probeCount; i++)
    {
        if (validityData[i] < 0.5f)
        {
            Debug.LogWarning($"Probe {i} has low validity: {validityData[i]}");
        }
    }
}
```
