Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Richard Fabian, posted on January 18, 2001




Image Description, by Richard Fabian



This is a new fractal (I think) that I have named "Blob map". It is a type of perlin noise function, but the idea came from having to do materials in our terrain (so that we can get things like waterfalls to occur naturally). I set about devising a fractal that had equal probability of any material being at any location, but had the smooth edges and irregularities associated with a perlin noise (terrain) funtion.

The fractal just returns the index of the current highest perlin noise fractal, so programming it was easy, but actually thinking about how to do it took some time. I initially tried to make an N-dimensional perlin noise function, and just disregard any plots that fell outside an N-dimensional triangle (so that the probability was always equivalent), but reading the tutorial on Barrycentric coordinates, i prooved to myself that to plot any point inside an N-dimensional triangle, all you needed was to supply scalars to N-dimensional verts, and find out which corner the result was closest to. Now simplifying this to a case of strongest scalar wins wasn't a big deal, so that is why i now use this highest perlin function returns its index.

If you want the source code or a demo, I have put them on my operations site. (this is the organisation web site) http://omnisentient.vcollective.org/engine/downloads/index.html


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Kristoffer Josefsson

January 18, 2001, 07:55 AM

I can see lots of uses for this stuff like placing terrain on maps randomly but still know how much of it you want (ie 30% woods, 60% mountains and 10% lakes). I suppose you can make cool procedural effects as well.. ( as you mentioned). I'll take a look at the source for sure.

 
Stinger

January 18, 2001, 10:01 AM

Very nice. What is "perlin noise" ?

 
Pants

January 18, 2001, 10:31 AM

This sucks!

NO NO! Sorry. That was a JOKE! Lets hope we never have to go through all that again.

Ok. This is very interesting to me. Aside from looking quite funky it could be used for a multitude of cool stuff. Procedurally generating faction borders in RPGs? Generating county boundarys for the next gen of Elite clones?

The pics seem to get more fuzzy and less regular as the "Reduction" parameter rises. Could you autogenerate detail textures using this?
E.g. A texture for a dry lake bed you would use the 0.2 setting. The grey scale the image and run edge detection on it. This would give you some cool looking "Off-Round" shapes That look like a dryed out lake bed.

Just some thoughts.

Pete

 
DirtyPunk

January 18, 2001, 10:38 AM

It would be interesting to make electronic jigsaw puzzles with this method :) Those pieces would provide quite a
challenge, and it would certainly be very cool.

I was wondering about how good your materials looked with the method though - the edges between them
would be fairly harsh - do you use some sort of interpolation or dithering to reduce the harsh change to
something softer? Then again, I haven't seen your landscape, so I don't know if it is a problem or not :)

 
Raspberry

January 18, 2001, 10:55 AM

check out http://freespace.virgin.net/hugo.elias/models/m_perlin.htm this is where i learnt about the base fractal

 
Vorteks

January 18, 2001, 10:59 AM

Hey, look! The IOTD forum is back.

That's a cool image. One use I can think of for this is generating layers for paralax scrolling in a shooter. Maybe that idea seems a little "out there", but the first thing I though of when I looked at those blobs were the floating Islands from Tyrian. Would your algorithim be able to do something like that?

 
Raspberry

January 18, 2001, 11:00 AM

Actually, i really like that idea (lake bed), and may use it to generate some of the textures in our game. The fractal is resizable to any degree, as it uses the infinite version of perlin noise (well at least 32bit proper anyway), but it should be pretty simple to change is so that it is tilable for any power of two.

steal the source code if you want, I'm releasing the game engine (client side) for free when it's done.

 
Raspberry

January 18, 2001, 11:03 AM

Well, if you modified the function so it could add a vector to the x and y values *sent* to the perlin-noise generator, then yeah, but it's not really what this fractal is about, you'd probably be better off using layers of perlin with thresholds, these are equal probability mapped noise functions, so will change if you shift them (i take it you would to get any parralax effect)

 
Pants

January 18, 2001, 11:08 AM

Cool.

I'd definity be interested in the code for this when you've finished...
You got a web site?
Pete

 
Raspberry

January 18, 2001, 11:10 AM

