Fractal Tree

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Fractal Tree

Post by kattle87 »

Well, we needed this for several purposes, and it was really fun for me to create the first ever Recursive Mesh in ZGE :D

http://en.wikipedia.org/wiki/Recursion_ ... r_science)

code is quite heavily commented. Basic idea is:

-Every time a Mesh is loaded, it automatically gets refreshed, meaning we can load the mesh inside the producer to compute it recorsively.
-Like we do in recursive functions, we calculate the two (or more) sub-problems, then we merge them (by adding the MeshBase and elaborating the whole).
-We use the TreeFlag array as a stack for knowing how much is the dept of the tree we are in. This is a quick and easy to understand solution. I could eliminate everything and only use the P variable but the stack will be handly later on. I use the P as a pointer for the stack current position.

-It's also quite fast for my sake: 4 seconds to elaborate a 9-levels tree (6k triangles)
Attachments
FractalTree.png
FractalTree.png (9.98 KiB) Viewed 12716 times
FractalTree.zgeproj
(5.1 KiB) Downloaded 731 times
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

free of context,. .

Post by jph_wacheski »

haha,. yes! I had a dream about this,. your mental waves (or particles?) must have been arching far and wide my friend. I will have a look at the coding in a bit,. I simple must sort out the IG web site,. so I can get back to work building games,. I am so resistant to doing the stuff I don't so much like to do,. but once I start I offten get into it,.
the tree looks good and I am sure we can expand on this and generate a whole forest of twisted digital wild life,. keep hacking that math!

ciao
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Of course, this is more a proof-of-concept rather then something I'm really gonna use :P EG: the way sub-trees should be added is rotating them, not stretching on the left or the right
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

more info.s,.

Post by jph_wacheski »

must be serendipity,. but I was surfing around and hit on a site with a nice detailed procedural tree tutorial, not that you need help with this! your concept is working fine,. just thought I would point it out, in case he has some good ideas in there,. it is in freeBASIC so easy to read/adapt,.

cheers!
Attachments
PocketForest_001.zip
VERY rought first hack,. but fun!
(40.93 KiB) Downloaded 625 times
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

uhm.... Name of the site? :D

BTW: I already have some ideas of how to use recursion to his real potential, will experiment in the next future.
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

iterationGAMES.com
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

pocket forest 007

Post by jph_wacheski »

just a little bit more on that demo,. well a lot actually! I think this will become a game,. enentually I have a few ideas for it now, I'll see what develops. it pauses for a minuet when you run it as I am doing slightly randomized trees per the 80 or so models,. ;)

I have just been hacking around with the settings but I think I will take a look at how this actually works and develop a wierder looking tree script,. I want real alien fealing stuff,. with 3 branches, i think.

Although these are quite cool already!

mouse to look around and RMB to get high,. . space to re-build the trees,. pauses! not much else to do yet.
Attachments
pocket_forest_007.zip
interactive demo,. not a game yet.
(48.96 KiB) Downloaded 623 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I like it :) .
I think you are on to something very cool here jph, it'll be interesting to see what you can make of it.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

dynamic L-system

Post by jph_wacheski »

i guess this is related but a different ting,.i was just playing around with the idea of a dynamic growth system,. so plants/animals/robots/etc. could grow,. this is just a quick little test,. looks cool,. but I think I want to try a group of objects in a similar way so collisions can work and bits can be broken off,. .
Attachments
L-growth_002.zip
.exe some moving plants,.
(34.24 KiB) Downloaded 614 times
iterationGAMES.com
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hey jph,

Make sure to use a Matrix stack so the rotation of parents can be taken into account easily as well ( right now only the last generation children are "active", but I imagine you'd want to take it a step further ).

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

They look almost alive, as some kind of underwater microscopic germ lifeform :)
Post Reply