Not logged in, Join Here! or Log In Below:  
News Articles Search    
Wednesday, April 6th 2005
Mouse Picking Article
09:54 PM

Book of Hook has been updated with a new article (PDF) on mouse picking, explaining the math behind the process.
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Aki Morita

April 08, 2005, 12:05 AM

Good article explaining the math on how to transform a screen space position (including depth) back into a world space position. But, it does not discuss how to get the depth value. Also, getting the depth value on consoles may not be practical. Also, picking on a translucent part of an object may fail to pick that object since alpha blended geometry normally does not update the depth buffer.


April 08, 2005, 04:08 AM

But, as it says, you don't need the depthvalue. Just construct a ray instead, and use it to intersect with your geometry (like in raytracing). I belive this is the most common method, exactly because it can be difficult/slow getting the real depth.
Constructing the ray is explained in the text.

A good text, by the way, very clear and understandable if you know a bit a about the transformations beforehand.


April 08, 2005, 09:11 AM

Help a n00b understand this.

I'm guessing that what I'm describing would be the "third approach" that Mr. Hook mentions, but he doesn't go into any details about its "numerous limitations that makes it impractical for widespread use" ....

Why not render your scene flat shaded, with aliasing, without effects and frills, encoding the object reference in the ARGB? Whether it's to a back buffer or a texture, it seems like that would be a quick look up.

Anyone willing to describe the limitations here? I'm sure I'm not the only weenier who's wondering.


April 08, 2005, 03:07 PM

Yeah, that's actually what I did in the past for an isometric engine. I see no reason why using color as an index would be bad... since you're taking less of a hit than rendering 1 normal frame.

This thread contains 4 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.