Jump to content
  • Advertisement

Archived

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

directrix

poly to pixel collision detection

This topic is 5588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone have any ideas on how I can take a 3d mesh and compute the points of the pixels drawn when it''s rendered. I''m developing a 2d game with orthogonally rendered 3d models and I want to do this in order to do per pixel collision detection on the models. digital radiation

Share this post


Link to post
Share on other sites
Advertisement
well, to get the 2D coordinates given a 3D coordinate and the world, view, and projection matrices, you can just manually multiply the matrices by the 3D coordinate.

In D3DX, the function D3DXVec3Project does just that. In OpenGL, I believe you can use gluProject also.

for your mesh, you can probably take the outermost points and only compute those 2D coordinates.

''There''s something out there....something stupid...''
''I think I''m going to be ill. Is that a problem for you?''
''[You] overestimate my conscience by assuming that I have one.''
- Daria

DirectInput8 with the Keyboard , DirectInput8 with the Mouse , Using DirectX Audio 8

Share this post


Link to post
Share on other sites
first of all, I want to point out that this is usually a bad idea. with that said, you could render a black/white version of each on screen sprite into a smaller offscreen buffer, and then run through the pixels of each buffer and test of collision. Now, I think you can see why that would be slow and pointless. You''re better off just doing poly/poly tests. If you want the collision all in 2d, then just project all your poly''s onto the same plane before doing collision detection. in this case, poly/poly tests will give you exactly they same results with much less cost.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!