Archived

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

Lacrosse2000

Anyone have any ideas on GTA style buildings

Recommended Posts

I am interested in doing a game and I want the buildings to be like GTA (Grand Theft Auto). This portion of the code needs to go fast. What I was thinking was that, since I will never zoom out, there shouldn''t need to be any matrix math and that given the X, Y, and Z pos (in screen space, not world space), there should be a consistent equation to project it onto the screen. Can anyone think of any equation which might to this? My description probably sounds about as clear as mud. Thanks, Mike Henry

Share this post


Link to post
Share on other sites
Two suggestions:

Use a perspective projection matrix. So you''re not going to need it for much, but on better cards, the transform should be handled by the card rather than the CPU (I think), which could potentially make this faster than anything you can code yourself.

If you have to do it yourself, make sure your "virtual Z coordinate" will always be positive (non-zero). Then do your drawing in reverse Z order (i.e. ground first, tops of buildings last). Before the last draw command, divide your X and Y values by the Z value. That _should_ be all you need to do. Oh, and you might want to divide by a scalar times the Z value, so things don''t look TOO distorted... or you could just adjust what Z values you use accordingly.

--Tr][aD--

Share this post


Link to post
Share on other sites