[vtkusers] VtkCamera -- Zoom method
Gerrick Bivins
gbivins at objectreservoir.com
Wed Sep 24 15:17:30 EDT 2008
Hi Chris,
I actually figured out that my understanding of the ³zoom² operation was
incorrect after querying on another list.
;)
I can¹t use this functionality because I have large models (spatially) with
small details and after a couple of ³zooms² the view angle is really small
which causes problems later in the render pipeline.
Gerrick
On 9/24/08 1:16 PM, "Chris Volpe ARA/SED" <cvolpe at ara.com> wrote:
> I read this post mainly because I thought it might have something to do with
> my Dolly question from a couple weeks ago. I¹m not sure why you¹re questioning
> this implementation, or what you mean by ³translation², since there¹s no
> translation going on here. ³Zooming² doesn¹t mean moving the camera closer to
> what it¹s looking at (that¹s called ³dollying²). Zooming is what happens when
> you put a zoom-lens (or ³telephoto² lens) on your camera, which basically has
> the effect of reducing the camera¹s view angle so that objects that subtend a
> smaller view angle fill the image. This is basically synonymous with
> ³magnification².
>
>
> Chris
> --
> Christopher R. Volpe, Ph.D.
> Email: cvolpe at ara.com <mailto:cvolpe at ara.com>
> Senior Scientist, Information Exploitation Systems Main Desk:
> 919-582-3300
> Applied Research Associates, Inc <http://www.ara.com/>
> Direct: 919-582-3380
> 8537 Six Forks Rd., Suite 6000
> Fax : 919-582-3301
> Raleigh, NC 27615 Web:
> http://www.ara.com/offices/NC.htm <http://www.ara.com/offices/NC.htm>
>
>
>
> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of
> Gerrick Bivins
> Sent: Monday, September 15, 2008 6:26 PM
> To: VTK-users
> Subject: [vtkusers] VtkCamera -- Zoom method
>
> Hi All, Long email but please bear with me.
> ;)
> I have had this problem of zooming in with vtkInteractorStyleRubberBandZoom.
> Today was the day to tackle is and eventually I realized that zoom works fine
> when I use parallel projection but not perspective.
> When I switch to perspective projection and zoom in, at some point the view
> angle gets set to 0 (1e-8).
>
> I¹ve dug down into the code and ran across this implementation for Zoom in
> vtkCamera which is being called by vtkInteractorStyleRubberBandZoom:
>
> //----------------------------------------------------------------------------
> // Change the ViewAngle (for perspective) or the ParallelScale (for parallel)
> // so that more or less of a scene occupies the viewport. A value > 1 is a
> // zoom-in. A value < 1 is a zoom-out.
> void vtkCamera::Zoom(double amount)
> {
> if (amount <= 0.0)
> {
> return;
> }
>
> if (this->ParallelProjection)
> {
> this->SetParallelScale(this->ParallelScale/amount);
> }
> else
> {
> this->SetViewAngle(this->ViewAngle/amount);//<==Why is zoom implemented
> like this? Why isn¹t it a function of translation?
> }
> }
>
> Which is defined here:
> void vtkCamera::SetViewAngle(double angle)
> {
> double min = 0.00000001;
> double max = 179.0;
>
> if ( this->ViewAngle != angle )
> {
> this->ViewAngle = (angle<min?min:(angle>max?max:angle));
> this->Modified();
> this->ViewingRaysModified();
> }
> }
>
> At this point(when min is set ), rendering becomes messed up (backfaces and
> bad z-fighting) and the only way to fix things is to restart the application.
> This 0 can be seen as problematic in functions like
>
> vktRenderer::ResetCamera(double bounds[6])
> {
> ...
> //around line 990
> distance =
> radius/sine(this->ActiveCamera()->GetViewAngle()*vtkMath::Pi()/360.0);//<==
> (radius/some really small number if view angle is small) == some really big
> number(e12)!!!!!
> ...
> //around line 1004
> this->ActiveCamera->SetPosition(center[0]+distance*vn[0],
> center[1]+distance*vn[1], center[2]+distance*vn[2]); //<==Uh Oh distance is a
> really big number(e12)!!
> }
> So finally, my question deals with trying to get a better understanding of the
> ³Zoom² method in vtkCamera.
> I don¹t understand why zoom is implemented by changing the view angle.
> Why isn¹t it a function of translating the camera along it¹s view vector
> toward or away from it¹s lookAt point?
>
> Hopefully someone made it this far and can shed some light here.
> ;)
> Gerrick
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080924/4470f13a/attachment.htm>
More information about the vtkusers
mailing list