# Fast Simulation of Realistic Trees

This topic is 2605 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello Everyone,

I am currently trying to implement a realistic dynamic vegetation system. I came across this awesome white paper found here http://freeelectron.org/xTree/ in pdf form. The paper is somewhat lengthy so I wont go into the details but the issue I am having problems with is calculating a node's final world position from it's relative angles in the respective XY and YZ planes. The article explains the process in depth and I am fluent with matrix and quaternion mathematics however their mapping from the separate 1D (angle wise) spaces to a single rotation (quaternion) is not working for me. I understand the axis-angle idea and the continuity behind but here is where I am seeing issues as well. Consider any node that resides in the XZ plane with a parent node fixed at the origin. If I project the vector (childPos-parentPos) onto the respective XY and YZ planes I would get an angle of 90 degrees (remember we are measuring from the Y axis as stated in the paper). There are many points in the plane that would have projections of 90 degrees in both planes unfortunately that always maps to a single rotation, where the angle = sqrt(90 *90 + 90 *90) and the axis = Norm(90, 0, -90). So where am I going wrong? I appreciate anyone taking the time to help with this! Thanks - Richard

##### Share on other sites
You can use position based midpoint simulation with fixed timestep and apply the positions directly in a geometry shader.
Position based physics can be done on the GPU using pixel shaders and dynamic textures.
By having an invisible edge for each connected pair of visible edges, you will get stiffness from the triangle.
Every edge will try to enforce a constant distance between it's nodes by measuring the real distance, comparing it to the wanted distance and applying forces.

##### Share on other sites
when you figure out how to bond branches you just apply to second model the difference between branches positions and you have force

##### Share on other sites
Thanks for the responses everyone though they were not quite what I was looking for. It turns out the mathematics were correct but I was getting some numeric imprecision. The key is the dampening and stiffness factors. The simulation becomes unstable when dampening is uniform across a branch. Decreasing the dampening a tiny amount over each successive node fixed the problems I was having. The idea of moving the simulation to the gpu is an interesting idea but the proposed method was not ideal for this type of simulation, rotational based springs are still much faster and model the physical characteristics of branches/trees much better than any position based method

1. 1
2. 2
Rutin
20
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633763
• Total Posts
3013728
×