POV-Ray : Newsgroups : povray.newusers : Access to height field data : Re: Access to height field data Server Time
28 Jul 2024 14:35:11 EDT (-0400)
  Re: Access to height field data  
From: Reactor
Date: 1 Sep 2008 14:50:00
Message: <web.48bc386dcd5c2143e69c67470@news.povray.org>
"Phil" <nomail@nomail> wrote:
> Heya!
>
> I'm trying to create some scenes automatically. My goal is to have an island
> with hills, lakes and trees. The Island shape is defined by an height field
> created by another application. Now I want to add trees and other objects on
> this height field surface. The Question is:
>
> Is it possible to define the z-position (if z is pointing up) of the trees
> automatically by accessing the height field data, and if yes, how, if no, what
> else could be done :)
>
>
> Thanks a lot,
>   Phil


As Warp mentioned, the trace() macro is perfect for this.  In addition to giving
you a location to place your objects at, it can also provide the normal, which
lets you determine the slope at that position.  This can allow you to, for
instance, place trees only on the flatter parts of the heightfield, or maybe
only on the flatter parts below a certain elevation, or maybe only on the
flatter parts above a certain elevation but below another and only on
"southward" facing parts of the heightfield.

While the documentation does an adequate job of explaining how trace works, I
think I will write a wiki article about how it can be used for this.  Please
let us know if you need more help or how things went.


-Reactor


Post a reply to this message

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