void BuildEnvLightData(CommandBuffer cmd, HDCamera hdCamera, HDRayTracingLights lights) { int totalReflectionProbes = lights.reflectionProbeArray.Count; if (totalReflectionProbes == 0) { ResizeEnvLightDataBuffer(1); return; } // Also we need to build the light list data if (m_EnvLightDataCPUArray == null || m_EnvLightDataGPUArray == null || m_EnvLightDataGPUArray.count != totalReflectionProbes) { ResizeEnvLightDataBuffer(totalReflectionProbes); } // Make sure the Cpu list is empty m_EnvLightDataCPUArray.Clear(); ProcessedProbeData processedProbe = new ProcessedProbeData(); // Build the data for every light for (int lightIdx = 0; lightIdx < lights.reflectionProbeArray.Count; ++lightIdx) { HDProbe probeData = lights.reflectionProbeArray[lightIdx]; // Skip the probe if the probe has never rendered (in realtime cases) or if texture is null if (!probeData.HasValidRenderedData()) { continue; } HDRenderPipeline.PreprocessProbeData(ref processedProbe, probeData, hdCamera); var envLightData = new EnvLightData(); m_RenderPipeline.GetEnvLightData(cmd, hdCamera, processedProbe, ref envLightData); // We make the light position camera-relative as late as possible in order // to allow the preceding code to work with the absolute world space coordinates. Vector3 camPosWS = hdCamera.mainViewConstants.worldSpaceCameraPos; HDRenderPipeline.UpdateEnvLighCameraRelativetData(ref envLightData, camPosWS); m_EnvLightDataCPUArray.Add(envLightData); } // Push the data to the GPU m_EnvLightDataGPUArray.SetData(m_EnvLightDataCPUArray); }
void BuildEnvLightData(CommandBuffer cmd, HDCamera hdCamera, HDRayTracingLights lights) { int totalReflectionProbes = lights.reflectionProbeArray.Count; if (totalReflectionProbes == 0) { ResizeEnvLightDataBuffer(1); return; } // Also we need to build the light list data if (m_EnvLightDataCPUArray == null || m_EnvLightDataGPUArray == null || m_EnvLightDataGPUArray.count != totalReflectionProbes) { ResizeEnvLightDataBuffer(totalReflectionProbes); } // Make sure the Cpu list is empty m_EnvLightDataCPUArray.Clear(); // Build the data for every light for (int lightIdx = 0; lightIdx < lights.reflectionProbeArray.Count; ++lightIdx) { HDProbe probeData = lights.reflectionProbeArray[lightIdx]; var envLightData = new EnvLightData(); m_RenderPipeline.GetEnvLightData(cmd, hdCamera, probeData, m_RenderPipeline.m_CurrentDebugDisplaySettings, ref envLightData); // We make the light position camera-relative as late as possible in order // to allow the preceding code to work with the absolute world space coordinates. Vector3 camPosWS = hdCamera.mainViewConstants.worldSpaceCameraPos; m_RenderPipeline.UpdateEnvLighCameraRelativetData(ref envLightData, camPosWS); m_EnvLightDataCPUArray.Add(envLightData); } // Push the data to the GPU m_EnvLightDataGPUArray.SetData(m_EnvLightDataCPUArray); }