HDRP - Shader Graph - Vertex Displacement Linked to Camera Motion

BACKGROUND: Hey, folks. I have an HDRP shader created via Shader Graph that performs basic vertex displacement based on noise. Being new to both HDRP and Shader Graph, I based the shader on several tutorials. In the tutorials, the camera position is subtracted prior to being routed into the Vertex Position in the master node. I’m using HDRP 8.2.0 and subtracting the camera position didn’t work. In fact, simply converting from World to Object space worked fine, contradicting what was mentioned in the tutorials.

QUESTION: My game has a first person character controller, so the camera moves as the character moves. What I’ve noticed is that the vertex displacement works properly when the camera is stationary, but when the camera moves, there’s a detectable acceleration/deceleration effect on the vertices. That implies that something still needs to be added to the shader to compensate for camera motion. Is there something that can be added to my shader to get the vertices to displace independent of the camera motion?

An image of my shader is attached.

DETAILS:

  • Unity 2020.1.2f1
  • HDRP/Shader Graph 8.2.0
  • Windows 10

SHADER:

I figured it out. The Position nodes all need to be set to “Absolute World” rather than “World”. The Transform node needs to transform from “Absolute World” to “Object”. Works fine now. It looks like there were some changes in definitions and node semantics since the tutorials that I watched were made.

3 Likes

For anyone how interested in difference here is the link: Position Node | Shader Graph | 10.0.0-preview.27

1 Like

Thank you, you resolved my issue. :slight_smile:

Also having this problem and for me changing position to absolute world doesn’t work. Any ideas?

Had the same issue, same solution that icompton had pointed out with setting everything to absolute world.
Doh! lol

Anyways here’s what the graph looks like:

One important render pipeline feature that unity has in HDRP is camera relative rendering, this can change position/space node requirements a little compared to its BRP and URP counterparts.

Added bonuses include less frequent requirements for world shifting ( 5km + easyish)
slightly better world/screenspace handling
Added negatives, multiple cameras are often more expensive even after custom frame settings

Three years later, I’m super thankful for this post, I was in the weeds for days with this issue. Changing all my Position and Transform nodes to “Absolute World” did the trick.

2 Likes

I’m glad it helped. Proof that community forums are useful. Cheers!

I had this problem but for me the “problem” was that I was looking at the mesh in scene view. For some reason time doesn’t pass in scene view. It only passes when pressing play and only in the game view.