realtime picking method

Started by
4 comments, last by Bob III 17 years, 10 months ago
Hi, Here's the link for discussion in OGL forum: http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=3;t=014540 And here's the topic: I need a fast (for realtime) selection mechanism (picking). "Unique colors" method sounds most appropriate. Here's a description of this method: http://gpwiki.org/index.php/OpenGL_Selection_Using_Unique_Color_IDs But then it came up, that if antialiasing is forced, color map (for picking) would be changed, and whole method is unsure. I have two questions: 1. Is it possible to (somehow) prevent AA in buffer I'm rendering to, even if driver is forcing it? I mean, does the driver force the AA to *every* buffer, or to just the one (or two), that will be visible on screen. Can I specify them? Is it possible to render the scene *somewhere* in memory, that driver wouldn't modify it? 2. If not, and this method is always unsure, can anyone recommend me any other method, that would be fast enought for gaming, even if there will be (in maximum program load) only few frames per second (and may be more than one mouse events for each)?
Advertisement
you could try turning off any shading, dithering, lightning and texturing, wouldnt that turn off any AA as well?

Projects: Top Down City: http://mathpudding.com/

Of course disabling light, texture and fog is a must for this method, but unfortunatley, it doesn't seems to change anyway to antialiasing...
Quote:Original post by akuda
Of course disabling light, texture and fog is a must for this method, but unfortunatley, it doesn't seems to change anyway to antialiasing...


what about:

GLShadeModel(GL_flat);
GLDisable(GL_DITHER);

this might work :/

but why arent you using the built-in picking functionality?

Projects: Top Down City: http://mathpudding.com/

Ummmh
wouldn't the method: Project a mouse ray into 3d scene and detect ray interesection with objects yourself using Math.

..be a lot faster than using the glpicking and colorpicking stuff?
Especially for Realtime gameing? (most fps games do this...(think of bullets))

That method is harder work for you as a programmer to code, but once done is just some CPU cycles.
wheras the glpicking/colorpicking stuff takes extra rendering passes in addition...and they're a lot less accurate...
Less accurate, perhaps, but if you're selecting from pixel coordinates it would actually be bad to select from a ray instead of from pixels. If the user selects the very edge pixel of something, you have a 50/50 chance of missing with rays, right?

GL_SELECT does take one extra quickee "render" (but no buffer except the selection buffer is changed - and that is just a block of data recording hits, not image data) of things you are interested in selecting. If you maintained a nicely sorted scenegraph and/or used a bounding boxes preliminary check, I suppose you could do it faster with rays than selection. Otherwise you would still have to check all the objects. But wouldn't the GL_SELECT computations run faster on the GPU than the ray computations on the general-puropse CPU? Perhaps you would have to instead ask if your program is cpu or gpu-bound.

But I'm a bit fuzzy on just how much cpu/gpu time each of the methods actually takes.

Quote:but why arent you using the built-in picking functionality?


Well, I agree with that, but the tutorial did say this:

Quote:This method can not only be applied to OpenGL apps, but to DirectX apps as well. For the sake of this tutorial, the code given below will be using OpenGL.
"That''s to do with the day I finally realized the world had gone totally mad and built the Asylum to put it in, poor thing, and hoped it would get better."-Wonko the SaneSo Long, and Thanks for All the Fish

This topic is closed to new replies.

Advertisement