title: How to get accurate fragment screen position, like gl_FragCood in vertex shader?
body: <p>I did some calculations using projected gl_Position and screen parameters, but position seems distorted in polygons close to the camera. But when I use...</p>
  
  <pre><code>vec2 fragmentScreenCoordinates = vec2(gl_FragCoord.x / _ScreenParams.x, gl_FragCoord.y / _ScreenParams.y);
  </code></pre>
  
  <p>...I got pretty accurate <code>xy</code> results.</p>
  
  <p>Pretty output gl_FragCoord.xy coordinates:
  <img src="https://i.stack.imgur.com/jvmzE.png" alt="enter image description here"></p>
  
  <p>Calculating from projected vertices results in interpolated values all over the faces, which I cannot use for sampling screen aligned textures.</p>
  
  <p>Ugly interpolated output from gl_Position:
  <img src="https://i.stack.imgur.com/ksJB9.png" alt="enter image description here"></p>
  
  <p>Is there a way to produce this <code>gl_FragCoord</code>-like value in vertex shader? I really want to calculate texture coordinates in vertex shader for independent texture reads, manual depth tests, etc.</p>
  
  <p>Or is there any Unity built in values I can use here?</p>