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.<br>
<br><div class="gmail_quote">On Fri, Jun 8, 2012 at 3:12 AM, Thomas Koletschka <span dir="ltr"><<a href="mailto:thomas.koletschka@gmail.com" target="_blank">thomas.koletschka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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. <br>
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:<br>
<br> vtkSmartPointer<vtkCamera> cam = vtkSmartPointer<vtkCamera>::New();<br> cam->SetPosition(camPose[3], camPose[7], camPose[11]);<br> cam->SetFocalPoint(camPose[3]+camPose[2], camPose[7]+camPose[6], camPose[11]+camPose[10]);<br>
cam->SetViewUp(-camPose[1], -camPose[5], -camPose[9]);<br> cam->SetViewAngle(2*atan((imsize[0]/2.0)/camFocal) * 180 / M_PI);<br> <br> renderWindow->SetSize(imsize[1]/4, imsize[0]/4);<br> renderer->SetActiveCamera(cam);<br>
renderer->ResetCameraClippingRange();<br><br>The rendering shows up just fine, it's just the vtkSelectVisiblePoints that's not working properly.<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">
On Fri, Jun 8, 2012 at 12:19 AM, Thomas Koletschka <span dir="ltr"><<a href="mailto:thomas.koletschka@gmail.com" target="_blank">thomas.koletschka@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hello,<br><br>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. <br>
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.<br>
<br>Can anyone tell me what I might be doing wrong? I'm using the code as given in the example at <a href="http://www.cmake.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints" target="_blank">http://www.cmake.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints</a>
just 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).<br>
<br>Thanks,<br>Thomas
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>