Fractal terrain scripts


(wrote this offline and wrapped strangely – perdon)

I see I can’t attach text files, so I’ll post the scripts in two separate messages as this is getting too complicated for me.

I’ve finished the first take at scripts for fractal terrain, and here they are for anyone interested to play with. andnbsp;Any feedback would be welcome. andnbsp;I’m not going to
work on them for a while as I have to do some work on the scenes they will be used for, and I need to think how they will all come together.

The main gap in what they do is in material handling. andnbsp;
Many algorithms just assign a different material to
a terrain according to the altitude of the face. andnbsp;I’m leaving
that till I’ve had more experience with handling materials in 3DC.

Feel free to do whatever you like with these scripts. andnbsp;The way the algorithm perturbs
the terrain is particularly malleable. andnbsp;I’ve also done a script to allow preshaping
of a terrain, so you can get your mountain where you want it. andnbsp;I haven’t played with
it enough to see how successful this is in a real scene, but it appears to work.

Couple of questions for those who enter:
Can you turn off the interpreter warning that the script is taking too long? Why are the generated objects sometimes difficult to edit using 3DC tools? Select face
and deform don’t always work, and I think I might need to turn the object upside down

1st warning about number of faces – you get 2^(N+3) faces (I think – anyway it gets big)
– where N is the number of iterations of the algorithm entered by the user.

Have fun – following are my notes.

_Notes for Fractal Terrain Scripts_

There are two scripts: andquot;Fractal Terrainandquot; and andquot;Fractalise a Plane Objectandquot;

andquot;Fractal Terrainandquot;

This creates a fractal terrain based on the diamond square algorithm. andnbsp;

For more info on the algorithms, and ideas how to use them, see:
<!– m –><a class="postlink" href=""> … -step.html</a><!– m –>

<!– m –><a class="postlink" href=""></a>&lt;!– m –>

These places have code in java and c++ which I tried to steal – just ended up
with a mixture of theirs and andnbsp;my variable names as I ended up rewriting everything

1. andnbsp;andquot;Fractal Terrainandquot;

Creates a terrain of quadrilateral faces. andnbsp;The corners are seeded with random heights
between values entered by user. andnbsp;Terrain uses these seeds and two other parameters
to generate terrain. andnbsp;The andquot;decrementandquot; parameter is decreased every iteration through the
algorithm, so the final level of detail is proportional to decrement^N – where decrement
is [1 and N is the number of iterations.

Number of faces created is 2^(N+3), so quickly gets big. andnbsp;My computer does N=6 easily,but
for N=7 the interpreter kept asking me if it was taking too long, and wouldn’t I rather be
having lunch? andnbsp;(Can this message be turned off?)

There is a dialogue which asks andquot;Create a plane object?andquot;

Answering yes to this creates an object with the required number of faces, but with all points
lying on the same plane. andnbsp;This is for the next script.

2. andnbsp;andquot;Fractalise a plane objectandquot;

This takes a 3dc object and applies the algorithm found in andquot;Fractal Terrainandquot;. andnbsp;The idea is
to apply some preshaping to the fractal terrain created. andnbsp;For example, if you want a
vally at one end, and a mountain in the middle, do this:

i) create a plane object using andquot;Fractal Terrainandquot;
ii) shape that object using the 3dc tools.
iii) select the object and run andquot;Fractalise a plane objectandquot;

You hopefully will get the shape of terrain you want, with the detail added by the second

You must be logged in to reply in this thread.