How do I call a custom value on a Shader Graph?
Asked on 2024-07-26
1 search
To call a custom value on a Shader Graph, you can use the concept of exposed parameters. This allows you to change the values dynamically without modifying the shader code directly. Here are the steps to achieve this:
-
Expose Parameters in Shader Graph:
- In the Shader Graph, you can promote certain values to inputs, making them accessible for modification. For example, in the session "Optimize your 3D assets for spatial computing," it is mentioned that you can right-click on file references and promote them to input, making those inputs accessible in the panel on the right.
-
Using Material Instances:
- Material instances allow you to reuse the logic of one material while being able to change exposed parameters. This is useful for performance and efficiency. You can create material instances and modify the exposed parameters as needed.
-
Example of Using Exposed Parameters:
- In the session "Discover RealityKit APIs for iOS, macOS and visionOS," a custom hover effect is created using a Shader Graph material. The hover state node provides several inputs, including an intensity value, which is animated from zero to one when the player looks at the spaceship. This intensity value is an example of an exposed parameter that can be dynamically modified.
For more detailed information, you can refer to the following sessions and chapters:
- Optimize your 3D assets for spatial computing (Optimizing materials)
- Discover RealityKit APIs for iOS, macOS and visionOS (Hover effects and input)
These sessions provide insights into how to work with Shader Graph and expose parameters for custom values.

Discover RealityKit APIs for iOS, macOS and visionOS
Learn how new cross-platform APIs in RealityKit can help you build immersive apps for iOS, macOS, and visionOS. Check out the new hover effects, lights and shadows, and portal crossing features, and view them in action through real examples.

Optimize your 3D assets for spatial computing
Dive into an end-to-end workflow for optimized 3D asset creation. Discover best practices for optimizing meshes, materials, and textures in your digital content creation tool. Learn how to harness shader graph, baking, and material instances to enhance your 3D scene while optimizing performance. Take advantage of native tools to work more effectively with your assets and improve your app’s performance.

Port advanced games to Apple platforms
Discover how simple it can be to reach players on Apple platforms worldwide. We’ll show you how to evaluate your Windows executable on Apple silicon, start your game port with code samples, convert your shader code to Metal, and bring your game to Mac, iPhone, and iPad. Explore enhanced Metal tools that understand HLSL shaders to validate, debug, and profile your ported shaders on Metal.
