0 Replies
      Latest reply on Feb 26, 2018 6:04 PM by pasotours
      pasotours Level 1 Level 1 (0 points)

        On iPhone X the system will return the primary light direction and intensity (though sadly not color) as well as 27 SH coefficients for secondary light.

         

        https://developer.apple.com/documentation/arkit/ardirectionallightestimate/2928222-sphericalharmonicscoefficients

         

        Has anyone determined how to render with these?  I see the Unity example where they have somewhat hacked them into their light probe model.

         

        I would like to write a shader that given these and a surface normal returns the secondary light color.  The docs describe it as 9 coefficients in RGB channels for 27 values.

         

        I tried the shader in the cannonical Stanford paper and it does not look correct at all. The color goes to full RGB primary with too much black in some of the lobes.

        http://graphics.stanford.edu/papers/envmap/

         

        I suspect the SH coefficients are ordered differently somehow.  The paper interleaves the color matrices into vector3 but I unwound that since the Apple docs state that it is three sets of 9.