Does anyone know of a way to determine from within a shader whether the camera currently rendering it is orthographic?
There are a number of camera parameters that can be accessed, but it looks like the ortho status, or other information that could be used to determine it like the field of view, is not among them:
http://docs.unity3d.com/Documentation/Components/SL-BuiltinValues.html
My particular use case is this: I’ve written code to do billboarding, and it bases the size of the billboard on the camera distance so it always appears as the same pixel size. Obviously, you don’t want to do this with ortho cameras, as size doesn’t change with distance from the camera.
I could do it with a shader variable, but that doesn’t work if I’m rendering with multiple cameras simultaneously. I could do it with shader replacement, but that requires keeping two shaders synced with each other - not ideal.