Custom Lighting and Conversion to Shader Graph

Is there any information available on how to properly create custom lighting in Shader Graph that does not require external shader code and use of the Custom Function node?

In attempting to convert some old surface shaders to Shader Graph I noted that there is no accessibility to things like light attenuation or a specific light’s color without implementing custom shader code that cannot be used on visionOS.

This is something we’re actively working on. We expect it to take the form of a set of shader globals that you will be able to use directly in your shader graphs if you want to compute the lighting yourself (similar to unity_LightColor, unity_LightPosition, etc.), but we will also provide one or more custom shader graph nodes that replicate parts of the Unity lighting model in MaterialX. At the moment, though, the only lighting available is the environment-based lighting from RealityKit.

1 Like

Any updates I might have missed on custom lighting functionality support being added?

Yes; sorry I didn’t remember to update this thread. We now have a custom shader graph node (PolySpatial Lighting Node) that reproduces a subset of Unity’s lighting within RealityKit. It supports up to four point/spot/directional lights, light maps, light probes, and reflection probes.