Stereographic Projection?

openGL provides for ortho and perspective projections, but has anyone ever tried to create a different projection matrix?

In particular, Im looking for help generating stereographic and mercator projections from my 3D model, and google hasnt helped me.

Any hints on what a stereographic transformation matrix might look like, or is it even possible; or hints on what the transformation matrix is expecting?

A stereographic projection is non-linear, so it can’t be done with a matrix. You could approximate it by calculating the relevant formulas directly in a vertex shader. But it will only work with highly tesselated geometry, as the interpolation between vertices will still be linear.

Sure stereoproj is linear: You have points on a sphere seen by a perspective viewer at the antipodal point. The only nonlinear part is the conversion from latitude and longitude (and altitude) into 3d coords.

The remaining question is, what are the coords of your projected object - lat/lon or 3d? Using longitude as x coords and e.g. sin(latitude) as y coords, you have Mercator.

As opposed to 3d perspective projections, the usual geographic projections are defined for lat/lon object coordinates and don’t deal with proper 3d objects, the altitude being silently passed along as an attribute.

Thanks for the replies. I just noticed them today :slight_smile: I did get Stereographic to work, by converting my objects to draw to points on the 3d sphere, and then viewing from the antipodal point. Worked great.