|
![](/i/fill.gif) |
> 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?
First order approximation to what you want:
- Choose a basic probability p.
- Choose dx and dy adequately small.
- Trace the ray, resulting in a point P0=<x,y,z> on the landscape.
- Calculate the points P1=<x+dx,y,z1> and P2=<x,y+dy,z2> of the
landscape
(i.e. calculate z1 and z2)
- Calculate the area A _OF THE IMAGE_ that the triangle P0-P1-P2 would
use.
- Put a tree with probability p/A. Beware of division by zero.
Enhancements:
- Combine with Christopher's suggestion
- Scatter the tree base positions, so they are not only where the rays
hit.
Regards,
Mark
Post a reply to this message
|
![](/i/fill.gif) |