View Full Version : Stereographic Projection?
05-03-2009, 01:39 PM
Does anyone know how a custom projection matrix would be made...such as for stereographic projection? Stereographic projection converts all objects from 3D to a sphere where it is then projected onto a 2D plane preserving only angles; neither are nor distance. On Wikipedia: http://en.wikipedia.org/wiki/Stereographic_projection
I have no experience in making new matrix types so I really will need some code (preferably in C but any other OpenGL supported language would do) to undertand.
05-04-2009, 09:48 AM
This is not actually what you need.
Try this one: http://developer.download.nvidia.com/presentations/2009/GDC/GDC09-3DVision-The_In_and_Out.pdf
That one rather old article, but helpful: http://chromium.sourceforge.net/doc/stereo.html
This presentation is good enough:
Using google helps!
05-04-2009, 12:40 PM
I do think the OP actually want a spherical projection, not a 3D stereo asymmetrical frustum.
Unfortunately, as this projection is non-linear, you have to use highly tesselated geometry, otherwise the straight lines from vertex to vertex will look wrong.
To me the best would be to render 6 standard views with 90° fov, around the camera center, then use a shader to inverse transform each screen pixel to go fetch the correct texel from cube view.
Something like this (it was software rendering but now doable with OpenGL alone) :
Stellarium has some nice projections, including a true stereographic one :
05-05-2009, 01:20 AM
O'key, seems, you're right, ZBuffeR.
Caglow, forget my unuseful advice :)
Actually, when I hear "stereographic projection", I'm always thinking about 2 deflected frustumus for anaglyphic stereo, so my mistake can be explained o)
05-06-2009, 03:05 AM
sounds like you want
05-09-2009, 09:41 AM
What I want is actually the projection you see in stellarium...the default one. I'm not quite sure if I'm explaining things correctly but that's what I want. http://stellarium.org
EDIT: I noticed that it's been mentioned but how does stellarium do it? Their code has been integrated with everything else making it hard to find everything I need.
05-12-2009, 04:18 AM
I don't know, how exactly Stellarium guys are doing that, but if I were doing it, I would render 6 cube-side views to cubemap texture, and then I would use fragment shader for full-screen quad to obtain remmapped spherical direction (according to fish-eye projection formulaes) and fetch a texel from cubemap by this direction. That's waht ZbuffeR has actually proposed.
05-12-2009, 09:03 AM
I skimmed through Stellarium code, it seems to be done by transforming the vertices "by hand", so it looks to use the low tech solution I mentioned, the one that needs high tesselation.
In Stellarium it is not really a problem for stars (dots), and the only other geometry is the ground and orbit lines.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.