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 09:56:48 EDT (-0400)
  Re: Need a way to make a semi random "landscape".  
From: Patrick Elliott
Date: 6 Oct 2010 00:42:35
Message: <4cabfe3b$1@news.povray.org>
On 10/4/2010 12:30 PM, Christian Froeschlin wrote:
> 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.
>

Hmm. Ok. So.. lol

Well, I suppose I could constrain the area to test to a space within Y = 
0 -> 255, Y = 0 -> 255, for sake of getting results. The problem with 
trying to store the coordinates, instead of using something like trace, 
is the object I am placing "may" land some place better the grid points. 
Storing 65356 points is bad enough, without having to subdivide that by 
some fraction as well.

Like I said, I already have code I wrote to generate my points, I just 
can't "visualize" the result, or really test it visually in the 
environment I want to use it in.

The attached has an example, side view. Black is the landmass, blue the 
water level. The Yellowish box is an object that contains the script. 
The green circle is where the sphere is that defines the constraint for 
the appearance of objects. The pink ones are objects that are generated 
"inside" this region. In some cases I may need to generate a number of 
them all at "ground", but in most cases, the types can be floating over 
the ground as well. The salmon one is, more or less, an example of one 
that actually does physically appear in world. If you get within its 
radius, an object is created, and drops to the ground, which can be 
picked up.

The code I have already is written in Basic. Its going to be a bit 
more.. annoying, since the language I have to then parse this into 
doesn't support types. I.e., I have to use 4 "lists" (sort of an array), 
to handle each set of data for the objects, instead of just creating a 
type, which lets you split up the critical data. Mind, this may not be a 
big problem, since they do have a type that has <x,y,z,u> as attributes, 
so I could store the x,y,z, and a type, in that, as long as I remember 
its not a rotation, but rather coordinates and type data. lol

Basically though, the code is complete. Its just hard to visualize what 
the actual result is, without actual objects to look at. All I have, 
from the code, is a lot of numbers, which "look" like they are doing 
what I want. But I can't tune the design without being able to really 
see what I am ending up with.

-- 
void main () {

     if version = "Vista" {
       call slow_by_half();
       call DRM_everything();
     }
     call functional_code();
   }
   else
     call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models, 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message


Attachments:
Download 'example.png' (3 KB)

Preview of image 'example.png'
example.png


 

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