From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Documentation

Google Summer of Code 2011

Automatic Seam Creation for UV unwrapping

Avocado Branch


Automatic seam creation for UV unwrapping

Objective

This project is mainly about creating seams automatically for UV unwrapping. To do this, we have to encode the semantic information of a mesh in a mathematical form and analysis them to find the result. Initial time and space optimization are done. Still some more optimizations can be done later. Detecting symmetry in seams to minimize texture requirement is also an aspect of the project.

Project Info

The project is done on Bmesh branch of Blender. It is choosen, because Bmesh representation of mesh gives certain benefits to implement the seam generation algorithm. Elubie is mentoring my project. This is original project proposal in detail.

Automatic seam generation for hand model.

The code documentation can be found here. In our project we need to use the ARPACK library for efficient eigen value calculation. One interesting point is that, the library is basically written in fortran, to make it usable to Blender, we need to covert the code from fortran to C using some code conversion tool.

Progress

At first phase, the rough implementation of the whole seam creation algorithm was done using Eigen3 library. This was very much inefficient and was not able to work with large meshes. Next, we included the ARPACK for calculating eigen values and did some optimization to make it work faster and capable for handling large meshes. The present implementation is about 40 times faster than the previous one.

We wanted to make seam creation process automatic. So, after the implementation of the seam marking algorithm, we need to integrate the seam unwrapping functionality with the operator so that the end users can get a one click solution for generating seams.

During the seam creation process we tried to handled as many special cases as possible. Like - mesh having separate connected components, mesh having holes and so on. After this is done, some of the users requested to integrate the Island margin functionality of the Smart UV Project with this operator. This is done to.

Some control parameters are added to customize the initial seam creation process for the user. Weekly progress reports of the project are listed in this page. This is the tentative Schedule for the remaining tasks.

Generate Seam

Mode: Edit Mode (Mesh)

Menu: Mesh Tools → UV Mapping → Generate Seam

Autoseam operator selection.


Description

This operator will generate a good number of initial seams automatically. This will work in edit mode for a selected mesh. The generated seams will contain semantic information of the mesh. This is similar to the case of seams marked manually by humans.

Autoseam operator various options.


Options

  • Recursion depth:
This is an integer type parameter. It presents how much the algorithm should split mesh to search for valid seams. Setting a small value(e.g. 1-2) may generate less seam than necessary. And selecting value more than 6 may generate more seams than necessary. Moreover, incresing the recursion depth parameter also increases the computation time a lot.
  • Stretch Type:
Autoseam operator various options.
This is also a stopping cretirion of the algorithm. Suppose we increased recursion depth to a necessary limit by mistake. At the deeper depth it will generate the seams that are not realistic. Stretch calculation prevents this issue. When it finds the strecth of the total unwrap is increasing, it stops the seam calculation. User can choose two strech calculation options as the stopping criterion of the seam generation.
  • Calculate Combinatorial:
This is a boolean variable. In the user interface it is by default unchecked. It is related to the core seam calculation algorithm. For some meshes, checking this value may create more meaningful seams.
  • Method:
Autoseam operator various options.
These are methods to unwraps the seams. It is actually the same as the Unwrap operator. So, both angle based and conformal methods to unwrap the seams are supported.
  • Fill Holes:
The functionality of this option is same as the UV unwrap operator.
  • Correct Aspect:
The functionality of this option is same as the UV unwrap operator.
  • Blend:
The functionality of this option is same as the UV unwrap operator.
  • Island Margin:
This is float parameter. It is same as the Island Margin feature of the Smart UV project. This feature ensures the distance between the unwrapped seams (if live unwrapping is enabled) to a ceratin value given by the user. This is necessary to avoid texture bleeding for seams generated by autoseam.
  • Live Unwrap:
Now this is added as an option of the operator. If this is enabled, after marking the seams autoseam unwraps the model in UV editor.

Graphical Demonstration

The operator will produce similar outputs in the 3d window. Actually the imagess presented below show the marked seam for simple meshes. The seams are generated automatically with the operator described above. No tuning is done later.

Cylinder Mesh.
Sphere Mesh.

Actually Generate Seam operator can do more interesting stuff which the above images represent. With just one click, it will find the seams, mark it and unwrap the seams in the image editor. After that, you can use the existing uv editing options if you think necessary. I can't resist myself to make a first video demonstration about how to do this. Here is goes -

Here is another demo to show you the effect of changing avaiable parameters on generating seams automatically -

And this is the final demo of the project -