Generate realistic procedural trees?

B"H
In blender there is some addon that makes trees automatically base on parameters, and includes a trunk with several branches and sub branches etc. and leaves whose textures can be specified.

I want to do this in threejs, just generate tree geometries AND have them “blow in the wind:” etc. I cant find any examples to go on

Here is an example for constructing a tree, but most likely you should make your own code for a tree and add motion, by varying the angles of the branches:

3 Likes

I’ll throw my creaky old tree generator into the hat:

https://vectorslave.com/treezus/index.html

6 Likes

B"H
I saw that but couldnt find the source code for it. and as u mentioned not able to cause branches to sway in wind, and in reach time.

1 Like

I played around a bit and suddenly I was swallowed up by the “jungle”. :roll_eyes:

I see in the code that you used localStorage, but since reset is hidden inside the “jungle”, I can’t activate it.

Good thing you have several browsers running.
2024-05-13 17.51.06

1 Like

B"H
How how do we get branches to sway in the wind?

For that you would probably want to use a custom vertex shader and deform the vertices after they have been transformed to worldspace.
The amount of deformation would be controlled by the vertical position of the vertex in localspace, since there is 0 deformation at the stump, and maximum deformation at the top.

You could use onBeforeCompile to patch the tree shader to make this happen… by editing the vertex shader, and adding uniforms that describe the wind forces… (or possibly a noise texture that would be sampled by the world space position, and the animated wind direction)

B"H

Is there any example for this

B"H

No not that I am aware of.

1 Like

B"H

Lol nice B"H reference. are u jewish if i may ask?

and where can i find any kind of trees blowign in the wind, like fortnite, but infinitely better? theres got to be some code somewhere for it. are armatures necessary?