How get distance to camera in shader?


#1

I want to make a fog shader. Somethink like this: http://in2gpu.com/2014/07/22/create-fog-shader/
I am not good with shader.
How can i get distance from sprite to camera?


#2

Looks like distance is gl_Position.z


#3

It work :grinning: