Midpoint displace alg improvement



Hi,

I'm interested in writing a 3d program which can generate random terrain real-time (i.e. ROAM style). I'm hoping to use the midpoint displacement algorithm, with a few tweaks. I just wanted to get an opinion on the first improvement I thought of, which is basically to modify the multiplier for the next displacement using the current height of the midpoint - i.e. the higher the midpoint, the more displaced it is. The idea being that lower ground would be smoother, higher ground more rocky.

I'm not really sure how to describe this properly, so I've pasted the source code below (just 2d for now). Does this qualify as a multifractal? I can't see anywhere that this has been described on the internet - has anyone done this before? It only really works sensibly if the y values are between 0 and 1.

Cheers,
John

void Calc_Fractal (float x1,float y1,float x2,float y2,int I,float H)
{

float x3 = (x1 + (x2 - x1) / 2);
float r = H * Jrand (x3);
float y3 = (y1 + (y2 - y1) / 2) + r;
float Hm = y3;

if (Hm>0.8) Hm=0.8; // clamp values
if (Hm<0.2) Hm=0.2;

if (I < Iterations)
{
Calc_Fractal (x1, y1, x3, y3, I+1, H*Hm);
Calc_Fractal (x3, y3, x2, y2, I+1, H*Hm);
}
else // draw line
{
acquire_screen ();
line (screen, (int)(x1*300), 480 - (int)(y1*300), (int)(x2*300), 480 - (int)(y2*300), makecol(255, 255, 255));
release_screen ();
}
}
.



Relevant Pages

  • Re: I have the elusive dangerous substance in my possession!
    ... displaced fluid volume to float it. ... If it is floating it is a function of mass only. ... given that the object is floating, displacement does depend on mass only. ...
    (rec.crafts.metalworking)
  • Re: Skinniest single scull ever? Odd boat at world masters
    ... since it's got some width to it below the water line, the displacement ... could well be enough to allow it to float. ... teaplant. ...
    (rec.sport.rowing)
  • Re: Help my neighbours kid with his school project...
    ... float is just a few cm thin, you'll only get that each twelve hours. ... Yes, I know that the tide both rises and falls in that time, but you ... of (displacement*3m/12 hours) = 0.68 watts per tonne of displacement. ... to rust than the energy in the coal used to make that steel. ...
    (sci.electronics.design)
  • trouble with displacement shader
    ... im using 3Delight renderer & advanced renderman for reference. ... i tried writing a displacement shader that displaces a surface based on ... the float value looked up from a texture file.it should just ...
    (comp.graphics.rendering.renderman)