Very simple question. what’s the canonical way of getting the world position/coordinates of a pixel inside the fragment shader in a custom CG shader in Unity?

I’m suspecting that I’m looking to apply the inverse of the UNITY_MATRIX_MVP matrix on the SV_POSITION output from the vertex shader, but not sure how to actually grab a hold of the inverse MVP matrix using unitys shader syntax,

You can multiply v.vertex with the _Object2World matrix in the vertex shader and pass the result to the fragment shader. Doing the calculation inside the fragment shader itself actually doesn’t make any sense and would create a huge overhead.

I tried doing this, but I couldnt find a good semanitc type that would let me send the data intact to the fragment shader, I tried a bunch of different ones (TEXCOORD and COLOR) but none seemed to work.