[vtk-developers] Why Translucent objects can't be picked ?

David E DeMarle dave.demarle at kitware.com
Thu Jun 12 09:24:58 EDT 2008


Hello,

The visible cell selection code ignores translucent objects for two reasons.

First, the code works by assigning a particular color to each object
and determining from the color of the pixels selected which objects
were selected. With opacity, the color of each pixel is a blend of the
colors of two objects which does not identify either of the two
objects behind the pixel and may end up being the color corresponding
to some completely unrelated object.

The second reason is that when the user picks somewhere with multiple
translucent objects, their is no sure way to know which of the
translucent objects the user is interested in. If I point out my
window, am I pointing at the car in the road outside the window or at
the glass of the window itself?

The visible cell selection code can then either ignore all translucent
objects entirely (which standard VTK does) or make all of the objects
opaque and pick the nearest (which I think you have done).  I think
the effect you are seeing in the third picture is that you are picking
the nearest object which has an opacity of 0.0. Your might try making
only objects with opacity!=0 or opacity >0.5 opaque.

If you want to select all of the objects behind the selection area,
Frustum selection and AreaPicker classes can return all of the
objects. Then your code can determine which one or ones were intended.

I hope that helps,
Dave DeMarle




2008/6/12 Julian Ibarz <julian.ibarz at gmail.com>:
> I say a wrong thing : the picking is well done (it's just because i make an
> highlight that is a copy of my selected object in the same place and the
> blending is done so the highlight color is blended and is not red but grey).
>
> I made screenshots to show you the different problems i encounter. Think
> that the different picking are maded by vtkVisibleCellSelection in CELL
> SELECTION MODE :
>
>         vtkVisibleCellSelector selector = new vtkVisibleCellSelector();
>         selector.SetRenderer(canvas.GetRenderer());
>         selector.SetArea(firstPoint[0], firstPoint[1], secondPoint[0],
>                 secondPoint[1]);
>         selector.SetRenderPasses(0, 1, 0, 0, 1, 0);
>
>         canvas.lock();
>         selector.Select();
>         canvas.unlock();
>
>
> In this screenshot you can see the picking done and the highlight maded by
> changing the color of the actor :
>
> http://ibarz.julien.free.fr/images/pick/pick1.png
>
> In this screenshot you can see the highlight of the cell selected and the
> highlight is a copy of the previous actor with only the cell selected (the
> blend is made so the color is not red but grey) :
>
> http://ibarz.julien.free.fr/images/pick/pick2.png
>
> And in this screenshot you can see that i pick an actor that is normally not
> visible (it's highlighted in red but because a translucent actor is behind
> him it is blended and rendered in opaque grey). I don't understand why it's
> selected because normally in the pick rendering color it is not visible
> (because in pick color rendering the alpha is not used) :
>
> http://ibarz.julien.free.fr/images/pick/pick3.png
>
> Do you know why in the third screenshot i select an unvisible actor ?
>
> 2008/6/12 Julian Ibarz <julian.ibarz at gmail.com>:
>>
>> Hello,
>>
>> I'm doing a CAD viewer and for seeing internal pieces of an object i make
>> the englobant pieces of the object translucent. But i want to pick this
>> pieces with pick color. For some reason i don't know the translucent objects
>> are not drawn in the pick color rendering. I made a trick to render them
>> (changing vtkRenderer::UpdateGeometryForSelection()) and i see a difference
>> : the translucent geometry becames opaque when they are picked but the
>> picking results doesn't have them so my problem is not solved but it shows
>> that we can if we want pick the translucent geometries.
>>
>> So my question is : why we can't decide to make the translucent geometries
>> picked or not (with a flag in the pickers) ?
>>
>> --
>> Julian Ibarz
>
>
> --
> Julian Ibarz
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list