POV-Ray : Newsgroups : povray.general : Need a way to make a semi random "landscape". : Re: Need a way to make a semi random "landscape". Server Time
28 Apr 2024 06:08:20 EDT (-0400)
  Re: Need a way to make a semi random "landscape".  
From: Christian Froeschlin
Date: 4 Oct 2010 15:30:30
Message: <4caa2b56$1@news.povray.org>
Patrick Elliott wrote:

> and on a plane placed on it, I could run tests runs, using the code, to 
> make sure that actually does what its supposed to. Problem is, I only 
> fiddle now and then with POVRay, so I have **no** clue how to make a 
> randomly created landscape, or use trace, or use trace from "two" 
> different objects (assuming that is even plausible), to get my "this is 
> where the ground is) value, and thus compute the rest of it...

whoa. I think you need to take this one step at at time, your
post contained a lot of detail without without quite pinpointing
what you're trying to accomplish and your exact problem.

I gathered you want to try some algorithm that traces some
positions over random landscapes. You should probably forget
about the details of your algorithm until you've set up a
test environment.

The easiest way to get a landscape is using a height_field.
A height field can be based on a function instead of an image
file, e.g.

   height_field
   {
     function 512, 512 {0.5+0.5*sin(10*x*y)}
     pigment {color White}
   }

To get a random landscape, you will then need to get
a random function. One way to do this is to use a noisy
function such as f_bozo and vary the position where you
evaluate it by some random parameters. Note this will
not give a particularily pretty landscape. Look up "seed"
and "rand" for getting some random numbers, but it will
not be truly random and depend on your seed.

Regarding trace: If your only intent is to get the height
of the ground below some x,y coordinates, you can in this
case of course simply stuff the coordinates into the function
defining the height field as this already gives the height.

More generally, the trace function takes one object (landscape),
one point (position) and one vector (line direction) and will return
the first point on the object which intersects the line (optionally,
you can also get the normal vector of the surface).

I hope this helps you get started.


Post a reply to this message

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