Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Fractal exploration

Author
Message
Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 5th Apr 2006 18:01
I read up on fractals last night and created this program today. Basically let's you explore Mandelbrot's equation. To zoom in just click on the image after the picture has been drawn.

Here's the first image you get:
http://caption.dfs.uh-hosting.co.uk/fifth.jpg

Here's an image that zoomed into one part by a factor of a 100:
http://caption.dfs.uh-hosting.co.uk/sixth.jpg

In theory you can zoom in an infinite amount of times and still find detail, but the variables are declared as floats so only zooming up to about 1000000 is possible. I tried to declared the varaible as double floats, but couldn't work out the syntax. If anyone wants to improve on that it would be greatly appreciated. Anyway the code is below. I haven't commented it as I am lazy, but if you have any questions I will happily answer.
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 6th Apr 2006 00:46 Edited at: 6th Apr 2006 14:04
i've been studying fractal terrains for a heck of a longtime now, and i learnt very early on that for making realistic looking fractal terrains, mandelbrot is simply a no-no.

the best fractal system i've come across was the "diamond-square" algoryhtm. the maths involved is simple, and so is the theory, the bit i struggled with was putting it into code.

the system is a very slow one, especially for larger LOD. i set the detail constant to 16 and it takes about 20 seconds to generate a terrain, setting to 32 takes about a miute, 64 takes about 10 minutes.

last night i set it to 256, and left it running on my laptop while playing cs:s on my pc. it took so long that i'd completely forgotten my laptop was running, and suddenly in the middle of playing, my laptop screen turned green and the most beautiful random-yet-realistic-looking terrain appeared infront of me, and i promtly recorded as much as i could on fraps.

the maths takes a heck of a long time for my laptop to compute, (with 64-bit and 1gb ram - not that 64 bit makes a difference with dbp) but it's dam worth it. i'd like to look into other methods, i have an idea for an algorythm using sin/cos waves.

http://i4.photobucket.com/albums/y147/el_goorf/fractal.jpg
^-- detail = 32
^-- spikeness = 500
^-- roughness = 0.5

i'll admit it's not a very good screenshot, what you're looking at is a matrix from a distance away, hence seeing through the backside of some of the polygons, and i have lack of outline, so you cant make out the difference from near hills to far hills terribly well

http://www.gameprogrammer.com/fractal.html
for more info

i hope you'll understand that i don't really want to give my code out, i like to wallow in my achievements for a bit first before handing the glory over...

im in the process now of optimising my code to see if i can generate it faster. what i also want to do now is generate random bump maps and textures, sky with random clouds, randomized buildings and rivers, random trees and shrubs etc...

[Mod Edit - JessTicular]
Please don't post such large images - I've turned it into a link
[/Edit]

Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 6th Apr 2006 02:42 Edited at: 6th Apr 2006 05:13
Nice to see someone else is interested fractals. I've start writing my own fractal formulas and some are creating some nice water type effects and one I'm considering would make a good space exploration simulation if I transform it into another dimension. At the moment I seem to looking at it more from an art concept though.

Edit:
I've just been creating plasma fractals which seem like they would be perfect for landscapes. A good link is here:

http://library.thinkquest.org/26242/full/types/ch10.html
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 6th Apr 2006 12:07
Hi guys, looks like very interesting stuff. Can you guys recommend any resources that helped you while learning fractals? (Yes i can use google, it just helps wade throught the crud if you guys have any tried and tested resources)
Thanks alot !

M.I.A is pending
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 6th Apr 2006 12:37
I did a Mandelbrot fractal program in 2002;

http://forum.thegamecreators.com/?m=forum_view&t=1886&b=11

Boo!
Kain
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: NJ, USA
Posted: 6th Apr 2006 15:51
Nice work man! I don't need it for terrain, but still cool to look at

Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 6th Apr 2006 18:26 Edited at: 6th Apr 2006 18:34
plasma fractals look quite similar, yet slightly different to the diamond-square algorythm i use. looking into them now ^_^

