Skip to content
Back to blog

Reviving MTree: A Procedural Tree Generator for Blender 5

MTree was the best Blender addon for procedural trees, but it stopped working after Blender 2.8. I forked it, fixed it for Blender 5, and added L-Systems and Weber-Penn crown shapes.

If you've searched for "Blender tree generator" or "procedural trees for UE5" recently, you've probably landed on tutorials pointing to MTree. It was the go-to addon for procedural tree generation. One problem: it hasn't been updated since Blender 2.8, and Blender 5 just came out.

I hit this wall in January when I decided to get back into game development. My first intro to programming (outside of school) was building games in GameMaker as a teenager. I wanted that creative outlet again, and environment art in Unreal Engine 5 seemed like a good starting point.

So I tried to install MTree. It didn't work. At all.

What Was Actually Broken

The addon threw errors immediately on startup. The node types wouldn't register, the UI panels were missing, and any tree generation attempt crashed with Python tracebacks referencing APIs that no longer exist.

I could have downgraded to an older Blender version. But I didn't want to maintain that workflow. This was intended to be something I dive into as a new years resolution and the more barriers that don't help me get anywhere, the more likely I am to give up. Plus, the original MTree repository hasn't had a commit since 2021. It wasn't coming back.

I forked it instead.

The First Few Weeks: Compatibility Fixes

Modular Tree started as a straight compatibility port. The goal was simple: make MTree work on Blender 5, then move on with my life.

This started as a long weekend project. Start on Friday when I get home, spend a casual amount of time on it and be done by Monday. Honestly, I thought this wasn't going to be the case but it was surprisingly simpler than I anticipated to get it working. You're free to check out the release notes but the basic gist was:

  • Add a blender manifest and remove bl-info
  • Update cmake required version
  • Update Python version
  • Fix deprecated APIs
  • Test, fix repeat

I also set up CI/CD to build releases for Windows, macOS, and Linux. I mistakenly bundled this as one zip, but later down the track, I was informed that I needed to separate the builds into individual zips for each platform.

Going Further: L-Systems and Crown Shapes

Once the add-on worked, I ended up doing a bit of deep dive into the existing C++ code. There were some interesting things there and one that caught my eye was the initial implementation of L-Tree. I had no idea what this was so I thought "Let's expose this to Blender and see what it does". It just broke things and collapsed all the nodes in on itself. Not ideal but I just kept it exposed so I could work on it at a later date.

L-System Generation

Once I'd tidied up generally devx stuff, I ended up reading about L-Systems. It was far less complicated then I thought it'd be.

L-Systems (Lindenmayer systems) are a formal grammar for modeling plant growth. You define rules like F → F[+F]F[-F]F and iterate them to produce branching structures. The same math that generates fractals, applied to botany.

The implementation uses apical dominance (main stems suppress side branches) and gravitropism (response to gravity). You can control iterations, split thresholds, and growth direction. It's not physically accurate, but it produces trees that look organic rather than random.

The implementation was simple but honestly, I don't think it works as well as the existing algorithms but it's still available as a "Growth Node"

Weber-Penn Crown Shapes

The Weber-Penn model (from the 1995 paper "Creation and Rendering of Realistic Trees") defines crown shapes using mathematical envelopes. A conical envelope makes pines. A spherical envelope makes oaks. There are 8 shapes total: cylindrical, conical, spherical, hemispherical, flame, inverse conical, plus variations.

This was the feature that made trees actually look like specific species rather than generic "tree shapes." I feel like this is one of the nicer additions I've made to the addon. The algorithms were interesting (and I hope I've implemented it correctly). It helps a lot when generating trees from reference.

Issues I Hit Along the Way

A few things that cost me time, in case you're working on Blender addons:

Node registration changed completely. Blender 4+ uses a different class registration system. The old bpy.utils.register_class() pattern still works, but node trees need explicit type annotations and the bl_idname format is stricter.

Geometry Nodes integration is tricky. I wanted to use Geometry Nodes for leaf distribution (it's more flexible than the old particle system). Getting the addon to create and link Geometry Node groups programmatically required digging through Blender's source code because the documentation is sparse.

Cross-platform builds are annoying. The addon has some optional C++ acceleration. Getting that to compile on Windows, macOS (both Intel and ARM), and Linux in a GitHub Actions workflow took longer than any single feature.

Current State

The addon works. You can generate trees with one click using presets (Oak, Pine, Willow) or build custom trees node-by-node. It exports to UE5 with Pivot Painter 2.0 support for wind animation.

Here's what's in the current release:

  • Blender 5.0+ compatibility (Windows, macOS, Linux)
  • Quick Generate with species presets
  • L-System growth with apical dominance
  • 8 Weber-Penn crown shapes
  • Geometry Nodes leaf distribution
  • Pivot Painter 2.0 export for UE5
  • All original MTree features preserved

It's still rough in places. The UI needs work, some parameter combinations produce weird results, and the documentation is basically just the README. But it generates trees, it's open source, and it runs on current Blender.

Why I'm Still Working on It

My day job is healthcare software. I've spent the last seven years building apps, working on AWS infrastructure and sitting in meetings. It's good work, but it's also deadline-driven. There's always a sprint, always a stakeholder, always a production bug.

Modular Tree has no deadlines. Nobody's asking for the L-System implementation. I can spend a weekend reading papers about phyllotaxis (the mathematical pattern of leaf arrangement) and call it productive.

It's also a break from web development patterns which is an area I always feel like I've been stuck to. I can apply my software engineering experience in a different way with different constraints and that's probably why I enjoy it so much.

What's Next

Once the add-on is approved on the Blender extensions store, I want to spend a bit of time just taking a bit of a deep dive into the code and explore some of the more interesting algorithms. I also want to explore other add-ons and identify what they are doing and see if I can implement some cool things. The main focus is just maintanance at this point.

If you're building environments in UE5 and want procedural trees that don't cost $50 per asset pack, check it out: github.com/Goodpie/modular_tree. Issues and PRs welcome.