|
|
"Mick Hazelgrove" <mic### [at] mhazelgrovefsnetcouk> wrote:
> I have a hf created with an isosurface. I want to place grass on it -
> easy BUT I only want to place grass on the sides of the hills facing the
> camera. How can I test to see which slopes are facing me and which are
> hidden.
>
Trace the point, and compare the surface normal at the point to the
camera->point vector. If the angle between the two is greater than 90
degrees, the surface is facing away from the camera. You might also want to
include points just below the horizon, i.e. points where the angle is a bit
more than 90 degrees. Example:
//CamPos: camera location
//TestPos: traced point on the HF
//N: surface normal at the point
//MaxAngle: 90 is at the horizon, >90 is beyond the horizon
#declare CamDir=vnormalize(TestPos-CamPos);
#if(vdot(CamDir,N)>cos(radians(MaxAngle)))
//put grass here
#end
--
Margus Ramst
Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg
Home page http://www.hot.ee/margusrt
Post a reply to this message
|
|