|
![](/i/fill.gif) |
"gregjohn" <pte### [at] yahoo com> 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
|
![](/i/fill.gif) |