Skip to main content
GameDev.net gamedev.net
🔒 Locked

opengl picking

Started by uto314 Nov 19, 2004 at 8:01 PM 8 replies 2.9k views
Original Post
uto314
uto314
Hi, I am currently writing a opengl application, I have to pick some object in the scene, I need the nearest intersection point with a 3D object, the nearest edge, the nearest interesected face, and the intersected object. I know how doing that with the opengl picking system, but I don't really like the way you have to do that with. I would like to know what people think about opengl picking and if it's better to implement a ray picker which goes through a simple scene tree that contains the bounding volume of the different subtrees. thanks, -uto-
a human beyond the bug -
soconne
soconne
Do picking based on object color. Search the forums, there have been some recenty threads on this within the last week. I posted some code on one of them.
Author Freeworld3Dhttp://www.freeworld3d.org
BlackBox
BlackBox
I implemented the opengl picker like this:

http://www.lighthouse3d.com/opengl/picking/

It works really well, the only problem is when there are to many polygons(~50000 - ~250000) then you start loosing frames and its noticeble. But this can be fix very easily by having less complex clicking areas.


---------------------------- ^_^
vincoof
vincoof
Do you want to know what's interesected in a certain frustum (beam), or do you want to know the closest objects to a ray ? For the former, use OpenGL picking. Whether you like it or not that's the only way to do it. For the latter, I'm sorry to tell it's meaningless. Unfortunately I'm understanding that you're looking for the latter ! Am I wrong ?
Fidde A
Fidde A
I usually do ray intersection testing for selection. If you have a good space division (octree or whatever), it's easy and cheap. The selection buffer isn't half bad either, but it is limited to a stacksize of 64 objects by the current GL spec, which doesn't cut it for many applications. I heard alot of people using this coloring technique, maybe you should give that a whirl.

Fidde
uto314
uto314
Actually I agree with the fact the the opengl picking system is very convenient.
But first I would like to find a way to make it independent from the rendering loop.
Then I am wondering if the depth precision is the same as the depth buffer. I need at least a 64 bit precision and I don't know yet if opengl give this this precision.

To conclude I am now looking for a kind of picker interface that allow to use several picking techniques without have to change the rendering code. This will allows the use a accurate picker (such as ray - model intersection computation) and an opengl picker for the selection mode.

Thanks again.

-uto-

ps : please excuse my english, as you should guess that not my first language :(
a human beyond the bug -
Phillip Martin
Phillip Martin
Quote:
Original post by uto314

Then I am wondering if the depth precision is the same as the depth buffer. I need at least a 64 bit precision and I don't know yet if opengl give this this precision.


If you use the Open GL selection doesn't use the depth buffer for computing the depth of selection. It simply utilises the clipping part of OpenGL, and anything that is still in the frustum after the clipping, it will appear in the selection results, so it is entirely independant of the depth buffer.

Quote:
Original post by uto314
ps : please excuse my english, as you should guess that not my first language :(


I think you are doing very well!
uto314
uto314
Yes, but If I want a ray intersection, I might be wrong but I guess that the hit depth given by opengl is the value store in the depth buffer. And that's a issue for someone who needs an accurate intersection.
And a good solution should be to compute an exact ray intersection only with the closest primitive picked with opengl.
That's sound good for me...
-uto-

a human beyond the bug -
vincoof
vincoof
Quote:
Original post by Phillip Martin
If you use the Open GL selection doesn't use the depth buffer for computing the depth of selection. It simply utilises the clipping part of OpenGL, and anything that is still in the frustum after the clipping, it will appear in the selection results, so it is entirely independant of the depth buffer.

It doesn't use the buffer itself, but it doesn't mean depth computation are done using higher (or lower) precision than the buffer. Anyway, you're limited to the near/far ratio. So you can achieve high-precision picking if you iterate around picked objects recursively.
For instance, you look for the closest object to pick : you create a picking frustum with near/far clipping planes to 1/1000, and you pick 3 objects : one at depth 50, another at depth 50, and a last one at depth 400. You forget about the last one who isn't a valuable candidate, so you run another test around the near/far clipping planes 49/51 (enclosing the best previous results), and then you find one object at 49.99999999 and the other at 50.0000002 : gotcha ! That's the way I would do it if I had to create a high-precision picker.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.