Finishing SLIM implementation in Blender

Epic MegaGrants submission


Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing and motion tracking, video editing and 2D animation pipeline.

Yes, Blender is a powerful tool in many areas, unfortunately there are still a few domains where its functionality is lagging behind. One of such domains is UV tools. In particular Blender is lacking a decent UV unwrapping algorithm which could deal easily with more complex models. Also its current Minimize Stretch operator implementation doesn’t seem to work at all.

Unfortunately UV tools seem to have very low priority for the Blender development team. There haven’t been any major improvements introduced to this part of the software for ages.

That’s the main motivation behind this project – help Blender make a significant step towards state of the art UV tools!

Objectives

The general objective of this project is to finish implementation of the SLIM unwrapping algorithm, initially started by Aurel Gruber for Blender 2.79 (not merged with the release branch eventually). The detailed objectives are:

  • rebasing the original Aurel implementation to the current Blender codebase (version 2.9x) (ALREADY DONE – I can send you a link to a git branch)
  • working on the implementation so it correctly handles the following operators:
    • UV unwrap
    • minimize stretch
  • getting feedback from users regarding functionality and UI. Implementing improvements according to user suggestions and fixing reported bugs.
  • polishing the implementation so it is accepted by the Blender devs to be merged into the master branch.
  • maintaining the code AFTER the implementation becomes part of Blender (this one is very important and may be time consuming in the long run).

The main goal of this project is not creating a commercial product – it’s about adding a functionality to Blender which then will be available for everyone for free, forever – as guaranteed by the license under which Blender is released (GPL).

I contacted Aurel before this submission asking him if he doesn’t mind that I try to gather funding for finishing his original implementation. He is aware of my initiative and fully supports the idea. You can contact Aurel at aurel.gruber@gmail.com.

I also contacted Brecht Van Lommel, a developer responsible for maintaining UV tools in Blender, asking him whether he would like to have the SLIM algorithm finally implemented in Blender. I’ve also got a positive response from him. You can contact Brecht at brechtvanlommel@gmail.com.

About SLIM

SLIM is a state of the art UV unwrapping algorithm invented at the IGL institute of ETH Zurich. Thanks to its iterative nature, it is superior to all algorithms currently implemented in Blender in the following terms:

  • it can unwrap complex meshes with much less distortion (even with no seams applied).
  • the user gains control over the “unwrap quality” / “computing time” tradeoff. More iterations means less distorted UV map, but more time is required to compute it.
  • it can be used to effectively minimize stretch on meshes already unwrapped (Minimize Stretch operator).
Take a look at the pictures below to check the difference between algorithms when unwrapping a head mesh. Keep in mind that the mesh is being unwrapped without any seams, what makes the task really difficult.

Angle Based method (implemented in Blender)

First let’s take a look how the algorithms currently supported by Blender deal with unwrapping the mesh. The picture below shows a result from the Angle Based method. Note how UVs are stretched at the center and border (red color). Due to stretching the texture is unevenly laid on the mesh – compare big texture squares at the top of the head with small squares around the neck.

Conformal method (implemented in Blender)

Next picture shows a result of the second algorithm available in Blender: “Conformal”. As you can see it doesn’t do any better – there is a lot of stretching in the texture as well:

SLIM method (to be implemented in this proposal)

Now let’s check how SLIM will deal with this task. Remember that SLIM is an iterative algorithm – more iterations means better result, but also more time required to compute it. The next pictures show SLIM results after different number of iterations:

SLIM result after 5 iterations
SLIM result after 10 iterations
SLIM result after 50 iterations

As you can see just 5 SLIM iterations is enough to achieve a less stretched UV map than the maps generated by the Blender methods. After 10 iterations, we get a map with much less distortion (the texture is laid on the mesh much more evenly). What is more 10 iterations of the algorithm can be computed in a very short time (similar to the time required for methods already implemented in Blender). When we proceed to 50 iterations, the result doesn’t change significantly, what indicates that we can stop on that number. We got a very decently unwrapped UV map with no single seam.

For more details regarding SLIM watch an Aurel’s presentation regarding his original implementation for Blender 2.7 (not merged into the official codebase): https://www.youtube.com/watch?v=PLUoLQUK3-s.

About me

My name is Lukasz Czyz (aka glukoz). I am a C/C++ software developer from Poland with 10 year experience in programming (mostly 3D related). I worked for a few IT companies (including Intel Corp, where I was developing 3D drivers) and also for the gamedev industry.

In the Blender community I am known as a creator and lead programmer of the UVPackmaster project. UVPackmaster is a popular, C++-based, GPU-accelerated UV packing engine available as a plugin for Blender. Implementing such an advanced tool was possible not only thanks to my ritch programming experience, but also thanks to my deep knowledge of Blender internals and being passionate about Blender as a powerful 3D application.