POV-Ray : Newsgroups : povray.general : Define camera angle from a given right Server Time
30 Jul 2024 14:18:22 EDT (-0400)
  Define camera angle from a given right (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: gregjohn
Subject: Re: Define camera angle from a given right
Date: 3 Mar 2009 22:30:00
Message: <web.49adf5ab78557ac434d207310@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> gregjohn wrote:
>
> > I want complete control of the screen. For example, I want to be able to place a
> > sphere at the corner of the generated image, no matter what the pixel size or
> > ratio of the image, no matter the angle (however it's defined).
>
> Would screen.inc be adequate for your purpose?

Thanks for the reminder, but I think I need to have more control of the entire
screen, not just an ability to have one object placed in front of the camera
for me.

Applications:
i) I want to make a plotting macro.
ii) Crowd scenes.  I think John vanSickle once mentioned making huge crowd
scenes where you only place objects in the scene in places the camera is
looking.

Forevermore, I'm going to start of my scenes with:

#declare iwih=image_width/image_height;
#declare camang=45 // or whatever
#declare azee=0.5*iwih/tan(camang/2*pi/180);
camera {
  direction z*azee
  up y
  right     x*image_width/image_height
 }

box{
<-iwih/2+0.01,-1/2+0.01,0>,<iwih/2-0.01,1/2-0.01,0.001>
 translate z*azee     pigment{Red+Green/4} finish{ambient .1}}


Post a reply to this message

From: Thomas de Groot
Subject: Re: Define camera angle from a given right
Date: 20 Dec 2009 03:49:56
Message: <4b2de534@news.povray.org>
"gregjohn" <pte### [at] yahoocom> schreef in bericht 
news:web.49adf5ab78557ac434d207310@news.povray.org...
> ii) Crowd scenes.  I think John vanSickle once mentioned making huge crowd
> scenes where you only place objects in the scene in places the camera is
> looking.
>
Sorry for coming across this post so late. I use the following code to do 
just that. In order to close fit the Screen when using CamAng, you can 
fine-tune with CamZoom:

camera {
  location  CamLoc
  sky       CamSky
  up        CamSky
  direction z*CamZoom
  right     x*AspectRatio
  angle     CamAng
  look_at   CamEye
}

#end

// --------------------------------------
// visibility test code by Gilles Tran,
// derived from work by
// John Van Sickle and Christoph Hormann
// --------------------------------------
#declare CamD=vnormalize(CamEye-CamLoc);         // direction of camera view
#declare CamR=vnormalize(vcross(CamSky,CamD));   // to the right
#declare CamU=vnormalize(vcross(CamD,CamR));     // camera up

#declare Screen= // pseudo screen to test the visibility of an object
mesh{
  triangle {0, x, x+y}
  triangle {0, y, x+y}
  translate -0.5*(x+y)
  scale <AspectRatio, 1, 1>
  translate CamZoom*z
  matrix < CamR.x,  CamR.y,  CamR.z,
           CamU.x,  CamU.y,  CamU.z,
           CamD.x,  CamD.y,  CamD.z,
           CamLoc.x,CamLoc.y,CamLoc.z >
}
//Set SeeScreen on to test the pseudo screen
#if (SeeScreen)
  object{Screen pigment{rgbf<1,0,0,0.9>} }
#end

#macro IsObjectVisible(PosObject)
// this macro tests the position of the object against the pseudo screen
  #local Norm1 = <0, 0, 0>;
  #local PosTemp= trace (Screen, PosObject, -PosObject+CamLoc, Norm1);
  #if (vlength(Norm1)!=0 )
    true;
  #else
    false;
  #end
#end



Thomas


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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