   Linearizing depth value
  Does anyone know what the equivalent of this is in DirectX?float LinearDepth(in float depth){  return (2.0 * Near) / (Far + Near - depth * (Far - Near));}The input depth comes from a pixel's z-buffer value (which is non linear). Near is the value of the near clipping plane, far for the far clipping plane. The linear depth is in the range 0 - 1.I know it works for OpenGL   
  According to wikipedia, the formula should be:Linear Depth = -2*far*near / (z * (far-near) - (far+near) )But that is from -1 to 1, so you should do depth = (depth +1)/2 afterwards to get it into the 0 to 1 range.   ;  Hmm, but does that work if the input z is from directx (which specifies its depth values from 0.0 to 1.0)?   ;  If you inputs to that function are 0-1 then I think the outputs will also be in the 0-1 range.Why don't you run some numbers through it and see? ;p   