There are a lot of instances where you’ll be importing geometry or generating dense and complex geometry in TouchDesigner. A tricky problem artists run into regularly is that they end up with low frame rates in their project because the geometry being manipulated and rendered in real time is too dense. In this post, I’ll show you how you can quickly and easily decrease the complexity and density of geometry in TouchDesigner!
You have a bit more flexibility when working in pre-rendered environments because the complexity of your geometry will affect how long it takes to render and update the viewport, but it won’t fundamentally stop your project from being effective. When working in real-time, we not only are managing render qualities, but we also have to ensure that projects run a smooth and consistent framerate. A big part of our optimization pipeline is doing a pass over all geometry imported into a project and seeing if there are ways we can reduce their point/vertex counts and the number of polygons they had. There is usually a sweet spot we’re trying to get to where you still have an acceptable visual fidelity but with as few points/vertices/polygons as possible. So how do we achieve this quickly?
The Polyreduce SOP is a hidden gem in TouchDesigner. A lot of artist and developers shy away from exploring some of the SOPs that don’t see as much main stream attention as operators like Particle SOP. The Polyreduce SOP does a great job of quickly and easily reducing the amount of points, vertices, and polygons in a SOP that you connect to it. Let’s dive into an example.
Tea Pot Simplification
For this example I’m going to use a File In SOP and change the file it’s looking at to the tea pot model that ships with TouchDesigner’s example content:
The next thing I’ll do is create an Info CHOP so we can easily see the number of points and primitives in the geometry:
Now we can go ahead and create our Polyreduce SOP, connect the File In SOP to it, and then also create an Info CHOP we can use to monitor the resulting point/poly count:
Don’t worry if the default Polyreduce SOP has a higher number of primitives, that’s because we haven’t started working with it’s parameters! With our setup complete, let’s look at a few of the parameters I commonly use.
Tweaking the parameters
The first parameter I start working with on the Polyreduce SOP is the Keep %. I find this parameter is easy to use and does what I need without needing to worry too much about the other Method options the operator has. With the Keep %, as we reduce the value of it, it starts simplifying the geometry more and more aggressively. The way I use this is to start slowly moving it down until I see severe issues in the geometry. In the below example, I start to decrease the percentage until around 50%. We can see a few issues now with the simplified geometry, such as the handle being broken and the floor being completely deleted:
There’s an easy way we can fix these issues! On the Clean page of parameters, there are two extremely useful parameters: Stiffen Border and Stiffen Features. These two features add a bias to the computations happening in the background that help to preserve the borders of planes and the feature edges of your geometry. In simpler words, they help keep your geometry looking good while the math behind the scenes deletes extra points and geometry. Since we’ve reduced the Keep % already, I suggest slowly increasing the stiffen features until the missing parts of our geometry get fixed:
Great! We can see that slightly increasing those two stiffen parameters brings out floor back and fixes the handle and spout that were broken by the reduction process. You can rinse and repeat this process of slowly reducing the Keep % and increasing the stiffen parameters until your geometry becomes too low-poly to use.
I know it only feels like we’ve moved a few parameters around a little bit, but what are the results? Well if we compare the point counts and the primitive counts between our original and reduced, we can see a huge difference:
Our original had over 1700 points and our reduced version has less than half of that at close to 800. The primitive numbers are close to being the same because of those stiffen features we increased, but already we could continue to reduce the Keep % and start to reduce those even more. The best part? Even with the simpler geometry, we have almost the same visual result! That’s the simple and easy to use power of the Polyreduce SOP. One thing to note, the process is quite slow so it is something you absolutely don’t want to cook every frame and update. Usually you’ll put this at the beginning of your processing chain where it won’t need to update any further for the run of the project.
Get Our 7 Core TouchDesigner Templates, FREE
We’re making our 7 core project file templates available – for free.
These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.
They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.
With all that said, there is another option that is worth thinking about when it comes to simplifying geometry: Blender. If you haven’t used Blender recently, it’s improved itself a ton thanks to the work of the Blender community and developers. The benefit of working in something like Blender is that you’ll often find more control over the simplification process and you’ll find that the process goes by faster in general. The function you’ll want to use in Blender is called Decimate and here’s a quick link to the documentation on how Decimate works:
Whether you’re using TouchDesigner or Blender for your simplification process, it’s always something to be aware of in your TouchDesigner project. If you’re experiencing performance issues while working with 3D assets, then a simplification process of your geometry might be a good first step. Enjoy!