   Tree Generation
  Greetings all,I'm currently working on a project that I intend to set in a forest environment.  I think that I have, for the most part, settled the level-of-detail handling issue, (the engine that I'm using - Panda - includes some level-of-detail handling features), but now find myself somewhat stuck on the matter of generating the trees with which to populate the environments.This was briefly covered in my previous thread, I believe, but I would appreciate more in-depth advice at this point.I would prefer to avoid repetition in my trees, although I'm beginning to fear that I might end up stuck with it. :/I've considered a few options:1) Procedural generation based on a "skeleton": A "stick-figure" tree shape is generated, and from that vertices are calculated and leaves generated.Pros: - May produce a large variety of trees, with little repetition.Cons: - Probably has the longest development time amongst the option here, I would guess. - Getting the texture maps to branches to fit nicely with their parents might be tricky. - Optimising the models (primarily, I think, via Panda's "flattening"* methods) might be an issue, if I attempt to do this at run-time, to create and destroy trees on the fly as the player moves about the forest.Note: It has been suggested to me that I do more or less the above, but on the GPU, in a shader.It was also suggested, as I recall, that I do something akin to a combination of this and the below, generating VBOs containing tree parts that are re-used.Does anyone have any input on any of this?2) Semi-procedural generation, using pre-defined tree parts. Various parts of trees - trunks, branches, etc. - are mixed-and-matched to create a variety of trees.Pros: - Simpler than the aboveCons: - Texture matching at branch bases is unlikely to look good, it seems to me. - Likely to lack internal variety (within a given tree, that is), I suspect.3) 3D ModellingPros: - Straight-forward. - Texturing should, I think, be easier to match up than in either of the above.Cons: - The number of individual tree templates would presumably be limited.(I may have missed some items in the pro- and con- sections above; I am tired tonight, I'm afraid.)What I'm asking for, then, is advice on this choice, including any further suggestions that anyone might have.Of course, if someone knows of a third-party tool that might help me - an actual tree generator especially - then please do let me know.  In this case the technology is a means to an end to me, with the game itself being my goal.  Buying a piece of technology, while not entirely out of the question, might be mildly problematic for me at the moment, especially as the exchange rate is not likely to be in my favour, I don't believe.* Flattening, I believe, seeks to reduce the number of batches sent to the graphics card, producing fewer, larger batches rather than many small ones.  It also, I think, applies transformation data.  The API reference for "flattenStrong".   
  A while back, I was interested in generating trees by fully procedural methods also.  I discovered Creation and Rendering of Realistic Trees which I am fairly certain is the basic algorithm used by SpeedTree.  This algorithm is not exactly trivial, so be prepared to do some work. I started to implement it a few years ago with some surprising success, but got distracted by other things before i finished it.The algorithm uses simple cylindrical sections to piece together trees, and thus has some bit of trouble generating smooth textures at branch points. Regardless, the trees it produces are very beautiful.  Another thought is to use the basic algorithm to generate a skeleton as you described above, and then use spline patches to generate smooth geometry and texture coordinates.  Such techniques are described in Modeling The Mighty Maple.  I hope you have some math skills, as the paper makes use of a bit of calculus.I hope those references are helpful. If you decide to go the fully procedural route, I would love to talk to you more to exchange ideas, maybe help out a bit, etc.   ;  Thank you very much indeed, samgzman, both for the links and for the offer of help. ^_^I think that I actually looked at Weber when I was researching level-of-detail, but didn't look too closely at the model-building side of things at the time."Modelling the Mighty Maple" looks very interesting (albeit, as you said, non-trivial).  I imagine that I have the mathematical ability to handle it, but it has been a while since university mathematics, so I might be rather rusty by now... ^^;(I do at least have my old calculus textbook available, thankfully.)Heh, I don't suppose that you know of a free implementation lying around somewhere that I might use? ^^;;   ;  The best I was able to ever find was a Java package called Arbaro. Doesn't look like that project is very active still :(.  I spent nearly an hour looking for my old code. Its probably on a CD somewhere in my endless pile, but it will be nearly impossible to find since its been a few years.   ;GameDev.net Topic that might be of interest.;Quote:Originally posted by samgzmanThe best I was able to ever find was a Java package called Arbaro. Doesn't look like that project is very active still :(.Nevertheless, it looks rather interesting - I think that I will probably look further into that, and perhaps attempt to contact the creator of that project.  Thank you for it! ^_^Quote:Originally posted by samgzmanI spent nearly an hour looking for my old code. Its probably on a CD somewhere in my endless pile, but it will be nearly impossible to find since its been a few years.I'm sorry to hear it, but thank you anyway - I appreciate the effort. ^_^Quote:Originally posted by KulSeran that might be of interest.That is indeed of interest to me, thank you. ^_^I think that I remember seeing this previously, but for some reason passing over it.  I suspect that I'll look further into this as well - thank you again. ^_^;  Have you looked into L-Systems yet? At the bottom, there is a whole book on the topic.   ;  Thank you, phresnel. ^_^I have encountered L-Systems before, and I imagine that if I were to go with full procedural generation I might well end up using either L-systems or something similar.  It's less the generation of the structure of the tree than the generation of the geometry that accompanies it, and making that geometry render efficiently, that concerns me. :/   