# ComputeOcclusionLightIndicesFromBakeInput(BakeInput, Vector3[], uint)

> Determines the most influential lights for occlusion calculations at each probe position.

## Definition

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

```csharp
public static int[] ComputeOcclusionLightIndicesFromBakeInput(InputExtraction.BakeInput bakeInput, Vector3[] probePositions, uint maxLightsPerProbe = 4)
```

### Parameters

**** (\[BakeInput]\(/engine/6000.7/script-reference/unityengine/lighttransport/inputextraction/bakeinput)): The BakeInput containing light source information.**** (\[Vector3\[]]\(/engine/6000.7/script-reference/unityengine/vector3)): Array of world-space positions where occlusion should be computed.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Maximum number of lights to select per probe (typically 4 for shadowmask compatibility).

### Returns

| Type                                                           | Description                                                                                                                   |
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [int\[\]](https://learn.microsoft.com/dotnet/api/system.int32) | Flattened array of light indices where each consecutive group of maxLightsPerProbe indices corresponds to one probe position. |

### Remarks

This method analyzes the light sources in the scene and selects the most influential ones for each probe position.

The returned indices are used with [IProbeIntegrator.IntegrateOcclusion](/engine/6000.7/script-reference/unityengine/lighttransport/iprobeintegrator/integrateocclusion.md) to compute shadow mask data for mixed lighting mode.

**Array Layout:** For N probes and M lights per probe, the result contains N × M indices where indices \[I × M to (I + 1) × M - 1] belong to probe i.

Additional Resources: [IProbeIntegrator.IntegrateOcclusion](/engine/6000.7/script-reference/unityengine/lighttransport/iprobeintegrator/integrateocclusion.md), GetShadowmaskChannelsFromLightIndices.

### Examples

```csharp
// Extract probe positions from light probe groups
var probePositions = new List<Vector3>();
var lightProbeGroups = FindObjectsOfType<LightProbeGroup>();
foreach (var group in lightProbeGroups)
{
    probePositions.AddRange(group.probePositions.Select(p =>
        group.transform.TransformPoint(p)));
}

// Compute light indices for shadowmask occlusion
var lightIndices = InputExtraction.ComputeOcclusionLightIndicesFromBakeInput(
    bakeInput,
    probePositions.ToArray(),
    4  // 4 lights per probe for RGBA shadowmask
);

// Get corresponding shadowmask channels
var shadowmaskChannels = InputExtraction.GetShadowmaskChannelsFromLightIndices(bakeInput, lightIndices);

// Use with integrator
var result = integrator.IntegrateOcclusion(context, 0, probePositions.Count, 512, 4, lightIndexBuffer, occlusionBuffer);
```
