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.

Author
Message
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Sep 2011 22:58 Edited at: 1st Sep 2011 23:01
I put Render because it means the same as Generate, but it fits on a button better. Render just means Generate a tree. Then you can save it as Dbo or X. It's just easier than actually building the tree yourself. But I will probably still edit the tree in ZBrush at the end.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 01:40
Got the height working now...



Mugen Wizardry
User Banned
Posted: 2nd Sep 2011 01:56
Is this open source? That would be SO BAD :-X! =D

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 02:00
It's for my ant game.

Mugen Wizardry
User Banned
Posted: 2nd Sep 2011 02:27
That doesn't answer my question. Lol

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 02:50
When I asked if anyone wanted to make me a Tree Generator, everyone said "Nobody will make it for you, you will have to make it yourself." So I had to stop working on my ant game, and make this. Which has put me behind schedule. So I decided that to make it worthwhile I should at least sell a few trees. So you will be able to buy some amazing, real trees for about £5. That makes it worth my while.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd Sep 2011 02:54
Have you come up with solving the 'Level Of Detail' yet, especially if you're placing a lot of trees in a scene?

Warning! May contain Nuts!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 03:00 Edited at: 2nd Sep 2011 03:01
Quote: "Have you come up with solving the 'Level Of Detail' yet, especially if you're placing a lot of trees in a scene?"


Yeah, I can make different levels of detail. I have that part working. Just haven't got round to the meshes yet. I can't actually put meshes on until I have a complete green tree.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 05:59
Quote: "When I asked if anyone wanted to make me a Tree Generator, everyone said "Nobody will make it for you, you will have to make it yourself." So I had to stop working on my ant game, and make this. Which has put me behind schedule. So I decided that to make it worthwhile I should at least sell a few trees. So you will be able to buy some amazing, real trees for about £5. That makes it worth my while."


I practically helped you make it. So don't feel alone in this.

"Son, I crap bigger then you !"
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 10:47 Edited at: 2nd Sep 2011 10:51
You helped me with the backdop, that's not part of the tree maker though, it already had a backdrop. Chafari helped me with the tree maker. It was good of you to help with the backdrop, but it's only temporary. I want to put a waterfall in there soon.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 12:06 Edited at: 2nd Sep 2011 12:07
I found a way to manage the mesh with triangles, that we can add more details than a plain mesh, but as you know, I'm testing the brightness of some parts of the mesh. I hope to solve that soon.

Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 12:12 Edited at: 2nd Sep 2011 12:15
That's brill! Are the triangles welded? When you work in a modeller package you have to weld the points together, I have no idea how DBPro fits separate triangles together. I thought you had triangles in the first example. What were you using before?

I'm just making a waterfall at the moment.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 12:34 Edited at: 2nd Sep 2011 12:39
In the first example,I use a mesh to change shape and adapt to each portion of the trunk of the tree. What I'm trying now, is to do the same, but with separate triangles to have a little more control to the object. The most difficult in this method was calculate the piece of image that correspond to each triangle, but that is solved


Edited. I have to say, that the first method, was with vertex data, and we can change the shape every time we want, but with triangles, although having more control in creation mode, we'll have less control once it's finished if we try to change back.


Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 12:39 Edited at: 2nd Sep 2011 14:32
Ah good.

EDIT: Oh I missed out Max P from my thanks as well. Thanks Max P! And Chafari, And anyone else who I might have missed.

Still working on the Waterfall, and then somehow I need to blend a matrix into it.

@Chafari well it is important for the branches to smooth properly. It is also important for the light to work. So eventually I will get round to having a look at it. Best if we both work on different parts at the moment. Then I will give you some trees to sell, or use.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 14:41 Edited at: 2nd Sep 2011 14:45
Here is the waterfall I am working on. I can use it as a backdrop, and then I can put it in my ant game, so it has two uses.



chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 16:02
Quote: "@Chafari well it is important for the branches to smooth properly. It is also important for the light to work. So eventually I will get round to having a look at it. Best if we both work on different parts at the moment. Then I will give you some trees to sell, or use."


I'm retired and I do it just for fun .I can help you somehow .

Quote: "I have no idea how DBPro fits separate triangles together."


You have to make point of reference(or not) in oder to make triangles automatically.


Here's a timelapse code that shows you little by little how to join triangles.



Finally we can texture them all as a single object . .I hope that can help.


Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 16:31
Very interesting! I've made a mesh which will hopefully merge with the waterfall...




chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 18:11 Edited at: 2nd Sep 2011 18:11
Nice picture !!. what programm do you use to create your mesh ?

Cheers.

I'm not a grumpy grandpa
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd Sep 2011 18:19
I'm actually about to work on using Image Kit to create a terrain texture. When it's done I'll pass you over the code. I will be prototyping it in DBPro before I code it in C++.