Love the Jigsaw idea (never saw that coming) ;]
Wrong end of stick: the material map is purely data for me to use to errode the landscape with reasonable level of accuracy (harder rocks don't errode as fast, nor do they slump as much). The texture materials will be generated later by deduction from all the generated data such as height, normal, material, surrounding materials.... and so it goes on. At the mo, i haven't even got a rendering engine! So even i haven't seen my map other than loading TGAs into Photoshop...
BTW, TGAs are soooooooooooo easy to handle, i think everyone should have the source to import and export them.

 
 
Rasmus Bording

January 18, 2001, 11:43 AM

Check out:
www.noisemachine.com
by Mr. Ken Perlin himself.

 
Pants

January 18, 2001, 12:12 PM

DOH!

How unobservant of me...

 
The Wolf

January 18, 2001, 01:10 PM

It's nice to see that the forum is back up... I find it helps both the person posting and the person interested in the subject. Of course as long as we don't act like complete idiots. A little fun is good, but there's limits.

btw, nice colors, great post

 
z66831

January 18, 2001, 02:34 PM

Very cool image. It would be interesting to see what could be done with fractals besides just terrain generation... there was an article I read somewhere (in a print mag, I *think*) a while back that delved into using fractals for AI... something along the lines of interpreting the deviations caused by iterations in fractal space as evolution within a "brain." This would let you have a genetic algorithm that adapted the *equation* for the fractal in order to evolve the brain of the simulated organism(s).

I've been playing (on and off for a couple of years) with updating Larry Yaeger's PolyWorld to the newest rev of OpenGL and making it run under Win32/Linux/etc... but beyond just bringing the code forward and making it run on modern, common machines I thought it would be fascinating to use it as a starting point for playing with some ideas like this one. Hm.

[offtopic]

I usually don't post, but I wanted to say on behalf of all the other lurkers out there: all of the interest in reading the IOTD gallery comes from the interaction that happens in the message threads. When people ask questions and get links, or the owner of the image jumps in to clarify, great things happen.

I haven't been following the general forums, but I can assume that some debate has been happening regarding whether or not to re-instate message threads. I for one just wanted to duck out of the woodwork momentarily to let everyone AT flipcode know how appreciated this website (and specifically this feature) are... and to let everyone that VISITS flipcode know that we (again, the lurkers) appreciate all the interesting feedback that goes on relating to the images, code, and tips.

Keep up the good work, and I'll try to post more often! :)

[/offtopic]

-z66831

 
EGreg

January 18, 2001, 04:16 PM

That looks very interesting. How exactly are you going to use this?

Sincerely,
Greg

 
EGreg

January 18, 2001, 04:19 PM

Thanks, Kurt. It's great to see people can discuss the IOTD again. I think that little break let everyone calm down a bit.

-Greg

 
hdmx

January 18, 2001, 04:45 PM

If I remember correctly almost no code is needed to load a TGA. If you know the image dimensions you don't even have to parse the header. Just load the image data in memory and flip it around x. Right? Or do you have to change the byte order as well?

 
fluffy

January 18, 2001, 06:34 PM

"Multifractals" are very good for procedural terrain generation. That's an interesting way to generate regions for multifractals for procedural terrain and the like. What you should probably do is keep track of the two highest ones and use their relative heights as a blending value between the outputs of their respective generation functions. If you want to get really fancy, you could even just calculate a weighted average of all your generation functions, weighted by the height of their respective Perlin maps at that point. Then you can generate entire worlds with just a few values passed into the respective Perlin functions.

Sorry if this is even less coherent and understandable than I normally am, but I'm kinda distracted right now. Whee. Let me try explaining this a bit better through pseudocode:


// Generic class for individual fractal generation
class Fractal {
Fractal();
virtual float operator()(float x, float y) = 0;
};

class Perlin: public Fractal {
Perlin(blah blah blah);
float operator()(float x, float y) {
// blah blah
}
};

// Stuff associated with a perlin map
struct LandType {
Fractal heightfunc;
Material material;
etc.etc.
};

typedef map<Perlin, LandType> MultiFractal;

float Height(float x, float y, MultiFractal fractals)
{
// weighted average of the heights
float ht = 0, ttl = 0;

for (MultiFractal::iterator iter = fractals.begin();
iter != fractals.end(); iter++)
{
float wt = (*iter).first(x, y);
ht += (*iter).second.height(x, y)*wt;
ttl += wt;
}

return ht/ttl;
}





and so the structure you setup to get an overall height for that point on the world would just be a map which associates fractal generators with their respective Perlin map. Obviously it'd be most useful with stateless fractals where, given the same parameters and coordinates it'll always put out the same output.

Whee.

 
DirtyPunk

January 18, 2001, 08:17 PM

I believe the colour information is stored slightly differently to normal - BGR (Bugger) format. But, TGAs are very easy to read if they are only the standard easy to read ones :)

 
DooMWiz

