[vtkusers] Near plane clipping problem
Serge Lalonde
serge at infolytica.com
Fri Oct 17 11:10:14 EDT 2008
Has anyone ever noticed that it is very easy to cause the near clipping
plane to cut-off the model when in parallel projection mode?
I ran into this recently when adding a vtkBoxWidget and scaling a simple
cube a few times after rotating it so that one of the corners points
towards the viewer.
I tried calling vtkRenderer::ResetCameraClippingRange() to no avail.
vtkRenderer::ResetCamera() fixed the problem, but would lose my camera
setting.
After searching fruitlessly in the vtkusers archives, I decided to trace
into the code and I discovered that there is code in
vtkRenderer::ResetCameraClippingRange() and
vtkCamera::SetClippingRange() that modifies the near plane value to
"fix" potential camera and depth buffer problems. In my opinion, these
fixes are valid, but only for perspective projections. For parallel
projections, they are unnecessary and in fact cause the clipping problem
I was encountering. To test this, I modified the code and rebuilt and lo
and behold, no more near plane clipping!
I decided to document this in the vtkusers list in case others have run
into this problem. Attached is my modified version of vtkCamera.cxx and
vtkRenderer.cxx along with the patch files relative to version 5.2.0
(only vtkCamera.cxx has changed since then). The changes are small and
localized. If anyone tries them, let me know if you run into any
problems (or even if you don't). I will submit them to Kitware for
consideration also.
Thanks.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkCamera.cxx
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081017/07ae13b2/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkRenderer.cxx
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081017/07ae13b2/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkCamera.cxx.patch
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081017/07ae13b2/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkRenderer.cxx.patch
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081017/07ae13b2/attachment-0001.asc>
More information about the vtkusers
mailing list