[vtkusers] vtkSelectVisiblePoints returns all points inside frustum (ignoring occlusion)

Thomas Koletschka thomas.koletschka at gmail.com
Fri Jun 8 03:59:46 EDT 2012


ok problem resolved (sorry for spam :| ) ... the problem was that i added
the model after the call to ResetCameraClippingRange so the camera still
had the default clipping range of 0.01 to 1000 or so which obviously gave
bad precision for a model with a size of 2m and hence resulted in all
points being selected as visible.

On Fri, Jun 8, 2012 at 3:12 AM, Thomas Koletschka <
thomas.koletschka at gmail.com> wrote:

> Actually what I said about the need for user interaction is not completely
> right - I need to change the camera parameters through user interaction
> (e.g. zooming, rotating, etc.). A simple click or keystroke inside the
> window without changing the camera parameters doesn't help.
> I also forgot to note that I'm setting my own camera (it works when using
> the default camera), so I'm guessing that those user interaction callback
> functions call some camera related function that I'm missing in my code. I
> set my camera as:
>
>     vtkSmartPointer<vtkCamera> cam = vtkSmartPointer<vtkCamera>::New();
>     cam->SetPosition(camPose[3], camPose[7], camPose[11]);
>     cam->SetFocalPoint(camPose[3]+camPose[2], camPose[7]+camPose[6],
> camPose[11]+camPose[10]);
>     cam->SetViewUp(-camPose[1], -camPose[5], -camPose[9]);
>     cam->SetViewAngle(2*atan((imsize[0]/2.0)/camFocal)  * 180 / M_PI);
>
>     renderWindow->SetSize(imsize[1]/4, imsize[0]/4);
>     renderer->SetActiveCamera(cam);
>     renderer->ResetCameraClippingRange();
>
> The rendering shows up just fine, it's just the vtkSelectVisiblePoints
> that's not working properly.
>
>
> On Fri, Jun 8, 2012 at 12:19 AM, Thomas Koletschka <
> thomas.koletschka at gmail.com> wrote:
>
>> Hello,
>>
>> I'm using vtkSelectVisiblePoints inside a callback function (actually I'd
>> even prefer to use it outside a callback but at the moment that's the only
>> way I get it to work) to get a list of all the visible non-occluded points.
>> The problem is that I need to interact with the render window once in
>> order to make it work correctly. If I just render my view and try to get
>> all visible points I get a list of ALL points inside the frustum (i.e. it
>> ignores occlusion even though the zbuffer shows the correct values when
>> reading it right before the vtkSelectVisiblePoints update) but once I do
>> any user interaction such as a mouse click inside the window it fixes the
>> problem and vtkSelectVisiblePoints returns the correct number of visible
>> points.
>>
>> Can anyone tell me what I might be doing wrong? I'm using the code as
>> given in the example at
>> http://www.cmake.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePointsjust that I'm listening to a reoccurring timer instead of a mouse click
>> (and ultimately I'd like to run the code outside a callback and simply
>> render N different camera positions and get the visible points using those
>> camera settings).
>>
>> Thanks,
>> Thomas
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120608/771f5607/attachment.htm>


More information about the vtkusers mailing list