1
\$\begingroup\$

I'm using a shader graph in the Universal Shader Pipeline (URP) to do some post-processing in a ScriptableRenderPass. How do I get the world coordinates of the screen position?

I have tried using the View Direction node, set to World: enter image description here

And I have tried the Screen Position node, with either a Transform node or Transformation Matrix node: enter image description here

Neither seems to be working because the colors change as I move the camera around, but I would expect the color to stay the same since the world position of the GameObject in the view is not changing. Any suggestions?

\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

Here's how I've done it in the past:

Shader graph

\$\endgroup\$
4
  • \$\begingroup\$ In URP? In Unity 2019? \$\endgroup\$
    – Sirius 5
    Jun 14, 2021 at 17:13
  • \$\begingroup\$ I should have specified the Unity version above. I gave up because it seemed to be a bug in the Screen Position or View Direction node. \$\endgroup\$
    – Sirius 5
    Jun 14, 2021 at 17:15
  • \$\begingroup\$ Can't recall which URP version I originally made this graph for, as it was from an older answer. Did you encounter any specific problems using this example in your version? \$\endgroup\$
    – DMGregory
    Jun 14, 2021 at 17:22
  • \$\begingroup\$ Its been a while since I looked at it (the question is from Aug '20), and I gave up trying to get it to work. I was trying to do underwater fog, and there is probably a better way than what I was trying to do. \$\endgroup\$
    – Sirius 5
    Jun 14, 2021 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .