|
|
I'm trying to place trees on a landscape using the trace() function so
they're only placed in view of the camera. The script I have places most of
the trees very close to the camera. Does anyone know how to do this so I
get an even distribution of trees, all within the camera's view?
Here's my code:
#declare i=0;
#declare r1=seed(256);
#declare r2=seed(100);
#declare N=<0,0,0>;
while(i<10000)
#declare
dir=vaxis_rotate(camera_look_at-camera_location,vcross(camera_look_at-camera
_location,camera_up),(rand(r1)-.5)*camera_angle);
#declare dir=vaxis_rotate(dir,camera_up,(rand(r1)-.5)*camera_angle*4/3);
#declare X=trace(terrain,camera_location,dir,N);
#if(vlength(N)>0)
object{
cone{0,1.5,7*y,0 pigment{rgb <0,1,0>} scale .5+.5*rand(r1) translate
X}
}
#end
#declare N=<0,0,0>;
#declare i=i+1;
#end
Post a reply to this message
|
|