Add ambient lighting to probe data.
void CreateDefaultVolume() { for (int i = 0; i < _colorChannel; i++) { _volumeLightProbe[i] = new Texture3D(2, 2, 2, TextureFormat.RGBA32, false); } UnityEngine.Rendering.SphericalHarmonicsL2 sh; sh = new UnityEngine.Rendering.SphericalHarmonicsL2(); sh.AddAmbientLight(_defaultLightProbeColor); Color[] colorsR = new Color[8]; Color[] colorsG = new Color[8]; Color[] colorsB = new Color[8]; int counter = 0; for (int k = 0; k < 2; k++) { for (int j = 0; j < 2; j++) { for (int i = 0; i < 2; i++) { colorsR[counter] = new Color(sh[0, 3] * 0.5f + 0.5f, sh[0, 1] * 0.5f + 0.5f, sh[0, 2] * 0.5f + 0.5f, sh[0, 0] * 0.5f + 0.5f); colorsG[counter] = new Color(sh[1, 3] * 0.5f + 0.5f, sh[1, 1] * 0.5f + 0.5f, sh[1, 2] * 0.5f + 0.5f, sh[1, 0] * 0.5f + 0.5f); colorsB[counter] = new Color(sh[2, 3] * 0.5f + 0.5f, sh[2, 1] * 0.5f + 0.5f, sh[2, 2] * 0.5f + 0.5f, sh[2, 0] * 0.5f + 0.5f); counter++; } } } _volumeLightProbe[0].SetPixels(colorsR); _volumeLightProbe[1].SetPixels(colorsG); _volumeLightProbe[2].SetPixels(colorsB); for (int channel = 0; channel < _colorChannel; channel++) { _volumeLightProbe[channel].wrapMode = TextureWrapMode.Clamp; _volumeLightProbe[channel].Apply(); } Shader.SetGlobalTexture("_LightVolumeR", _volumeLightProbe[0]); Shader.SetGlobalTexture("_LightVolumeG", _volumeLightProbe[1]); Shader.SetGlobalTexture("_LightVolumeB", _volumeLightProbe[2]); _minVec = new Vector3(0, 0, 0); _volumeTexSize = new Vector3(2, 2, 2); Shader.SetGlobalVector("_LightVolumeMin", _minVec); Shader.SetGlobalVector("_LightVolumeSize", _volumeTexSize); }