PolySpatial Environment Diffuse Shader

openupm openupm

Bright environment Dark environment
bright room image dark room image

What is this shader?

This shader reflects the diffuse light of the environment, captured by the external cameras of Apple Vision Pro, onto the surface.

The above images were captured using the visionOS Simulator, where we prepared a bright room and a dark room. The same material is applied to the central objects, but you can see that the surface brightness changes depending on the brightness of the room.

Internally, this shader uses the PolySpatial EnvironmentRadiance node of Shader Graph.

Requirements

  • Unity 2022.3.18 or later
  • visionOS Build Support
  • Universal Render Pipeline URP
  • PolySpatial 1.1.6 or later

Install via OpenUPM command-line interface

# Install openupm-cli
npm install -g openupm-cli

# Go to your unity project directory
cd YOUR_UNITY_PROJECT_DIR

# Install package:
openupm add com.segur.poly-spatial-environment-diffuse-shader

How to use

  • Create or Select a material.
  • In the Shader field, choose Segur/PolySpatial/EnvironmentDiffuse.
  • Set the base color in BaseColor.
  • Assign a texture to BaseMap.
  • Set the EmissionColor and EmissionMap as needed.

material inspector

VRM Support

This shader is compatible with VRM 1.0. By specifying EnvironmentDiffuseMaterialDescriptorGenerator as the MaterialDescriptorGenerator when loading a VRM file, this shader will be applied. For more details, please refer to the sample scene.

Samples

Here are some sample scenes.

package manager samples

Primitive Preview

This is a sample scene where this shader is simply applied to a sphere, a cube, and a cylinder.

primitive preview

VRM Loader Demo

This is a sample scene that loads a VRM file.

  • Install following packages:
    • com.vrmc.gltf
    • com.vrmc.vrm
    • com.vrmc.vrmshaders
  • Specify the URL of your preferred VRM file in the Url field of the VrmLoader within the scene.
  • Run the scene, then the VRM will be displayed with this shader applied.

vrm loader demo