Accessing screen position after vertex position change?

I’m manipulating the vertex position in my shader, but when setting the color, the Screen Position node seems to pass me the data from before the vertex shader is applied. I’m looking to do screen-space effects without positional distortions, which would require an up-to-date screen position.

I may have one potential workaround (grabbing the world position, transforming it to view space, and converting that to screen position) but I can’t figure out how to go from view to screen position.

Any help would be much appreciated!

You’ll need to convert the Vector3 view space position into a Vector4 with w set to 1. Then use the Transform Matrix node to get the projection matrix and multiply the Vector4 view position and the matrix together (with the matrix going into A).

After that divide the resulting value’s XY by the W * 2 and add 0.5. You now have the 0.0 to 1.0 normalized screen position.

3 Likes

Incredible, thank you! I had missed the Transformation Matrix node completely, and your descriptiveness and detail will really save me a lot of trial and error. Thanks again!

Hate to resurrect an old thread, but any chance to get a screenshot of the node setup for this? Cant find anyone else who discussed this and it’s not working for me.

In case anyone ever needs it

1 Like