Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

modular_tree

> 编程语言
Open source

Mtree Mtree (previously Modular Tree) is a library for making 3d trees. It comes as an addon for blender but the c++ library can be used se…

1.3K stars0 likes2 views
WebsiteGitHub

About

Mtree Mtree (previously Modular Tree) is a library for making 3d trees. It comes as an addon for blender but the c++ library can be used se…

Mtree

Mtree (previously Modular Tree) is a library for making 3d trees. It comes as an addon for blender but the c++ library can be used separately.

Table of contents

  • Mtree
    • Table of contents
    • Installation (blender addon)
    • Development
      • Dependencies
      • Installation
      • Usage
    • License

Installation (blender addon)

Go to the latest release. Under Assets, select the version corresponding to your os.
Follow the blender documentation to install the downloaded addon.

Development

Dependencies

  • Cmake
  • Blender 2.93 or higher (if you want to to develop the blender addon)

Installation

  1. Clone the repository reccursively git clone --recursive https://github.com/MaximeHerpin/modular_tree
  2. Execute the build_mtree bash script corresponding to your platform.
  3. If all went well, a cmake project has been generated under mtree/build.
  4. You can bundle the blender addon by calling the addon bundling script.

Usage

A Tree is generated by executing a succession of TreeFunction. When being executed, a TreeFunction modifies the structure of the tree, and then calls children functions recursively.
For example, a basic tree has a trunk and branches on the trunk. Such a tree can be generated as such:

cpp
auto trunk = std::make_shared();
auto branches = std::make_shared();
trunk->add_child(branches); // branches are added on top of the trunk
Tree tree(trunk);
tree.execute_functions(); // The tree structure is generated
ManifoldMesher mesher; // A mesher is responsible of converting a tree into a 3d mesh. The ManifoldMesher ensures a smooth topology
mesher.radial_resolution = 32;
Mesh tree_mesh = mesher.mesh_tree(tree); // the resulting mesh contains the geometry of the tree in the form of vertices and triangles

A second layer of branches can be grown on top of the branches by adding another branch function as a child of the first branch function:

cpp
auto branches_primary = std::make_shared();
auto branches_secondary = std::make_shared();
branches_primary.add_child(branches_secondary); // the secondray branches will be distributed on top of the primary branches

Some trees have healthy branches as well as a layer of thin dead branches along the trunk. This can be achieved by adding to branch functions with different parameters on the trunk:

cpp
auto trunk = std::make_shared();
auto branches_healthy = std::make_shared();
auto branches_dead = std::make_shared();
branches_dead.length = RandomProperty{.1f,1f}; // dead branches will have a length between 10cm and 1m.
branches_dead.start_radius = ConstantProperty{.05f}; // dead branches will have a radius equal to 5% of the parent nodes

trunk->add_child(branches_healthy); // both sets of branches are grown on top of the trunk
trunk->add_child(branches_dead);
Tree tree(trunk);

License

Blender being under the GPL license, the blender addon (all files under python_classes as well as __init__.py) is under the GPLv3 license.
The Mtree library is under the MIT license.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言