Jump to content
• Advertisement

#### Archived

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

# poly to pixel collision detection

This topic is 5764 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

##### 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

##### 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

##### Share on other sites
Thanks for the ideas guys. I think I''ll try projecting the polys to a plane and doing poly/poly tests as Pseudo suggested.

digital radiation

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633317
• Total Posts
3011336
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!