How can I get the unity_SHAr,unity_SHBr,etc.?

I try to use mat.GetVector(“unity_SHAr”) but it can’t get the value.And I try to use LightProbes.GetInterpolatedProbe(Vector3.zero,null,out sh2),then I can get 27 float values from sh2.However I find these 27 values are NOT the components of unity_SHAr,unity_SHBr,etc.So how can I get the correct values?

3 Likes

Thank you first.I see the LightProbeUtility.cs in project.These codes I have used before but there is a problem.I make a test:A new scene without any lightprobe,just use a hdr panorama texture for skybox. Then I use the SH parameters from the c# code like your SetSHCoefficients function.But the result changes a bit.When I replace the skybox with a non-hdr texture,the result is right.I don’t know why.

I’m not sure I fully understand. You’re saying when you swap between an HDR and non-HDR sky texture, the probe changes? The probe changing when changing textures is the expected result unless the HDR texture has no actual HDR data in it (ie: if you take the non-HDR image and save it out as an exr or hdr file).

There is actually a problem in LightProbeUtility.cs. The result isn’t the same with Frame Debugger.

This thread is correct solution

2 Likes

Good Job, Man~!