Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

Discussion in 'Shaders' started by Middle-earth, Mar 31, 2019.

  1. Middle-earth

    Middle-earth

    Joined:
    Jan 23, 2018
    Posts:
    73
    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?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
  3. Middle-earth

    Middle-earth

    Joined:
    Jan 23, 2018
    Posts:
    73
    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.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    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).
     
  5. qiu_lirui

    qiu_lirui

    Joined:
    Oct 28, 2017
    Posts:
    4
    Jave_Lin likes this.
  6. Jave_Lin

    Jave_Lin

    Joined:
    Jan 27, 2014
    Posts:
    4