OpenGL Picking Question


When doing picking in an first person shooter game, do i use opengl’s picking? or do games use another method?

Please advice. Thanks.

There’s nothing wrong with OpenGL picking, you can safely use it.

hi, thanks for the reply. i’m not saying there’s anything wrong with opengl picking…i’m just asking if current FPS games use it (like doom 3 or unreal?)

if not, what do they use? thanks.

I can’t imagine that they would be using anything else besides OpenGL picking. It’s easy to implement and runs in hardware.

an alternative to picking is ray tracing. which method is better depends on many factors. but if you have a physics engine in place (most game engines do), ray tracing will be trivial to perform, and often faster. but again, it all depends on scene complexity, trace distance, and so forth. my advice would be to test both methods for your particular scenario, and keep the one thats fastest.

I think you’ve confused the issue. Ray tracing (a.k.a. photon mapping) is a rendering method in which a photon (pixel) is traced backward from the screen to the light source. Angles of incidence are calculated off of each object the photon would have deflected off of in order to calculate color contributions from each object in the scene. Ray tracing is a non-real time rendering method that is capable of creating very realistic looking scenes. As far as I know, ray tracing has nothing to do with object selection.

Could you explain your method in further detail?

I think he means ray casting but as Aeluned said, there is nothing wrong with OpenGL’s picking.

aeluned, what i mean is tracing lines (rays) from the viewer through the triangles in the scene. perhaps the term is used loosly, but ive been using it in this context for 10 years, and i just can’t shake it. anyway, this can be done quickly if the world is organized creatively (some kind of good tree structure like a bsp, quadtree, octree, …). this is the de facto method for most game engines. and given that d3d doesnt have support for picking, well, you know what im getting at.

oh, and theres color id too. this can be made to work reasonably well. in fact, it could be an alternative to picking thats cross-api. so many options, so little time.

oooh yeeeeah, Direct 3D. good point.

yeah, sorry to bring that up here, i just wanted to make it known that other developers have to find alternatives to picking.

but i love picking, and i use it where i can. its so nice, so neat, so flexible.