POV-Ray : Newsgroups : povray.text.tutorials : WANTED: a straightforward macro for keeping objects lined up for the camera : Re: WANTED: a straightforward macro for keeping objects lined up for the camera Server Time
25 Apr 2024 06:16:53 EDT (-0400)
  Re: WANTED: a straightforward macro for keeping objects lined up for the camera  
From: Defective
Date: 8 Nov 2000 13:29:36
Message: <b27i0tg8l509mufq63lg56efmdotq6kgqs@4ax.com>
I think my brain just exploded!

I may have just worked out a useable method...

The basic idea is this:

If the objects being controlled and the camera are manipulated in
exactly the same way as the camera, they stay lined up.

What I've done is to pick a distance for the camera from the origin
and done all other aiming by rotation.  Then I placed the objects (in
this case, markers for the axes) at the origin and aimed them at where
the camera would be with no rotations.  Next, I rotate them the same
as the camera.  Finally, I translate them to their final locations.

Now I just need to wrap my mind around aiming the camera by
rotation...

I've generated a nifty little animation that demonstrates the
idea...It runs through rotations around X, Y, Z, XY, XZ, YZ and XYZ.

WARNING:  loading up the output in ACDSee and starting a full-speed,
looping slideshow in full screen mode can damage your brain!  :P

Defective O_O

---------------------------------------------------------------------------------------------------------
Sample code follows:

The scene:  (direction markers.pov)
~~~~~~~~~~

#include "metals.inc"
#include "colors.inc"           

global_settings { assumed_gamma 2.2 }

#render concat(  "\nClock: <",str(clock, 5, 2), ">\n")

///////////////////////////////////////////////////////////
#declare VXrot = clock * (
                         (clock < 360)
                       | ((clock >= 1080) & (clock < 1440))
                       | ((clock >= 1440) & (clock < 1800))
                       | ((clock >= 2160) & (clock < 2520))
                         ) ;

#declare VYrot = clock * (
                         ((clock >= 360) & (clock < 720))
                       | ((clock >= 1080) & (clock < 1440))
                       | ((clock >= 1800) & (clock < 2160))
                       | ((clock >= 2160) & (clock < 2520))
                         ) ;

#declare VZrot = clock * (
                         ((clock >= 720) & (clock < 1080))
                       | ((clock >= 1440) & (clock < 1800))
                       | ((clock >= 1800) & (clock < 2160))
                       | ((clock >= 2160) & (clock < 2520))
                         ) ;

///////////////////////////////////////////////////////////

camera { location <0, 0, -50> look_at <0,  0, 0>
        rotate <VXrot, VYrot, VZrot>        
       }

#declare Material  = T_Chrome_1D 

sphere { <0,0,0>,10 texture { T_Chrome_1D } finish { ambient 1} }


   text { 
      ttf "timrom.ttf" "+X" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <20, 0, 0>
   }

   text { 
      ttf "timrom.ttf" "+Y" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <0, 20, 0>
   }

   text { 
      ttf "timrom.ttf" "+Z" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <0, 0, 20>
   }

   text { 
      ttf "timrom.ttf" "-X" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <-20, 0, 0>
   }

   text { 
      ttf "timrom.ttf" "-Y" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <0, -20, 0>
   }

   text { 
      ttf "timrom.ttf" "-Z" .1, 0
      pigment { Orange } finish { ambient 1 }
      scale 5
      rotate <VXrot, VYrot, VZrot>        
      translate <0, 0, -20>
   }


My INI file:  (direction markers.ini)
~~~~~~~~~~~~

Initial_Clock=0
Final_Clock=2520
Initial_Frame=0
Final_Frame=360
Input_File_Name=direction markers.pov


Post a reply to this message

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