3d tree generator

Community Forums/Graphic Chat/3d tree generator

AdamStrange(Posted 2014) [#1]
I'm still working away with Rameses (3d editor) and needed some trees. But immediately ran into a problem...

Problem:
For any 3d plant/tree, apart from basic modification like rotation/scaling, it was the same model. and it becomes very simple to tell it's the same model.

Solution:
have some form of plant generator that uses some form of random life growth, whilst still keeping generated plants similar.

So i've been working on something and here's the results:

This is a tree model (the copies are there to show differences - but they are the exact same tree with no changes), but with growth parameters added.

For a plant, I decided that it could be constructed from up to 4 3d parts (models): Trunk, branch, leaf and flower.
Each part has a different way of operating, but they all fit together. and you can use as many or as few as you need.

In the above sample, the (sort of) conifer is made from the two parts:

This is the trunk


And here is a very simple leaf construct

You use a new Rameses dialog to control the parameters:

The upper parameters control length, width, etc. The middle bend
The lower middle parameters are only used for leafs, branches and flowers, and allow duplication, spread and the general shape
The bottom part shows the object list, and how the plant is made from other parts.

The first fader is 'Age', using this you can age a plant from it's smallest to it's largest version. These are calculated for each tree (very fast).

Using the previous conifer. here is the tree at different stages of age from youngest to oldest:





the thing to notice is how the leaf texture moves, grows and settles.

Each tree follows the same rules, but is different from any other tree, size, spread, even shape can be different (by adjusting the rand)

here are a couple of other shots:

some trunks

some leaf things

and some grass



Still early days, but let me know your thoughts?


feeble1(Posted 2014) [#2]
My thoughts are as follows:
Neat!


RemiD(Posted 2014) [#3]
I like the trunc of your pine tree, but the leaves look weird. Take a look at some photos or outside (depending where you live) you will see that the branches and leaves are not like that.

I like the grasses.

I have also done some tests to generate random trees with trunc, branches, leaves. It is amazing how it is easy and fast to generate a full tree/plant with a few lines of code but the same work in a modeling program can take hours.

What do you think of the use of temporary rigged skinned meshes with joints (bones) so that it is possible to deform branches ?


AdamStrange(Posted 2014) [#4]
Currently I don't have any support for bones and skinned meshes, but the branches do move.

Yep, the pine leaf mesh was just something I knocked up procedurally (very quickly) - using proper bitmaps would help there - lol.

I'm toying with the idea of feeding back information to the materials as well so that trees have slightly different colour settings and materials

It's definitely not a 'real' plant render, as if you want that there are better (expensive, unity, ue4 ways to go), but it's a start :)


Matty(Posted 2014) [#5]
I think it looks fine as long as the other graphics in the game you are writing are consistent with it.

The thing with trees and foliage is it is very easy to go overboard and push the graphics card very hard simply with too much detail and fill rate issues as well.


AdamStrange(Posted 2014) [#6]
it is very easy to go overboard and push the graphics card very hard simply with too much detail

Couldn't agree with you more.

I wanted to stay away from high levels of detail, etc. Which was why I created the editor in the first place - I wanted to have complete control over how many vertexes, triangles, etc. It's very easy to scale concepts up to high poly counts, but not the other way.


RemiD(Posted 2014) [#7]
I am not talking about the graphics style, i like the graphics style, i am talking about the shape of branches leaves, for a pine tree. It looks weird as it is. But of course maybe it is intented to be a weird pine tree. ;)


AdamStrange(Posted 2014) [#8]
Got you :)
The hard thing is coming up with a concept that remains simple and also caters for things I don't know about.

I'm currently trying to add a dynamic bend system (so that wind can be simulated), and then found out I need to define what I mean by bend, how it should be applied and how it can be done quickly.

Answer:
- Wind is a simple direction vector, plus a power/force
- each model needs a bend parameter per vertex
- calculate the x,y,z of the wind * power
- modify each vertex by the windPower * bend

The concept works (in my head), and the UI and internal structures now modified. I just need to actually see if it all works mow.... ! eeeek!!!


AdamStrange(Posted 2014) [#9]
Very quick update on the wind (should not have eaten those eggs)

It works, needed a little tweaking, but now each model can have a wind bend and also bend jitter (random wind flow) plus jitter speed applied.

So grass and vegetation would just have the bend
flags and cloth (got some nice animated gifs for these) would have jitter too.

The engine deals with it all internally once set in the model.

Why all the fuss?
Each model can have completely independent wind applied. soo.... if your game had some form of vertex cloud for wind, you could feed this directly to the models.
Not sure what I'm on about?
Think of it this way - you have a wind map, when you move you create wind in the direction you move, so run through some grass and the grass should follow your movements, or run part a table with a cloth, and the cloth should ripple as you run by?

That's the theory - bigger eek!


Rick Nasher(Posted 2014) [#10]
Sounds almost too good. Some example code to see how it works?