Reflecting Room Brightness in Materials with Apple Vision Pro

This article is a translated version of my original post on Qiita. Original (Japanese): https://qiita.com/segur/items/1387a4a406b507c0b78a

Reflecting Room Brightness in Materials with Apple Vision Pro

In visionOS, using the URP Lit shader allows material brightness to change based on the room's light level. This feature is available on Apple Vision Pro as well—convenient indeed!

image.png image.png
In a bright room, the Lit shader makes the material appear brighter In a dark room, the material appears darker

However, when the Lit shader is applied to anime-style avatars, it tends to appear more plastic and unnatural.

image.png image.png
Original Toon shader Significant mismatch with Lit shader

So, I wanted to use a Toon shader in visionOS, but as of April 2024, a suitable Toon shader for visionOS wasn't available.

Using an Unlit shader is another option, but it doesn't adapt to room lighting.

image.png image.png
Less mismatch in a bright room with Unlit shader Significant mismatch in a dark room

Therefore, I decided to create a new shader based on the Unlit shader that accommodates room lighting!

Development Environment

At the time of writing, the development was done in the following environment:

Using PolySpatial Environment Radiance to Capture Room Brightness

The Diffuse Radiance output from the PolySpatial Environment Radiance node represents room brightness, including color information!

I created the following ShaderGraph to utilize this feature:

image.png

The process is straightforward: multiplying the color information extracted from a texture by the Diffuse Radiance value. This enabled room brightness to be reflected in the material as shown below:

image.png image.png
image.png image.png
With Diffuse Radiance, the material brightens in a bright room With Diffuse Radiance, the material darkens in a dark room

Supporting Emission

To address the lack of Emission for eyes, I added the following processing:

image.png

The eyes became slightly brighter!

image.png image.png
Without Emission With Emission

This worked well on the actual Apple Vision Pro device!

Sample Code

The ShaderGraph created for this project is shared here. Feel free to refer to it:

OpenUPM

The shader developed here is also available on OpenUPM! Please make use of it:

https://openupm.com/packages/com.segur.poly-spatial-environment-diffuse-shader/

Conclusion

The creation of this article was guided by the following pages. Thank you very much: