MantisBT - VTK
View Issue Details
0009459VTKBugpublic2009-08-31 00:422014-10-01 21:34
Ayman W. Habib 
Joachim Pouderoux 
normalmajoralways
closedfixed 
 
 
TBD
incorrect functionality
0009459: Bug in picking objects arranged as an assembly
Quoting "Eran Guendelman" back in 2007, using VTK 5.0.3

I'm finding in my program that even when I call SetVisibility(0) and
SetPickable(0) on vtkActors in my scene, the vtkPropPicker is
incorrectly allowing them to be picked. I traced through the VTK code
and believe I found the bug. Here's basically what's happening. Say my
scene is:

A -> B -> C
        -> D

A: top level scene assembly
B: an assembly which is a part of A (e.g. a model in the scene)
C and D: vtkActors which are part of assembly B (e.g. bodies in my model)

So now suppose I hide body C (SetVisibility(0), and also SetPickable(0)
for good measure although I don't think that's necessary under usual
circumstances).

vtkPropPicker::Pick() calls vtkRenderer::PickRender() down the line,
which does the following:

(1) Goes through all the top-level vtkProps in the scene. Namely A. It
  then adds A to a pickFrom list.

(2) A cullPicker (of type vtkPicker) is created to execute a pick
against bounding boxes, to cull the bodies that will be rendered by the
underlying DevicePickRender(). vtkPicker::Pick goes through each
vtkProp in the pickFrom list (namely A), and goes through all paths of
that prop (namely A->B->C and A->B->D). It omits any paths whose leaf
node is not visible (so it omits A->B->C but intersects against
A->B->D). In the situation where we do intersect D's bounding box, the
top-level vtkProp is added to the vtkPicker's Prop3Ds list... ***i.e. A
is added th the Prop3Ds list... NOT the leaf node D***

(3) back in vtkRenderer::PickRender(), it fills PathArray with *ALL* of
the paths of all of the vtkProps in the Prop3Ds list. i.e. it fills
PathArray with all of the paths of A, which are A->B->C and A->B->D.
(THIS IS ALREADY BAD NEWS BECAUSE A->B->C IS BACK UNDER CONSIDERATION)

(4) vtkOpenGLRenderer::DevicePickRender() is called, which calls
vtkRenderer::PickGeometry(), which renders everything in the PathArray,
and makes this comment:
   // We can render everything because if it was
   // not visible it would not have been put in the
   // list in the first place, and if it was allocated
   // no time (culled) it would have been removed from
   // the list


So there's an obvious problem here. When an intersection with D was
found, the top-level vtkProp A was added to the Prop3Ds list... and then
*all* of the paths of A were intersected against by the device pick
render step. Ignoring the fact that A->B->C is supposed to be invisible
and not pickable!

So is this a bug? And suggestions for getting around it? (Yes, I could
make a flat scene graph and put C and D as top-level actors in the
scene, but that's not a satisfactory solution).

Thanks.
No tags attached.
Issue History
2009-08-31 00:42Ayman W. HabibNew Issue
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2014-04-15 12:21Joachim PouderouxProject => TBD
2014-04-15 12:21Joachim PouderouxType => incorrect functionality
2014-04-15 12:21Joachim PouderouxAssigned To => Joachim Pouderoux
2014-04-15 12:21Joachim PouderouxStatusexpired => backlog
2014-04-15 12:21Joachim PouderouxResolutionopen => fixed
2014-04-15 12:21Joachim PouderouxStatusbacklog => gerrit review
2014-04-15 12:22Joachim PouderouxNote Added: 0032595
2014-04-15 12:22Joachim PouderouxCategory(No Category) => Bug
2014-10-01 21:34Sean McBrideNote Added: 0033410
2014-10-01 21:34Sean McBrideStatusgerrit review => closed

Notes
(0032595)
Joachim Pouderoux   
2014-04-15 12:22   
http://review.source.kitware.com/#/c/15150/ [^]
(0033410)
Sean McBride   
2014-10-01 21:34   
The gerrit change was merged.