Is there a way to get the ambient light from the environment

I tried using polyspatial lighting to capture the ambient light but it doesn’t seem to be affected when i change environments in the simulator.

The PolySpatial Lighting Node only includes ambient contributions from the Unity scene, not the image based lighting provided by visionOS from the simulated/actual environment. Are you trying to get the ambient light on the CPU (C# code), or in a shader graph? The former is not possible, as far as I know. The latter is currently only possible by using a Lit shader graph target and having visionOS supply the ambient contribution as part of its overall lighting model. However, visionOS does supply a MaterialX node that samples the image-based lighting. Essentially, you provide it the lighting parameters–normal, base color, roughness, etc.–and it outputs the diffuse and specular lighting components, which you can use as a base for further calculations in the shader. We have it on our list to support this node in the future.

Thanks, got it.

I am looking for the image based lighting provided by visionOS to be accessible in the shader graph.

It sounds like this would be a new node in the future? Or added onto the PolySpatial Lighting Node.

It would be a new node, since there’s no equivalent in Unity shader graph (the closest would be the Reflection Probe node, but that’s not quite the same; it doesn’t take into account the material properties). We’d probably call it something like “PolySpatial Environment Radiance.” I’ll make sure that we add it in an upcoming release.

2 Likes