I think I've figured out why vtkPropPicker doesn't work... The steps to a hardware pick are:<br><br>-call gluPickMatrix to constrain the rendering area to a small area around the mouse click. I think this works by setting the projection matrix to greatly scale up the scene so only a small area is visible in the viewport.<br>
<br>- set render mode to GL_SELECT and do a hit test<br><br>In the opengl spec it says the hit test works by returning a list of primitives that would have been drawn, but no rasterization steps are actually performed (no pixel fragments are produced). Well, rendering lines with fixed width (10 pixels for example) is an operation that comes during the rasterization. It seems there is a limitation to the opengl spec that you can't pick fixed width lines except by picking the center of the line as if the line width was 1px (and presumably the same is true for points).<br>
<br>Using vtkCellPicker is an option, but it is not pixel precise, you have to give it some tolerance. If you give it a very strict tolerance it will miss the line in the same way vtkPropPicker does.<br><br>It's possible to make the vtkPropPicker work if you set the width of the pick area to be at least the width of the line (in vtk the pick area is hardcoded to 1x1), but then vtkPropPicker is acting more like vtkCellPicker, it has some tolerance.<br>
<br>Another solution is to stop using fixed width lines and represent lines as cylinders.<br><br>Pat<br><br>* p.s. I'm no opengl expert, if what I've said is not accurate someone correct me!<br><br><br><div class="gmail_quote">
On Sun, Jan 24, 2010 at 11:28 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Will, Pat,<br>
<br>
I've just checked in the new vtkCellPicker as of this morning. It<br>
should show up in the nightly doxygen pages tomorrow. For picking<br>
lines with vtkCellPicker the trick is setting the tolerance correctly.<br>
<br>
What Will says about the data being inconsistent between render & pick<br>
is something that can also occur with vtkPicker and its subclasses in<br>
some circumstances. The vtkPicker expects that all the data was<br>
updated in the previous rendering pass, so it doesn't call Update on<br>
the data right before the pick. If the data has changed between the<br>
last render and the pick, then it is necessary to either (a) re-render<br>
just before the pick or (b) go through all the props whose data might<br>
have changed and update their mappers' inputs.<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Sun, Jan 24, 2010 at 5:27 AM, Will Schroeder<br>
<<a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a>> wrote:<br>
> Pat-<br>
><br>
> For now use vtkCellPicker (I'll attached the modified C++ file) it works<br>
> much better. I believe what's going on is the rendering pass made during the<br>
> picking process is not consistent with the display rendering pass, hence the<br>
> picking is working badly. I'm going to have to dive deeper into this which<br>
> my brain is resisting this being early Sunday morning (and I am in Bar<br>
> Harbor watching the sunrise :-))<br>
><br>
> Note that David Gobbi is reworking vtkCellPicker and if he hasn't checked it<br>
> in yet, will do so shortly. By using a locator with the new vtkCellPicker<br>
> you will get great performance. plus more information than vtkPropPicker can<br>
> give you.<br>
><br>
> Let me know if you need more help and I'll give you a call, in the mean time<br>
> I'll back burner the vtkPropPicker for lines.<br>
><br>
> Will<br>
><br>
> On Sat, Jan 23, 2010 at 1:22 PM, pat marion <<a href="mailto:pat.marion@kitware.com">pat.marion@kitware.com</a>> wrote:<br>
>><br>
>> I hacked one of the vtk examples to demonstrate the bug. Attached and<br>
>> copied below. With the bug, it will only print "Pick success" when the x<br>
>> coordinate of the mouse press is 150.<br>
><br>
> ...stuff removed....<br>
><br>
>><br>
>> On Fri, Jan 22, 2010 at 1:18 PM, pat marion <<a href="mailto:pat.marion@kitware.com">pat.marion@kitware.com</a>><br>
>> wrote:<br>
>>><br>
>>> Using vtkPropPicker::PickProp it is difficult to pick lines (using a<br>
>>> vtkLineSource with a vtkPolyDataMapper for example). Even if I set the line<br>
>>> width to 10 pixels, the pick is only successful if I click exactly in the<br>
>>> center of the 10 pixel band, as if the hardware picker was not respecting<br>
>>> the 10 pixel width. Can someone that is familiar with this part of vtk<br>
>>> verify the bug, or point me in the right direction?<br>
>>><br>
>>> Pat<br>
>><br>
><br>
><br>
><br>
><br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
><br>
</div></div></blockquote></div><br>