First Prototype

I decided to use Unity engine, because it’s the game engine I’m the most comfortable working with. First I started to work on a plant system. I want the player to be able to plant plants and watch them grow in fast motion.

Mesh generation

To create plants, I decided to generate the plant meshes procedurally in order to generate plants based on the surroundings.

The plants are constructed with multiple cylinders with varying width and position.

The meshes are constructed from triangles

I then wrote some code to procedurally generate this mesh, starting with a single segment.

A cylindrical mesh composed of only the two ends
The final result for a single plant segment

Animation & Noise

I wanted to make the plant grow fast in front of the player. To do this, animating the meshes was the next step. One essential component is also noise, to make the plant diverse and procedural. The noise I used is a 3D Perlin noise.

  • Radial noise (for the variation in the with of the trunk)
  • Noise influence across the length of the stem
  • Noise in the growth animation before reaching the final girth

These noises are controlled across the length of the stem and also across time.

The way I constructed the segments permitted me to easily animate the width of the segment with some noise.

An animated version of a single trunk segment

The next step was putting these cylinders back to back to create growing stems. I tried to make all the parameters accessible to have a maximum of control on the way meshes are created. Only my imagination is the limit!

A growing stem
A really long and blocky plant (more like an icycle)

Collision

I wanted to make plants grow in the environnement and be completely procedural so the next step was making the plants collide with the surroundings.

I used Unity raycasts to calculate collision all at once when the mesh is created. After a lot of trial and error, I finally managed to make this work!

A really long mesh trapped in a confined space

I then experiment with very thin, spaghetti-like plants, that would look like cables roaming through the white default sandbox.

Gravitation influence

Another really important component is the influence of gravity along the plant. This value can be controlled along the stem, to have a plant go upwards (for trees for example), or be close to the ground, like vines or roots.

plants going upwards as they grow
Plants with really heavy ends, so going downwards when reaching a certain height
A plant going straight up and then crawling on the floor

Final results

Combining all these elements, we can get visuals like this:

Procedural mesh generation with collision handling and animated growth