ShaderGraph: Vertex Position
Tutorial
·
intermediate
·
+10XP
·
10 mins
·
(328)
Unity Technologies

Working on a Shader requires you to use different positional information than the default coordinates. The Position node allows you to select which coordinate system to use.
Languages available:
1. Shader Graph: Vertex Position
This tutorial has been verified using Unity 2019 LTS and Shader GRaph 7.3.1
Working on a Shader requires you to use different positional information than the default coordinates. The Position node allows you to select which coordinate system to use.
2. Creating the Shader Graph
Let's first create a Shader to use as an example.
1. Right-click in your project and select Create > Shader > PBR Graph.
2. Name the new Shader “SampleGraph.”
3. Double-click the new Shader to open it.
4. In the window that opens, right-click to select Create Node.
5. Type in “Position” and click the result that matches.
You will now have a Position node sitting in your graph (Figure 01).

Figure 01: Position Node
The Position node provides access to the Mesh vertex or fragment’s position. It controls how a Shader behaves in a Scene and in what space it renders. For example, if you change the position to View, the shader will always render from the view direction of the camera. The output is the coordinate space that can be determined by the Space dropdown. This node has a single output and one parameter.
Output:
- Out: Outputs the normal created from the node.
Parameter:
- Space: Allows you to select the coordinate space of Position to output. It has the following options, Object, View, World, and Tangent.
- Object: When you want the Position to based on the object's coordinates within the scene. It’s useful for using coordinates related specifically to the object that the shader is attached to.
- View: When you want to use the viewer coordinates. It’s useful when you want to use the position and direction the viewer is facing to affect your Shader.
- World: This option is useful when you want to use the coordinate system for the entire Scene. Useful for when you want to use the positional data of the entire Scene rather than being restricted to the object or view coordinates.
- Tangent: This option derives the positional coordinates the best approximates an object as a given point. Imagine a point on a sphere where various planes are going through that point. One of those planes touches the sphere ever so gently, simultaneously coming as close as possible to all nearby points.
- Absolute World: This option returns the absolute world position of the object in the scene across all Scriptable Render Pipelines. This is the default world space of the Universal Render Pipeline, where the High Definition Render Pipeline uses a Camera-relative world space.
Let’s see what happens when we use the View space of the position to render a simple Texture to a sphere in our Scene.
1. Create a Sample Texture 2D node and supply it a Texture in its Texture input.
2. Take the RGBA pin of the Sample Texture 2D node and plug it into the Albedo input of the PBR Master node.
3. Take the Out pin of the Position node and plug it into the Position input of the PBR Master node (Figure 02).

Figure 02: Connecting the node to the PBR Master Node
This will connect our work to the final node of the Shader Graph to be rendered out. The PBR Master node includes a small preview at the bottom to show you the final live result of the Shader.
3. Finishing the SampleGraph
The final step to show your Shader is to save your Asset:
1. In the top left corner of the PBRGraph, click the Save Asset button (Figure 03).

Figure 03: Shader Graph Toolbar
2. Create a new Material in your Project window by right clicking and selecting
Create > Material.
3. In the Material window, select the Shader dropdown and select the Shader you created (Figure 04).

Figure 04: Material Shader Selection
4. Apply the Material to an object in your Scene (Figure 05).

Figure 05: New shader applied to an object in the Scene
If you orbit your camera at a fixed point around the Scene, you’ll notice that when the camera faces the object, it disappears and then reappears in your peripherals with the front of the Texture always facing the camera.
4. Conclusion
Now that you know how to use the View space from the Position node, experiment with the other spaces to see how it affects the Shader you’ve created.