Ok lets go directly into my question.
I have made a program to pick the displayed objects (in 3D)(polygons
and vertices) by using mouse click. When I get multiple hits in
selection buffer, I use z value to find the object with maximum z
value for selection.
Now my problem is .. during vertex selection mode, my clipping window
is width = 20 and height = 20 to help user select the nearest vertex
easily. When i get multiple hits, sometimes it turns out that within
the clipping window, the vertex farther to the cursor is having
greater z value than one nearer to the cursor- resulting in selection
of vertex farther than the one near the cursor.
I know that if I decrease my clipping window size, say to unit size,
then this problem will disappear, but it will be difficult for user to
select vertex - trying to put the cursor right on top of point!
Another problem is, I do not want to select the vertex, which is
hidden behind a polygon. for this i may have to calculate whether the
vertex is behind polygon or not .etc.
Isn't there some better and simple solution for this probelm? I
guess that many peoples must have come across this problem, and there
must be some standard method to overcome this.
If anyone can guide me , i will be so very grateful..
thanking you
kaizen
|
|
0
|
|
|
|
Reply
|
newsgroup_anan
|
2/2/2004 7:46:30 AM |
|
One uggly way to do it is to render in select mode several times (up
to 20 times, or until you find a vertex). OK it very uneffective, but
its not like something you do on an every frame basis, it is only at
user interaktion. So despite it is an uggly solution it is easy and I
quess the performance hit will not get noticed.
Just an idea...
newsgroup_anan@yahoo.com (kaizen) wrote in message news:<6250b040.0402012346.19c50bcd@posting.google.com>...
> Ok lets go directly into my question.
> I have made a program to pick the displayed objects (in 3D)(polygons
> and vertices) by using mouse click. When I get multiple hits in
> selection buffer, I use z value to find the object with maximum z
> value for selection.
> Now my problem is .. during vertex selection mode, my clipping window
> is width = 20 and height = 20 to help user select the nearest vertex
> easily. When i get multiple hits, sometimes it turns out that within
> the clipping window, the vertex farther to the cursor is having
> greater z value than one nearer to the cursor- resulting in selection
> of vertex farther than the one near the cursor.
> I know that if I decrease my clipping window size, say to unit size,
> then this problem will disappear, but it will be difficult for user to
> select vertex - trying to put the cursor right on top of point!
> Another problem is, I do not want to select the vertex, which is
> hidden behind a polygon. for this i may have to calculate whether the
> vertex is behind polygon or not .etc.
> Isn't there some better and simple solution for this probelm? I
> guess that many peoples must have come across this problem, and there
> must be some standard method to overcome this.
> If anyone can guide me , i will be so very grateful..
> thanking you
> kaizen
|
|
0
|
|
|
|
Reply
|
marcus
|
2/2/2004 3:10:17 PM
|
|
kaizen wrote:
> Ok lets go directly into my question.
> I have made a program to pick the displayed objects (in 3D)(polygons
> and vertices) by using mouse click. When I get multiple hits in
> selection buffer, I use z value to find the object with maximum z
> value for selection.
> Now my problem is .. during vertex selection mode, my clipping window
> is width = 20 and height = 20 to help user select the nearest vertex
> easily. When i get multiple hits, sometimes it turns out that within
> the clipping window, the vertex farther to the cursor is having
> greater z value than one nearer to the cursor- resulting in selection
> of vertex farther than the one near the cursor.
> I know that if I decrease my clipping window size, say to unit size,
> then this problem will disappear, but it will be difficult for user to
> select vertex - trying to put the cursor right on top of point!
> Another problem is, I do not want to select the vertex, which is
> hidden behind a polygon. for this i may have to calculate whether the
> vertex is behind polygon or not .etc.
> Isn't there some better and simple solution for this probelm? I
> guess that many peoples must have come across this problem, and there
> must be some standard method to overcome this.
> If anyone can guide me , i will be so very grateful..
> thanking you
> kaizen
Restructure your geometric data. Dont become dependant on whats drawn on
screen or into the selection buffer instead use your geometry and a
little math to solve the problem. For example use your geometry to
determine which facet or vertex is closest to the mouse point. I think
generally this kind of approach is called a scenegraph.
|
|
0
|
|
|
|
Reply
|
xbunny
|
2/2/2004 7:05:07 PM
|
|
OK this is what happens when you are in a hurry. I left out something
pretty important: Each time you render in select mode you enlarge the
picking region one size. The original post should have said the
following:
One uggly way to do it is to render in select mode several times, each
time you render, you enlarge the picking region one size (up to 20
times, or until you find a vertex). OK it is very uneffective, but
its not like something you do on an every frame basis, it is only at
user interaktion. So despite it is an uggly solution it is easy and I
quess the performance hit will not get noticed.
Sorry if I made everyone confused :-)
marcus.silfver@koping.net (marcus) wrote in message news:<1a55433d.0402020710.5ef65677@posting.google.com>...
> One uggly way to do it is to render in select mode several times (up
> to 20 times, or until you find a vertex). OK it very uneffective, but
> its not like something you do on an every frame basis, it is only at
> user interaktion. So despite it is an uggly solution it is easy and I
> quess the performance hit will not get noticed.
>
> Just an idea...
>
|
|
0
|
|
|
|
Reply
|
marcus
|
2/2/2004 7:49:02 PM
|
|
>
> Restructure your geometric data. Dont become dependant on whats drawn on
> screen or into the selection buffer instead use your geometry and a
> little math to solve the problem. For example use your geometry to
> determine which facet or vertex is closest to the mouse point. I think
> generally this kind of approach is called a scenegraph.
Thank you for the suggestions.
I have now used the hybrid model, i.e. use both selection buffer and
geometric data and it is working quite well.
In fact I used selection buffer to get the geometric information of
all the vertices within the pick region, then I projected the vertex
coordinates to screen coordinates. The vertex whose projection on
screen is nearest to cursor position is chosen as hit vertex. (This is
exactly how human eye percepts the 3D image displayed in 2D computer
screen)
As about the vertex behind polygon, currently I left it unchecked- if
required then I am planning to do it such that, for each candidate
vertex (vertices collected in selection buffer), pick the polygons
with new clipping window (window positioned right over that vertex
screen projection). Then compare the z - value of polygons hit and
the z value of the vertex.
This way I hope I can get the accurate information.
Thank you very must for all the help.
|
|
0
|
|
|
|
Reply
|
newsgroup_anan
|
2/5/2004 12:56:31 AM
|
|
|
4 Replies
185 Views
(page loaded in 0.062 seconds)
|