edit: after looking into the plasma fractal algorithm in detail, it turns out it is excactly the same as the diamond-square algorythm, just a different name. if anyone has any other fractal system's they'd like to share, please do

Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 6th Apr 2006 20:51
Nice colour scheme spooky, much better than my black and white.

One questions as you seem to encoutered the same thing I did. Is that declaring as double float makes absolutely no difference to declaring as a float and I have no clue why and I see you ran into the same problem. Any ideas why?

Here's a good resource for those interested:
http://library.thinkquest.org/26242/full/progs/algor.html
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 6th Apr 2006 21:19
Double floats do give a slightly better number of decimal places but once you are zoomed in a few screens, the numbers are so small that DBPro just starts introducing rounding errors. So basically writing a proper fractal program may be impossible.

If I get bored one day I may revisit the code and try some new ideas I have to get around the problem.

I quite like your black and white effect.

Boo!
Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 6th Apr 2006 23:22
I suppose you could have a seperate variable as an exponent and then you can keep a constant amount of significant figures. Hopefully not too much accuracy lost through that.
Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 7th Apr 2006 08:48
Well, I have started to look at julia sets now and here's a picture my program generated:

http://www.deviantart.com/deviation/31459801/
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 7th Apr 2006 10:10
Wow thanks...bookmarked for when I have time!

M.I.A is pending
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 7th Apr 2006 19:10
woot my code is uber optimised, and literraly runs 3600 times faster. what took an hour to do now takes 1 second

Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 8th Apr 2006 13:54 Edited at: 8th Apr 2006 14:13
excuse the double post, but this is onto a different topic:
anyone used plasma terrains notice that they just get a curved spike, rather than straight edges (when not displacing b the randomness)

http://i4.photobucket.com/albums/y147/el_goorf/2dfratal.jpg

top curve = disecton through middle of terrain
bottom curve = edge of terrain
white area = terrain itself

according to the site, and also my maths, the sides should be straight anyone comment on this?

Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 8th Apr 2006 19:40
You algorithm appears to be different to the one I linked if you mean for them to be the same.

Fot example the halfway point on joining the two corners should, presuming the two corners are equal, be:

(corner1+corner2)/2=corner1=corner2

However this is not the case with yours.
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 8th Apr 2006 22:04 Edited at: 9th Apr 2006 00:32
hmm i may have misread the tutorial, looking into it now

update: you were quite right, the tutorial i read didnt quite make it clear as to only do the corners and not the middle point.

it's still got a tiny element of spikiness to it though, but i'll carry on working with it.

for now, check out these screenshots i got when i changed the max seed from a byte to a dword to get the full spectrum of colours:

http://s4.photobucket.com/albums/y147/el_goorf/

mm0zct
21
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 12th May 2006 01:01 Edited at: 12th May 2006 01:10
this produces a rather spectacular result if you are patient enough i'll post a screeny for those of you who can't wait



AMD athlon 64 3000+, 1GB ddr400, 400GB total hdd, ati radeon x700pro 256mb (pci-e), onboard nvidea graphics (6100 chipset, sharing 128mb ram) 3x17" tft(@1280x1024).

Attachments

Login to view attachments
JerBil
20
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 12th May 2006 04:34 Edited at: 12th May 2006 04:35
Hatsu, I hope you don't mind a few more changes. Here's your
fractals with "fur."



-JerBil

Ad Astra Per Asper
Hatsu
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location:
Posted: 16th May 2006 17:36
Wow, some nice stuff there you two.

I really like the idea of the random noise added to the picture, but still using the gradient. Would you mind if I included an option to do that into my program.

Update about the program:

I given the user now a lot of control over colouring and have added a couple of other fractal varieties and plan on adding more soon when I work out a few maths functions.

For a look at what can be produce so far, he is some of my work;
http://hattsu.deviantart.com/gallery/

Now that I've finally finished all my exams, I hope to actually get a release of this over the summer.

Login to post a reply

Server time is: 2024-11-22 23:30:32
Your offset time is: 2024-11-22 23:30:32