POV-Ray : Newsgroups : povray.general : Define camera angle from a given right : Re: Define camera angle from a given right Server Time
30 Jul 2024 16:18:51 EDT (-0400)
  Re: Define camera angle from a given right  
From: Thomas de Groot
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

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