POV-Ray : Newsgroups : povray.general : Camera angles problem : Re: Camera angles problem Server Time
29 Jul 2024 10:32:35 EDT (-0400)
  Re: Camera angles problem  
From: Nekar Xenos
Date: 19 Aug 2013 14:50:31
Message: <op.w12umdq9ufxv4h@xena>
I've tried using math here but it still doesn't work.

I may have my math wrong

//-----------------------------------//
// begin code

#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//--------------------------------------------------------------------------
// camera  
------------------------------------------------------------------
#declare Camera_0 = camera {perspective angle 75               // front  
view
                             location  <0.0 , 1.0 ,-3.0>
                             right     x*image_width/image_height
                             look_at   <0.0 , 1.0 , 0.0>}
#declare Camera_1 = camera {/*ultra_wide_angle*/ angle 90   // diagonal  
view
                             location  <2.0 , 2.5 ,-3.0>
                             right     x*image_width/image_height
                             look_at   <0.0 , 1.0 , 0.0>}
#declare Camera_2 = camera {/*ultra_wide_angle*/ angle 90  //right side  
view
                             location  <3.0 , 1.0 , 0.0>
                             right     x*image_width/image_height
                             look_at   <0.0 , 1.0 , 0.0>}
#declare Camera_3 = camera {/*ultra_wide_angle*/ angle 90        // top  
view
                             location  <0.0 , 3.0 ,-0.001>
                             right     x*image_width/image_height
                             look_at   <0.0 , 1.0 , 0.0>}
camera{Camera_0}
// sun  
----------------------------------------------------------------------
light_source{< 3000,3000,-3000> color White}
// sky  
----------------------------------------------------------------------
sky_sphere { pigment { gradient <0,1,0>
                        color_map { [0.00 rgb <0.6,0.7,1.0>]
                                    [0.35 rgb <0.1,0.0,0.8>]
                                    [0.65 rgb <0.1,0.0,0.8>]
                                    [1.00 rgb <0.6,0.7,1.0>]
                                  }
                        scale 2
                      } // end of pigment
            } //end of skysphere
// ground  
-------------------------------------------------------------------
plane{ <0,1,0>, 0
        texture{ pigment{ checker color rgb<1,1,1>*1.2 color  
rgb<0.25,0.15,0.1>*0}
               //normal { bumps 0.75 scale 0.025}
                 finish { phong 0.1}
               } // end of texture
      } // end of plane
//---------------------------------------------------------------------------
//---------------------------- objects in scene  
----------------------------
//---------------------------------------------------------------------------

// sample sphere
sphere { <0,0,0>, 1.00
          texture { Polished_Chrome
                    //pigment{ color Red } // rgb< 1, 0.0, 0.0>}
                    //finish { phong 1 reflection {0.40 metallic 0.5}}
                  } // end of texture

           scale<1,1,1>  rotate<0,0,0>  translate<0,1.35,0>
        }  // end of sphere -----------------------------------


global_settings {  max_trace_level 5 assumed_gamma 1}


#include "Transforms.inc"



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


#declare CamPos= <0.5, 1.5,4 >;
#declare CamLook= <1.3,1.2,0>;
//////////////////////////////////

#declare CamDirect=<0,0,1>;
#declare CamUp=<0,1,0>;
#declare CamWidth=image_width;
#declare CamHeight=image_height;

#declare CamAngle=VAngleD(CamPos, CamLook) ;
#declare CamAngleV=CamLook-CamPos;

#declare ColMapPig=pigment {image_map { png "test.png" once}
                              translate -0.5*(x+y)
                              scale <CamWidth/CamHeight,1,1> *2   
//<==============  *2 ******
                              }

//#declare PicBox=
box{<-CamWidth/CamHeight,-1,CamDirect.z>,<CamWidth/CamHeight,1,CamDirect.z+0.001>//}

                          texture {
                                  pigment {ColMapPig}
                                  finish { ambient 1 diffuse 1}
                                  }
                            //}

                             translate CamDirect

                             rotate <degrees( atan2(CamAngleV.y,  
CamAngleV.z)) ,degrees( atan2(CamAngleV.z, CamAngleV.x)),0 >  *x*y


                             translate CamPos

                             }


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

  camera {
          location  CamPos
          direction CamDirect
          right   x*image_width/image_height
          look_at CamLook
          }





// End code
//-------------------------//


Post a reply to this message

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