[vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange()
Elvis Stansvik
elvis.stansvik at orexplore.com
Tue Jun 21 07:40:52 EDT 2016
2016-06-21 13:27 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> I just found this very old bug:
>
> http://www.vtk.org/Bug/view.php?id=7823
>
> I forgot to mention that I'm using parallell projection for the camera.
> Could this be the issue I'm seeing? It seems the suggested patch there was
> never incorporated due to test failures (?). Anyone know of some way of
> working around this?
>
It seems someone else also reported the same problem in 2009:
http://public.kitware.com/pipermail/vtkusers/2009-April/051510.html
Anyone know if this is the same old problem, or if it's something that may
have resurfaced? I'm using VTK 7.0.0.
Elvis
>
> Elvis
>
> 2016-06-21 13:06 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>
>> Hi all,
>>
>> I have a setup where the camera always moves on a cylinder of radius 3.0
>> around my subject (just testing with a stack of cones at the moment). The
>> focal point is always positioned along the Y axis, and the camera may be
>> moved up and down independent of the focus point, but the camera is always
>> at a distance of 3 from the Y axis.
>>
>> As soon as the user moves the camera, I reset the camera clipping range
>> with ResetCameraClippingRange(). Despite this, when the camera and the
>> focal point are far away from eachother, the actors (my stack of cones) get
>> clipped by the near plane for some reason.
>>
>> See the attached screenshot which shows the clipping.
>>
>> What I'm doing to my camera (in response to Shift+mouse drag in my custom
>> interactor) to end up in this situation is just:
>>
>> camera = renderer.GetActiveCamera()
>> (x, y, z) = camera.GetPosition()
>> camera.SetPosition(x, y - self.PanningFactor * dy, z)
>> renderer.ResetCameraClippingRange()
>>
>> and I've verified that the camera is always at a distance of 3.0 from the
>> Y axis.
>>
>> The cones I'm using in this test were created with:
>>
>> for i in range(-10, 20):
>> coneSource = vtkConeSource()
>> coneSource.SetDirection(0, 1, 0)
>> coneSource.SetResolution(8)
>> coneSource.SetCenter(0, i, 0)
>>
>> coneMapper = vtkPolyDataMapper()
>> coneMapper.SetInputConnection(coneSource.GetOutputPort())
>>
>> coneActor = vtkActor()
>> coneActor.SetMapper(coneMapper)
>>
>> widget.renderer.AddActor(coneActor)
>>
>> I don't understand why I see clipping occur here, since I'm using
>> ResetCameraClippingRange, and nothing is behind the camera. The radius of
>> these cones is the default (0.5).
>>
>> It's probably something stupid, but any advice is much appreciated.
>>
>> Elvis
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160621/e164d0ec/attachment.html>
More information about the vtkusers
mailing list