Need an out of the ordinary projection matrix

Started by
4 comments, last by Dark One 21 years, 8 months ago
I''ve juststarted planning a top-down (this is not an ortho-mode question) game using OpenGL. I want to render 3D models with the camera on top of them. Everything is fine when the object is in the center of the screen (thus exactly under the camera), but when the object is near the edge of the screen, it doesn''t look like it''s being viewed from right on top of it. Of course this is because of the perspective projection. Normally with the perspective projection, the rendered objects are projected based on how far the object is from the camera. So what I''m looking for is a way to create a projection matrix that would project the rendered objects based on the distance between the z-values of the object and the camera. This would result in (at least I think so) objects being rendered the same way, whether they are right below the camera or i.e. somewhat to left from the camera. Is this even possible, and would it work the way I think it would. P.S. Sorry for the possibly messy post.
Advertisement
Not sure about this, but mabye changing the Field Of View of the projection matrix would work. Although you would probably need to make everything else smaller to fit in the new FOV and this might just reverse the effects. I dunno I''d have to try it

Anyway, just an idea.
--24 Beers in a Case.24 Hours in a Day.Coincedence? I think not!www.gramb0.co.uk
what you want is an ortho mode with distance attuatuion Im guessing the only way to achieve this with out useing a small FOV which limits view size is to use and ortho mode and scale models and stuff manually. I belive that this is it at least.

Good Luck
"I seek knowledge and to help those who also seek it"
I''m not sure I understand what you want, but I think object sizes in perspective projection vary according to the distance from the camera plane (the screen), not the distance from the camera''s location. This means that the spatial relationships between a set of points lying on a plane that is parallel to the screen will remain the same after perspective projection, while the spatial relationships between points not all lying on a plane that is parallel to the screen will be altered by the perspective projection. Another way to look at it is that the farther away from the camera plane the less will points appear to move when these are translated equally along the camera''s plane.

You seem to want a projection matrix that will yield objects that vary in size as they move toward or away from the camera while preserving the relationship between points not all lying on a plane parallel to the screen. I beleive that''s quite impossible.

Other than using ortho mode and scaling objects manually, as another poster suggested, you might draw objects aligned with the center of the screen to an offscreen buffer, read the pixels back from the buffer and use the image data to create an impostor that is billboarded to the screen. The impostor then represents a "fixed perspective" object, like moving a photo of the object along the screen.
Just another idea I had, depending on what you want it might work. Work out the angle between the ship and the camera, and rotate the ship so tht the correct part of it is facing the camera. I think this would work but I could be talking crap(Just a warning). Other than this(and possibly including this) the best idea would probably be the one suggested by AP, involving offscreen buffers.
--24 Beers in a Case.24 Hours in a Day.Coincedence? I think not!www.gramb0.co.uk
Thanks for the replies. I think I''ll try what the AP suggested.

This topic is closed to new replies.

Advertisement