January 18, 2001, 10:54 PM

Yep, TGA files store their data in BGR format, but the header is in Little Endian format, so you don't have to mess with switching those values on Little Endian platforms. I would recommend reading the header, just so you don't make automatic assumptions about the image's dimensions or hardcode dimensions (bad bad bad! =).

 
Machin Shin

January 19, 2001, 12:41 AM

i didn't have anything in particular to say except this:
fluffy, i *LOVE* your coding style :)

oh, and yeah, cool iotd
;)

--vat

 
ribblem

January 19, 2001, 02:42 AM

Cool pics. I'm working on creating landscapes from heightmaps as well. Right now I've got a simple fault formation fractal generator working and the code to generate the geometry. I'm looking for some really cool fractal generation skeams like this one so if you know of any others that look good I'd like to hear about them.

The cool original thing I want to do is to come up with some image processing kernals that trasform the heightmaps into even cooler looking heighmaps. So if anyone has ideas about a kernal that would enhance landscape I'll like to hear about that too.

 
Max

January 19, 2001, 03:00 AM

"The cool original thing I want to do is to come up with some image processing kernals that trasform the heightmaps into even cooler looking heighmaps."

Maybe a filter that adds craters on top of a landscape? Or perhaps one that lops off the top of mountains and makes plateaus? You might also be able to do some neat things by simulating erosion.

Max

 
SigmundSEGV

January 19, 2001, 04:01 AM

I usually don't post, but I wanted to say on behalf of all the other lurkers out there: all of the interest in reading the IOTD gallery comes from the interaction that happens in the message threads. When people ask questions and get links, or the owner of the image jumps in to clarify, great things happen.

I haven't been following the general forums, but I can assume that some debate has been happening regarding whether or not to re-instate message threads. I for one just wanted to duck out of the woodwork momentarily to let everyone AT flipcode know how appreciated this website (and specifically this feature) are... and to let everyone that VISITS flipcode know that we (again, the lurkers) appreciate all the interesting feedback that goes on relating to the images, code, and tips.

Keep up the good work, and I'll try to post more often! :)

Very nicely put. I agree completely. Thanks Kurt and all at flipcode.

 
Raspberry

January 19, 2001, 05:33 AM

I am using it to define the type of ground underneath the terrain, so i can errode the land mass in a convincing manner.

 
Raspberry

January 19, 2001, 05:39 AM

Hey, that's a great idea, I shall look into using that (especially into getting flat plains and other humpy landscapes that are impossible using just a single perlin noise function. This may be a big about turn on what I said to my friend (who I am developing the game with), as i said "right, erm, yeah this is the FINAL fractal for the terrain, and no you can't have great buffalo plains"

 
Raspberry

January 19, 2001, 05:44 AM

If you look into perlin noise, you will see that you aren't limited by the size of the fractal, as you can pick points anywhere in space. In reference to FLUFFY, i would say that his idea of using a truly mulit-fractal would be great for anyones landscape, so that would include any fractal that was reasonably large (we intend on using the entire domain of 32bit numbers for the dimensioons of our world (at a 1:1 metre ratio), so we need functions that can work on a local scale but can take global positioning. This is the main reason I am using perlin noise.)

 
Phil Carlisle

January 19, 2001, 05:46 AM

Best thing to do, is get photoshop, and try some filters out on an image, and load that as your heightmap, find combinations of filters that produce good results, and code those up!

I quite like a good multifractal ran through a gaussian blur.

Phil.

 
Raspberry

January 19, 2001, 05:55 AM

I would like to thank everyone for posting so positivley to an image that wouldn't even get looked at twice by the public. It is the appreciation of work-done that makes the IOTD forum so great for me, and I would love it to stay that way forever. The calculator demo was a fine example of something that was truly great, but was unlikely to be seen as that by Joe Public, and i beleive my code is similar, although not nearly as hard. The point I am tryng to make is simple. The IOTD forum is not about images, how good they look, nor how hard they are for *YOU* to do. They are something that someone *ELSE* wants to show off, because he thinks he/she did their job well, within their own limits. For this reason, I do not care what language the image was generated in, that is programmers prerogative. Positive posts on an image that is not "Pretty" is what makes us all more productive, and generally makes us all feel more appreciated, even though we may not be the next "Carmac".

 
This thread contains 35 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.