Get fragment distance from camera without uniforms

Is there any way to get the frag distance from the camera without uploading the camera position as a uniform?

Maybe this is what you’re looking for…
No uniforms, but a varying :wink:

Or you can use the values from gl_FragCoord.z and gl_ProjectionMatrix to calculate the distance.

N.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.