Unity PolySpatial Shader Graph Support
You can use the Unity Shader Graph to create custom materials for visionOS. These will previewed in their compiled form within Unity, but converted to MaterialX for display in simulator and on device. While MaterialX is very expressive, some Shader Graph nodes have no analog in materialX. Within the Shader Graph editor, unsupported nodes will be indicated by the presence of a #
symbol.
For technical, security, and privacy reasons, visionOS does not allow Metal-based shaders or other low level shading languages to run when using AR passthrough.
Texture Limitations
When sampling textures in shader graphs, note that the sampler state (filter, wrap modes) associated with the texture itself is ignored. Instead, you must use the Sampler State
node to control how the texture is sampled if you want to use a mode other than the default (linear filtering, repeat wrap mode).
Coordinate Space Notes
There are two caveats to be aware of when converting between coordinate spaces in shader graphs. Because content is transformed according to the Volume Camera, the "world space" geometry returned within a shader graph will not match that of the simulation scene. Furthermore, visionOS is currently inconsistent with regards to the geometry it returns and the transformation matrices it supplies.
Retrieving the Geometry of the Source Scene
To obtain positions, normals, tangents, or bitangents in the world space of the simulation scene, use the Position
, Normal Vector
, Tangent Vector
, or Bitangent Vector
nodes with Space
: World
, then transform them using the PolySpatial Volume to World
node with a Transform
appropriate to the type (typically Position
for positions and Direction
for the rest, which will be normalized after transformation).
Notes on Transform and Transformation Matrix Nodes in VisionOS
The matrices returned by the Transformation Matrix
node and used by the Transform
node are obtained directly from visionOS and currently assume a world space that does not match either the simulation scene or the output of the Position
, Normal Vector
, Tangent Vector
, or Bitangent Vector
nodes. The "world space" output of those nodes is relative to the transform of the output volume--that is, it does not change when a bounded app volume is dragged around. The Transform
and Transformation Matrix
nodes, on the other hand, assume a world space that is shared between all app volumes. To get geometry in this world space, use the geometry (e.g., Position
) node with Space
: Object
and transform it with the Transform
node set to From
: Object
and To
: World
.
Shader Graph Nodes
The following tables show the current support status for Shader Graph nodes in PolySpatial for visionOS including a list of supported nodes and their various caveats.
If a node doesn't appear here it means that it's not currently supported. Note that this list will be updated as we continue to add support for more nodes.
Artistic
Section | Node | Notes |
---|---|---|
Adjustment | Channel Mixer | ✓ Supported |
Contrast | ✓ Supported | |
Hue | ✓ Supported | |
Invert Colors | ✓ Supported | |
Replace Color | ✓ Supported | |
Saturation | ✓ Supported | |
White Balance | ✓ Supported | |
Blend | Blend | ✓ Supported |
Filter | Dither | Only default Screen Position is supported. |
Fade Transition | ✓ Supported | |
Mask | Channel Mask | ✓ Supported |
Color Mask | ✓ Supported | |
Normal | Normal Blend | ✓ Supported |
Normal From Height | ✓ Supported | |
Normal Reconstruct Z | ✓ Supported | |
Normal Strength | ✓ Supported | |
Normal Unpack | ✓ Supported | |
Utility | Colorspace Conversion | ✓ Supported |
Channel
Section | Node | Notes |
---|---|---|
Channel | Combine | ✓ Supported |
Flip | ✓ Supported | |
Split | ✓ Supported | |
Swizzle | ✓ Supported |
Input
Custom Interpolators
are limited to these specific/names types:
Color
: Vector4UV0
: Vector2UV1
: Vector2UserAttribute
: Vector4Section Node Notes Basic Boolean ✓ Supported Color ✓ Supported Constant ✓ Supported Integer ✓ Supported Slider ✓ Supported Time ✓ Supported Float ✓ Supported Vector2 ✓ Supported Vector3 ✓ Supported Vector4 ✓ Supported Geometry Bitangent Vector Tangent and View space options are not standard. Normal Vector Tangent and View space options are not standard. Position Tangent and View space options are not standard. Screen Position ✓ Supported Tangent Vector Tangent and View space options are not standard. UV ✓ Supported Vertex Color ✓ Supported Vertex ID ✓ Supported View Direction ✓ Supported Gradient Gradient ✓ Supported Sample Gradient ✓ Supported Lighting Main Light Direction ✓ Supported Matrix Matrix 2x2 ✓ Supported Matrix 3x3 ✓ Supported Matrix 4x4 ✓ Supported Transformation Matrix Tangent and View space options are not standard. PBR Metal Reflectance ✓ Supported Scene Camera Position
andDirection
outputs supported (non-standard).Eye Index ✓ Supported Object ✓ Supported Scene Depth Platform doesn't allow have access to the depth buffer, this is just the camera distance in either clip or view space. Screen ✓ Supported Texture Cubemap Asset ✓ Supported Sample Cubemap ✓ Supported Sample Reflected Cubemap ✓ Supported Sample Texture 2D ✓ Supported Sample Texture 2D LOD ✓ Supported Sample Texture 3D ✓ Supported Sampler State MirrorOnce
wrap mode not supported.Texture 2D Asset ✓ Supported Texture 3D Asset ✓ Supported Texture Size ✓ Supported
Math
Section | Node | Notes |
---|---|---|
Advanced | Absolute | ✓ Supported |
Exponential | ✓ Supported | |
Length | ✓ Supported | |
Log | ✓ Supported | |
Modulo | ✓ Supported | |
Negate | ✓ Supported | |
Normalize | ✓ Supported | |
Posterize | ✓ Supported | |
Reciprocal | ✓ Supported | |
Reciprocal Square Root | ✓ Supported | |
Basic | Add | ✓ Supported |
Divide | ✓ Supported | |
Multiply | ✓ Supported | |
Power | ✓ Supported | |
Square Root | ✓ Supported | |
Subtract | ✓ Supported | |
Interpolation | Inverse Lerp | ✓ Supported |
Lerp | ✓ Supported | |
Smoothstep | ✓ Supported | |
Matrix | Matrix Construction | ✓ Supported |
Matrix Determinant | ✓ Supported | |
Matrix Split | ✓ Supported | |
Matrix Transpose | ✓ Supported | |
Range | Clamp | ✓ Supported |
Fraction | ✓ Supported | |
Maximum | ✓ Supported | |
Minimum | ✓ Supported | |
One Minus | ✓ Supported | |
Random Range | ✓ Supported | |
Remap | ✓ Supported | |
Saturate | ✓ Supported | |
Round | Ceiling | ✓ Supported |
Floor | ✓ Supported | |
Round | ✓ Supported | |
Sign | ✓ Supported | |
Step | ✓ Supported | |
Truncate | ✓ Supported | |
Trigonometry | Arccosine | ✓ Supported |
Arcsine | ✓ Supported | |
Arctangent | ✓ Supported | |
Arctangent2 | ✓ Supported | |
Cosine | ✓ Supported | |
Degrees to Radians | ✓ Supported | |
Hyperbolic Cosine | ✓ Supported | |
Hyperbolic Sine | ✓ Supported | |
Hyperbolic Tangent | ✓ Supported | |
Radians to Degrees | ✓ Supported | |
Sine | ✓ Supported | |
Tangent | ✓ Supported | |
Vector | Cross Product | ✓ Supported |
Distance | ✓ Supported | |
Dot Product | ✓ Supported | |
Fresnel Effect | ✓ Supported | |
Projection | ✓ Supported | |
Reflection | ✓ Supported | |
Refract | ✓ Supported | |
Rejection | ✓ Supported | |
Rotate About Axis | ✓ Supported | |
Sphere Mask | ✓ Supported | |
Transform | Some spaces are simulated and not covered in tests. | |
Wave | Noise Sine Wave | ✓ Supported |
Sawtooth Wave | ✓ Supported | |
Square Wave | ✓ Supported | |
Triangle Wave | ✓ Supported |
Procedural
Section | Node | Notes |
---|---|---|
Noise | Gradient Noise | - Can't be certain that target platform noise functions will behave the same. - Frequency is currently off (scale is mapped to amplitude rather than frequency). |
Voronoi | - Can't be certain that target platform noise functions will behave the same. | |
Shapes | Ellipse | ✓ Supported |
Polygon | ✓ Supported | |
Rectangle | ✓ Supported |
Utility
Section | Node | Notes |
---|---|---|
Utility | Custom Function | See custom function node conversion notes. |
PolySpatial Lighting | See lighting notes. | |
Preview | ✓ Supported | |
Split LR | Non-standard shader graph node specific to PolySpatial. Implements the splitlr function as described in the MaterialX Spec. | |
Logic | Branch | ✓ Supported |
Comparison | ✓ Supported | |
Is Infinite | ✓ Supported | |
Is NaN | ✓ Supported | |
Or | ✓ Supported |
UV
Section | Node | Notes |
---|---|---|
UV | Flipbook | ✓ Supported |
Polar Coordinates | ✓ Supported | |
Radial Shear | ✓ Supported | |
Rotate | Only Degrees are supported. | |
Spherize | ✓ Supported | |
Tiling and Offset | ✓ Supported | |
Triplanar | ✓ Supported | |
Twirl | ✓ Supported |