Fractal Tree
Moderator: Moderators
Fractal Tree
Well, we needed this for several purposes, and it was really fun for me to create the first ever Recursive Mesh in ZGE
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)
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 (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=-
-=Hugo Rossi=-
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
free of context,. .
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
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
Of course, this is more a proof-of-concept rather then something I'm really gonna use 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=-
-=Hugo Rossi=-
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
more info.s,.
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!
cheers!
- Attachments
-
- PocketForest_001.zip
- VERY rought first hack,. but fun!
- (40.93 KiB) Downloaded 625 times
iterationGAMES.com
uhm.... Name of the site?
BTW: I already have some ideas of how to use recursion to his real potential, will experiment in the next future.
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=-
-=Hugo Rossi=-
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
pocket forest 007
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.
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
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
dynamic L-system
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