[vtkusers] FW: ResetClippingpLane

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed May 11 11:53:37 EDT 2005


John/Jim,

	This part of code has been really reworked a lot, for example:

http://vtk.org/cgi-bin/viewcvs.cgi/Rendering/vtkRenderer.cxx?r1=1.205&r2=1.206

	Could you try with a more recent version of VTK ?

HTH
Mathieu

John Platt wrote:
>  
> 
>  
> 
> -----Original Message-----
> *From:* James C Robinson [mailto:j.robinson at kepler-systems.com]
> *Sent:* 11 May 2005 14:39
> *To:* 'John Platt'
> *Subject:* ResetClippingpLane
> 
>  
> 
> Dear John,
> 
>  
> 
> I can’t seem to send the message below to the group (something is 
> blocking it as spam?).
> 
>  
> 
> Could you send it on if possible (and any comments welcomed).
> 
>  
> 
> Regards,
> 
>  
> 
> Jim
> 
>  
> 
>  
> 
> Dear All,
> 
>  
> 
> I have been having a problem with the AutoResetCameraClippingRange 
> facility, in that when viewing objects of certain dimension, zooming in 
> causes detail to be lost when it is too close to the camera. This is, of 
> course, deliberate behaviour, in that objects that are between the 
> camera and the near clipping plane are not rendered. However, the issue 
> is with the distance of the near clipping plane from the camera (when in 
> auto mode). It is set to 0.01 times (1%) the distance of the far 
> clipping plane (which is related to the perpendicular distance of the 
> farthest bounding box vertex from the camera….). The reason for this is 
> related to Z buffering and the quality of images when the near clipping 
> plane is too close to the camera (I think – pure layman’s understanding 
> – that it may be to do with integer maths etc…). Anyway, on 
> investigating deeper into the VTK code for void 
> vtkRenderer::ResetCameraClippingRange I see what looks like an error…..
> 
>  
> 
>   // Make sure near is at least some fraction of far - this prevents near
> 
>   // from being behind the camera or too close in front. How close is too
> 
>   // close depends on the resolution of the depth buffer
> 
>   int ZBufferDepth = 16;
> 
>   if (this->RenderWindow)
> 
>     {
> 
>       ZBufferDepth = this->RenderWindow->GetDepthBufferSize();
> 
>     }
> 
>   //
> 
>   if ( ZBufferDepth <= 16 )
> 
>     {
> 
>     range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
> 
>     }
> 
>   else if ( ZBufferDepth <= 24 )
> 
>     {
> 
>     range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
> 
>     }
> 
>   else
> 
>     {
> 
>     range[0] = (range[0] < 0.01*range[1])?(0.01*range[1]):(range[0]);
> 
>     }
> 
> The error is that (I may be misreading the code in my haste to find a 
> solution) range[0] will be reset to 1% range[1] regardless of the value 
> of ZBufferDepth. I would have thought that (a) if this is the case, 
> there is no need for these 10 lines and (b) the larger z buffer depth 
> (number of bits in the z buffer – usually 24 nowadays?) would mean that 
> the near plane could be significantly closer to the camera? Say 0.01% - 
> which would suit my needs as I am viewing objects with a dimension of up 
> to 3000 units and I would like to be able to see detail in objects 
> within as close as 0.3 units.
> 
>  
> 
>  
> 
> Please advise.
> 
>  
> 
> Regards,
> 
>  
> 
> Jim
> 
>  
> 
>  
> 
> *James C Robinson**, *
> 
> *+**    42 Rivergrove**,*
> 
> *         Glanmire,*
> 
> *         **Co.** **Cork**,*
> 
> *         **Eire*
> 
> *'**     +353 21 4822028*
> 
> *         +353 87 2393010*
> 
> *-**    **jrobinson at eircom.net> <mailto:jrobinson at eircom.net>** *
> 
> ------------------------------------------------------------------------
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list