Thinnizator - automatic thin instances

Hi guys!

EDIT: PG link updated:


This small script automatically creates thin instances of meshes located under a given node. It doesn’t care about the naming and tries to automatically find all “equal” meshes on the scene, creates a prefab mesh for the equal meshes, disposes the original meshes and creates the required amount of thin instances from the prefab mesh. The thin instances are positioned/rotated/scaled as the original meshes.

The nightmare

The model file I am working on (a part is used in this PG) is exported from an unnamed CAD software. The author must have been a joker, because he chose to name the chairs as Cubes, some of the tables are also Cubes, and some of the plants also. Than there are Planes, Spheres, or whatever. And some are instances, some not. And as a “cool” addition the meshes are super high poly (a simple chair thousands of vertices). I had an idea, whether I can tide up this mess automatically. At first because I didn’t want to mess with the Blender file and make changes in the master model and at second, because more model files are coming in the future from the same dude, so better be prepared!

The solution

So I got a model, with millions of vertices, randomly named meshes and high poly design. This is where thinnization may come handy.

The for the eye section

Here is an example with screenshots. Guys, please note, that the model is copyrighted and you are not allowed to download it by any means.

This is the GLB loaded without any tampering. Please note the numbers on the right side (92 FPS).

Below is the scene after I hit the button. It simply calls a method:

const root = scene.transformNodes.find(n => === "Building")
thInnIze(root, matchNodePrefixesPredicate)

Everything below the root will be thinnized. And the predicate just filters out which meshes should be or not be thinnized. You can leave it empty to thinnize every mesh below the root node.

There is a treshold for thinnizing set. There must be at least two equals meshes to thinnize.

const matchNodePrefixesPredicate = (node) => {
    if (node && {
        const matched = nodePrefixesToThinnize.findIndex(p => > -1
        return matched
    return false

Mind the numbers - 145 FPS - gain of 53 - not bad - it is much much more performant, but it is capped by the max refresh rate of my display

There is a possibility to visualize what meshes where picked as prefabs and where are the thin instances spawn positions (green - places where a regular mesh was replaced by a thin instance, red - prefabs):

And for the chaos lovers you can visualize the prefabs and/or spawn points by toggling on badges (badges are displayed only when spawn points and/or prefab positions are toggled on):

By clicking on the badge you get additional information about the prefab.

Your opinion matters

Let me guys know, whether you like the idea and I can make a library (a simple class) for this.

I need your HELP!

I wrote, that the thinnizator finds “equal” meshes, because for now two meshes are treated as equal when they have the same amount of vertices and are from the same material. This part needs to be enhanced and I will appreciate any input on how can I reliable compare two I would say not meshes, but geometries. Should I mess with the Geometry class or is there a pretty simple way?


More can be done by replacing the prefab meshes by a low poly version to gain even more FPS.

Please note, this is the first alpha version and yes, there are errors, known and visible and unknown :stuck_out_tongue:



This is really great!

1 Like

Faszinating problem to recognize equality of two meshes.

It seems not possible to compare two mesh vertex positions axactly if they were slightly rotated…

A possivle idea is to create NURBS first from the meshes and then try to compare the params of the splines. The meshes can even be combined to caculate a raw estimation of equality.

Nevertheless you need a “number” which is equal to any mesh independend how big or rotated they are.

Sounds or images for example are converted into histogramms which can be compared easly.

Thank you! I was thinking about something like counting the number of faces from different directions and the count must match, as well the number of vertices, etc. Should this work?

EDIT: just realized, that this will not work, if for example the rotation is applied into the geometry

EDIT 2: so I could test for equal number of total vertices, number of faces, than find the center of the mesh, find the most distant face on both, if the vertices relative positions match on both faces I can go further and test the sibling faces with the same technique. What do you think?

Getting the length of both the positions & indices to match is going to really get a high probability correct. Having the same number of vertices & faces for meshes that do not match is not very likely, especially in the same model.


Thanks! And wanted to say, I love your videos! :sunglasses:


Which videos? I’d like to enjoy them, too. :blush:

On YouTube. :sunglasses:

1 Like

I just found this one with palmer and babylon


Tough for my ears :joy:

I love where this thread is going !!!

1 Like

Guys, so terrible feeling, but I I thought that @JCPalmer is @PirateJC, lol! Nice introduction of myself. So to make things clear, I love PirateJC"s videos! Sorry for being dizzy :joy:


This made me suspicious, that we are both talking about someone else… :thinking:

1 Like

Pretty impressive! excellent job!

That could definitely deserves a page in our documentation!


Thank you! I will gladly contribute! I started to work on a mesh fingerprinting system to improve mesh comparison precision and I would like to share it as a part of the Thinnizator. So when it’s ready, we can roll the dices! :sunglasses: Bonne journée!

EDIT: However, feeling a bit nervous to guide other people when I am fighting with a “simple” rotation on a pivoted mesh around two axes and still couldn’t get it working right! :clown_face: I’ll keep trying and learning… :vulcan_salute:

EDIT2: Got it working! Everything is in the docs, just have to read carefully! :wink:


This is an exciting piece of work, congrats!

I wonder if you could use a performant hash library, compute the hash of the meshes to compare them?

1 Like

Thank you!
Actually I don’t expect to have so many meshes, that we would need a hash library. The heavy load gets done when hashing/fingerprinting the meshes and this is proprietary.


Amazing! Great Style!


here is the thInnIzator in full action in a commercial stuff.

I am very sorry guys, only video this time. The PG link with the source is at the top of this thread though. I had to remove the copyrighted model files from our public server after capturing the video, but the code is the same, just the model is a lot bigger.


Plus 50-60 FPS just by calling a single method.

Like @PirateJC use to say: How cool is this! :vulcan_salute:

Guys, thank you so much for BJS and for all your hard work to make ours a lot easier!




Awesome work @roland! Love seeing your progress develop!