Parameter | Description |
---|---|
context | Device context for computation and memory operations. |
world | World object containing the scene geometry and other input data. |
positions | Buffer slice containing the 3D positions of the light probes to be integrated. |
pushoff | Distance to offset rays from probe positions to avoid self-intersection artifacts. |
bounceCount | Maximum number of light bounces for indirect lighting calculations. |
Initializes the probe integrator with scene data and integration parameters.
This method must be called before any integration operations. It prepares internal data structures, compiles shaders if necessary, and sets up the integration parameters.
The preparation phase can be time-intensive for large scenes as it may involve:
The pushoff parameter helps prevent ray self-intersections when probes are placed very close to surfaces.
// Create probe positions buffer var probePositions = new NativeArray<Vector3>(numProbes, Allocator.Persistent); // ... populate positions ...
BufferID posBuffer = context.CreateBuffer((ulong)numProbes, 12); var posSlice = new BufferSlice<Vector3>(posBuffer, 0); context.WriteBuffer(posSlice, probePositions); context.Flush();
// Prepare integrator with 2 bounce indirect lighting integrator.Prepare( context, world, posSlice, 0.05f, // 5cm push-off to avoid self-intersection 2 // 2 bounce indirect lighting );
// Now ready for integration operations var result = integrator.IntegrateDirectRadiance(context, 0, numProbes, 1024, false, outputBuffer);