POV-Ray : Newsgroups : povray.advanced-users : Trees on landscape--uneven distribution : Re: Trees on landscape--uneven distribution Server Time
29 Jul 2024 06:27:24 EDT (-0400)
  Re: Trees on landscape--uneven distribution  
From: Mark Weyer
Date: 25 Nov 2002 06:44:54
Message: <3DE20F78.8D7695A0@frege.mathematik.uni-freiburg.de>
> 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

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