The idea, generate a random terrain, smooth it, and using the heights of the vertices, set that areas texture. I've been watching this about the trees because I'm after creating random fauna over the terrain area too. I was originally thinking about just using billboard trees.

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 18:34
@ WLGfx Thats exactly what I am looking for. I would love to see your code. This way I do not have to have textures set to go with my program. I want it all generated.

"Son, I crap bigger then you !"
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd Sep 2011 18:56
Depending on the planet, then the terrain textures will be generated to suit. I'm currently thinking about adding water, lava and possibly green gloop kind of things to it. I'll be working on most of the code over this weekend because it's going to be a major part of my overall project. (Game)... I'll let you know what I come up with...

Warning! May contain Nuts!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 19:31 Edited at: 2nd Sep 2011 19:37
I used a Green Gandalf shader demo to make my mesh. I think it's called terrain3. I've put the mesh in my program now, but not the waterfall yet...



paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 2nd Sep 2011 19:38
WLGfx & JackDawson
Some old code of mine that`s lying around on here,no media landscape generation and texturing.
http://forum.thegamecreators.com/?m=forum_view&t=147041&b=1
Pincho Paxton,keep up the good work on the trees,looking forward to seeing the end results.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 2nd Sep 2011 19:56
Thanks Paul5147, I'll have a look over that tomorrow when I get back. All my ideas are on paper with tons of pseudo code. I just need to put some time in to coding it now.

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 20:32 Edited at: 2nd Sep 2011 20:53
@ paul5147, Thank you man. Works too. I just had to take out ez_rotate stuff and then set ambient to 100 for it to show up. The light position was too low as well. But once I set all that up it came right up. slow and glitchy, but it's a great start.

"Son, I crap bigger then you !"
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 23:22
Added a skysphere. I'll work on the random next, make it more like a tree.



Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Sep 2011 02:37 Edited at: 3rd Sep 2011 02:45
I've put the waterfall in now...



This sort of background will help me to tell if the tree looks realistic. It will have to look quite good to fit in the scene.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Sep 2011 05:17
Blended the Waterfall into the mesh a bit more...



chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Sep 2011 12:43
It looks better now . Will you put water flowing or just a texture?

Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Sep 2011 13:54
I'll probably put flowing water when I've finished the tree.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Sep 2011 23:30
I've got the random generator working a bit better now. It's starting to look like a tree at last...



chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Sep 2011 20:09
Have you generated that randomly? It looks better and better. Are you still working in a mesh system or will you use a 3D program?
Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Sep 2011 20:13 Edited at: 9th Sep 2011 20:18
It will be a self building mesh at the end. I have re-written the tree routine from scratch, I have more control over it now. That example above just wasn't random enough. It's extremely random now. But I haven't got it back to tree shaped yet...





paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 9th Sep 2011 22:41 Edited at: 9th Sep 2011 22:55
Hi Pincho,this code is as far as i got with my random tree generator a while back,it actually started as a lightning generator,but i thought that upside down it would look like a tree branch system,if any of it is any good for your project,feel free to use it in anyway you like.It does use matrix1 plugin but only for the ground i think.So its easy to get rid of if you don't have it.

Mugen Wizardry
User Banned
Posted: 9th Sep 2011 22:44
EXCELLENT Tree Randomizer! I seriously think you should put this in the Code Snippets archive! You TOTALLY deserve it!

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Sep 2011 22:45 Edited at: 9th Sep 2011 22:52
Ok looks good thanks! Might still have to carry on with my way though because I can't understand it lol!

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 10th Sep 2011 03:48
@paul5147 Nice one, Good job. I'll take a look to your code

Cheers.

I'm not a grumpy grandpa
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 10th Sep 2011 04:40
amazing work guys, I havn't had the net for a couple of weeks now, and coming back and seeing how this has progressed in such little time is really something.

I see a bright future for this project.

I'm watching with interest.
kezzla

Sometimes I like to use words out of contents
paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 10th Sep 2011 10:59 Edited at: 10th Sep 2011 12:37
@Pincho
Its a fairly simple algorythm realy when you brake it down.

Make the first branch(trunk),its made of the max number of sections and its size decreases as it nears the end
loop through the remaing number of branches needed
Pick a random branch from the ones previously made Pick a random section along its length to start from
if the random branch is the trunk then use a minimum section to start with so you get a good trunk at the bottom
Make the branch from the position of the chosen section to a maximum length of the branch chosen minus the start position section
repeat the loop

Each section is made of an object with limbs aranged around a central point in a circle and scaled depending on the size of the section needed
They are positioned at the previous sections position and rotated to match,then rotated a random amount to get the bend on the branches
and finaly moved by the section distance.They then become the starting point for the next section of the branch

Making the mesh is simply a job of looping through all the limb positions in each of the branch sections and building triangles in a memblock mesh
Each of the branch meshes is added to the tree object,a dummy cube at its origin as a series of limbs,so the whole tree becomes in effect one object that can be re-positioned anywhere
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Sep 2011 13:39 Edited at: 10th Sep 2011 13:46
Maybe if I could just see where the branches are made, but I just can't read it. Certain things about programming I can't read, like Types for example, I can't read those, I have to use the old Dim method. I can't read Blitz Basic at all. I'm a graphic designer who can just about manage to program. What I want the branches to do is go off in straight lines for a short time before bending at random points. Then at the end of each branch I am going to position a sphere for where the leaves attach, so that the leaves are also connected properly to the tree. I have an idea how to make the leaves realistic, and still plains.

paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 10th Sep 2011 14:21
Hi Pincho
The best bit about types is that they are just like having arrays with more meaningful names so,
dim objects(10,3) could be like having an array of 10 objects and the 3 positions x,y,z
so,
objects(1,1) would be object 1 position x
objects(1,2) would be object 1 position y
objects(1,3) would be object 1 position z

this is fine and works great as long as you can keep track of what each part of the array is.For positions it only needs 1-3 but say you want to add rotation, color, visibility ect that list of numbers can soon rise.You could use constants for this but types make it easy.
so
Type object_data
posx as float
posy as float
posz as float
Endtype

This sets up the type,gives it a name and sets the elements data type

Dim objects(10) as object_data

This sets up an array as the type you have described
So
objects(1).posx would be object 1 position x
objects(1).posy would be object 1 position y
objects(1).posz would be object 1 position z

If you need to add more things to the array data you only have to add them to the type list

Type object_data
posx as float
posy as float
posz as float
color_red as integer
color_green as integer
color_blue as integer
Endtype

So you can start off with the basic type elements and grow it as the program becomes more complex.

Made some changes to code to reflect your sugestions

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Sep 2011 14:56
Wow! That's very close. Maybe you could finish the tree for me to save me figuring it out. It just needs straighter lines, and more forks to smaller twigs, so that you get more spread out at the top. the last section just needs to dip up, or down. The trunk I was going to make from more than 1 cylinder. Up to 6 overlapped cylinders to make a lumpy looking trunk.

paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 10th Sep 2011 15:50 Edited at: 10th Sep 2011 16:32
Ok Pincho,here you go my version of a finished tree

I`ll post the code if you really want it,its up to you.But you would probably be better off finishing off your own method and it would teach you more.
If You can get the branch part working the leaves are actually very simple and an easy cheat that im sure i`ve all ready posted else where on the forums.


Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Sep 2011 15:59 Edited at: 10th Sep 2011 16:01
Yeah, I can't read it, I have spent about half hour trying, and can't even find where the branches are made. I can see trunk -90, and that's all. Then I see Branch_Data, and no data. It is too confusing for me.

paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 10th Sep 2011 16:35
Heres the code for you Pincho,hope it comes in handy,be aware that the leaves are not part of the branch object,give me a few hours and ill add them in as another limb so you can position the whole tree as one object.
Mugen Wizardry
User Banned
Posted: 10th Sep 2011 17:17 Edited at: 10th Sep 2011 17:20
@paul, this is AWESOME! PLEASE do! =D And if you could make the tree sway to & fro and the leaves sway to & fro like a real tree, that would be AWESOME! =D

EDIT: Also, Paul, small problem at the bottom of the tree though, paul.. It generates the leaves at the bottom of the tree too. I think that should really be an on/off feature.

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 10th Sep 2011 17:33 Edited at: 10th Sep 2011 17:34
@ Paul5147 Dude !! Where did you come from. I love your style of coding. You generate the textures of both the leaves AND the trunk and then you generate the tree. AND its FAST.

I want your brain man. I mean this is VERY impressive stuff. I agree with Mugen and this should be put into the Code Snippets section of this forum.

And the fact that I can hit space bar and it generates ANOTHER tree ON THE FLY !?!?!?! Seriously bro...

As the words of the great movie "Wayne's World" -- "I'm not worthy.. i'm not worthy..." -- http://www.imdb.com/title/tt0105793/

Aces man.. just aces. Cheers

"Life is like a box of chocolates.. eat it before it melts."
Mugen Wizardry
User Banned
Posted: 10th Sep 2011 17:48
Amen to that, @JackDawson! =D

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 10th Sep 2011 18:01
Thanks
As for the leaves at the bottom,well natures just strange like that,well the rnd function is,sometimes it generates a small branch that gets stuck inside another so the leaves get generated at the end of it just like the rest.
Its an easy fix,this was just a lash up of various other functions i had lying around.
If I get i chance i`ll stick it in the gui code i have to give you the changeabilty on the fly as well before it renders the tree.
If any body finds this usefull just stick a credit on the end of your work for me.
And once again,thanks for the praise,it makes all the help i`ve had off others on these forums feel worth while
Mugen Wizardry
User Banned
Posted: 10th Sep 2011 18:07
PLEASE do!

As @Jack says, "I'm not worthy!" =D

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !

Login to post a reply

Server time is: 2026-07-10 00:06:11
Your offset time is: 2026-07-10 00:06:11