Tropism: the procedural Modo plugin for growing trees and…lightning bolts

How the tool works and why the creator made it.

#vfxtoolsweek is brought to you by cineSync.
#vfxtoolsweek is brought to you by cineSync.

In November 2017, Sweden-based software developer Fredrik Widman posted to the Foundry forum a plugin he had made for Modo called Tropism. It enabled users to procedurally build trees and similar structures (including lightning bolts) by taking advantage of the MeshOp system in Modo. Fredrik based the plugin on a procedural tree algorithm paper by Adam Runions.

A few years have passed since that original posting, but in early June Widman announced that Tropism V1.0 for Modo 13 has now been released. For befores & afters, he outlines all about how Tropism works, how he developed it, and what users can do with the tool.

About Fredrik: I live close to Gothenburg in Sweden. I’ve been working with software development for 20+ years in lots of different technical areas. Now I’m currently working in the automotive industry in Sweden as an Cyber Security Specialist.

In other words CG is actually not my main profession. However, I do run a business (a small studio) DigitalExpressions in my spare time where I work with industrial visualizations and music production for a number of customers. Anything related to 3D/CG and audio/music has been part of my interest and passion since a young age, specifically procedural 3D stuff.

Growing twigs in Tropism.

First, getting into Modo: About three years ago I started glancing at modo 901 – I wasn’t happy with the development of 3ds Max and the new license terms – and I decided to download a trial and join the Modo community. A couple of weeks later I bought my first Modo license and started the journey of migrating from 3ds Max to Modo.

The main reason for me choosing Modo amongst all other DCCs was its versatility and of course state of the art modeling workflow. And secondly there is something magical about the community and its members. You won’t find a more helpful and friendly community in this business and I really wish more 3D artists would take a look at Modo and try it out.

A spiral tree.

The origins of Tropism: When I bought Modo (v.9xx) It was lacking a procedural modeling workflow. But in version 10 Foundry added procedural modeling tools. Modo felt very intuitive and sparked my inspiration to a level where I wanted to try out something new besides the industrial-viz stuff. During this period, I was looking at some CGI videos and I saw an extremely beautiful wild cherry blossom tree that was 100% CGI. That was when I knew what I wanted to try to do.

Proceduralism, proceduralism, proceduralism: I started by studying the SDK and figured out that the release of MeshOps in Modo would fit perfectly for the purpose. I wanted this to be 100% procedural. Then I did some research on procedural tree algorithms and I found the great Space Colonization (SPC) algorithm paper by Adam Runions. I made a prototype using the Python TD SDK. It came out with nice results and helped me get some insight to what I could do with the algorithm. Once I felt confident with it I turned to the C/C++ SDK to see what kind of performance I could get to and that kind of convinced me to continue working on it. I was surprised how fast I could get to something showing up in the Modo viewport. The Tropism embryo was born!

Painting vines.

The algorithm: Looking back at the development, the SPC-algorithm really is the core and solid foundation in Tropism. I have added many things to it but all rests on the foundation of the algorithm. When I realized that the algorithms dependency to attractor points fits extremely well in a virtual world where all geometry is made up of points, I got flooded with ideas. I had times where getting to sleep at the evenings became a problem since my inspiration was on fire. I had to start taking notes not to forget all ideas I had.

How Tropism works: First of all, you need some basic knowledge of the MeshOp system in Modo to understand how to work with Tropism. The principles are that you start by creating a point cloud ‘attractor points’ using, for instance, the Tropism PointScatter Meshop or a particle system in Modo.

The vines on the torus.

The shape of this point cloud system will define the boundaries of the growth. Points can be scattered on surfaces (for mesh climbing), inside mesh volumes (for growth in volumes) or along curves. Even mesh vertices can be used as attractor points.

On top of that you add the SPC-operator MeshOp which uses the attractor points to simulate growth. You can look at the points as magnets that attract a root to grow curves in different directions. The nice thing is that the SPC-algorithm produces branching out of the box. There are three main parameters (Influence Radius, Step Length, Kill Distance) that defines what the final result will look like and I suggest watching the video below if you are interested in knowing how it works. It gives you a very basic introduction to the algorithm and the way I have implemented it to get it performant.

The hardest thing about making Tropism: I spent many weeks of time profiling and optimizing my code to the extent where you today can paint Vines/Veins in real-time. It’s up to 50 times faster than my first C++ version and much much more resilient to performance degradation when complexity increases. I think that was the most technical challenging part. Other challenges has been getting the algorithm to be resilient to ‘hangs’ after I added gravity (branch bending and growth resistance) and other growth shaping algorithms.

The computation loop in the SPC-algorithm ends when all points have been killed off or consumed by the kill distance radius. Gravity counteracts exactly that from happening. The thing I pondered the most about was how to design the twig and leaf system which is now implemented in the TwigOperator. I tried many approaches before I got to a workflow where you can iterate your way towards the right look and feel and really utilize the power of Modo’s MeshOp stack and Replicator system. One important goal was to make the plugin to feel like native Modo functionality.

Lightning bolt made with Tropism.

The road ahead: I want to get more feedback from the users to improve Tropism in different areas. One specific area is for gaming content where I aim to improve the polygon optimization and leaf/billboard controls. I’m also prototyping for a wind system, branch spreading controls and post gravity branch bending controls. Being able to provide preset settings for different use cases such as tree types is really important and something I want to address very soon.

Check out more new VFX tools in our #vfxtoolsweek series, including the Eddy NUKE plugin and how an artist is using AE’s Content-Aware fill feature.

Get exclusive content, join the befores & afters Patreon community