Archived

This topic is now archived and is closed to further replies.

Dark One

Need an out of the ordinary projection matrix

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites