POV-Ray : Newsgroups : povray.binaries.images : Method to apply transforms to user_defined camera. : Method to apply transforms to user_defined camera. Server Time
24 Apr 2024 04:46:15 EDT (-0400)
  Method to apply transforms to user_defined camera.  
From: William F Pokorny
Date: 27 May 2019 19:36:01
Message: <5cec7461@news.povray.org>
On the povray.general group and in the recent thread:

http://news.povray.org/povray.general/thread/%3C5ce2a3dd%241%40news.povray.org%3E/

IGM / igmar asked about applying transforms to user_defined cameras. The 
documentation implies transform modifiers can be applied, but this is 
not the case in v38 as of today.

The following modification to the shipped user_defined.pov camera scene 
works - as far as it goes - as a way to apply transforms to the user 
defined cameras.

#declare Fxfrm = function {
     transform {              // Given use below:
         rotate <50, 0, 0>    // Stuff happens. Sometimes OK
      // translate <0.1,0,0>  // Stuff happens. Sometimes OK
      // scale 2.0            // 1.0 0.5 2.0 -1.0  Always OK
     }
}

//------- Set up functional camera
#declare FnXrad = function (x) { (x+0.5)*tau }
#declare FnX    = function (x) { cos(FnXrad(x)) }
#declare FnZ    = function (x) { sin(FnXrad(x)) }
#declare CameraUserDefined = camera {
     user_defined
     location {
       function { Fxfrm(FnX(x),0,0).x }
       function { Fxfrm(0,y,0).y }
       function { Fxfrm(0,0,FnZ(x)).z }
     }
     direction {
       function { Fxfrm(-FnX(x),0,0).x }
       function { Fxfrm(0,0,0).y }
       function { Fxfrm(0,0,-FnZ(x)).z }
     }
}

For some user cameras and transforms might be just whats needed. See the 
attached image for some results. For more complex situations, especially 
with rotation, we'd need to handle/re-map the modified vector's x,y,z 
components from all the modified original vectors back into the 
appropriate x,y,z inputs for location and direction. My head is too 
tired to handle that bit at the moment...

Bill P.


Post a reply to this message


Attachments:
Download 'udefcamera_transform.png' (71 KB)

Preview of image 'udefcamera_transform.png'
udefcamera_transform.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.