Unwrapping a 3D Mesh

 
Important Note

Outdated Version:
You are looking at an outdated documentation version for an older RapidCompact CLI distribution. If you are using a newer version of the CLI please refer to the documentation of the current CLI release version.

< previous page next page >

Within this tutorial, we are going to use RapidCompact CLI to unwrap a 3D mesh. This means we will generate a 2D UV layout, which can then be used to texture the model, for example.

Table of Contents

Unwrapping Parameters

 back to top

RapidCompact CLI has two settings that can be used to control the unwrapping process:


Mesh Unwrapping

Name Type Default Valid Range Quick Description
unwrapping:cutOverlappingPieces Flag true {true, false} turns removal of UV self-overlaps through cutting on/off
unwrapping:method String isometric {'isometric', 'forwardBijective', 'fixedBoundary', 'fastConformal', 'conformal'} method to be used for UV unwrapping

The first setting, unwrapping:method, can be used to specify which method should be used for unwrapping. As we will see later, choosing the right method for your unwrapping task is very important, as it has a strong impact on the result, as well as on the duration of the unwrapping process. The second setting, unwrapping:cutOverlappingPieces, is a flag that specifies if overlapping pieces should be cut in order to resolve UV overlaps, or not. It depends on your unwrapping task whether you want this or not. As we will see in the following, this setting only has a practical effect if the unwrapping method in use potentially produces overlaps. Some unwrapping methods are guaranteed to never produce overlaps, and in for those methods this setting will have no practical effect.

In addition the RapidCompact CLI comes also with settings for other important UV- related topics such as segmentation and packing:


Mesh Segmentation

Name Type Default Valid Range Quick Description
segmentation:maxPrimitivesPerChart Int 10000 {1 .. inf} limits max number primitives in any UV chart
segmentation:chartAngleDeg Real 130 {0 .. 360} threshold (degrees) for overall curvature of 3D charts
segmentation:cutAngleDeg Real 88 {0 .. 180} threshold (degrees) for cutting sharp edges


Chart Packing

Name Type Default Valid Range Quick Description
packing:chartPadding Real 0.000488281 {0 .. 1} relative desired padding around charts inside the UV atlas

Getting Started

 back to top

To get started with the unwrapping functionality of RapidCompact CLI, we will use a simple example mesh of Victor, which you can download here. Victor is a simple 3D bust of a character, a manifold 3D mesh that has three boundary loops: a large one at the neck, and two smaller ones for the holes that were left for the eyes.

In order to be successfully unwrapped, a 3D mesh must have only 2-manifold edges, which means that there may never be more than two faces connected to a single edge (otherwise, generating a non-overlapping 2D UV layout would be impossible). Furthermore, the mesh must not have handles - a simple counter-example would be a mug with a handle. Meshes with handles are also impossible to unwrap in 2D without overlaps, given that they are not cut. We will use the Victor example, which is already manifold and has no handles and create a simple UV layout:

rpdx -i victor.obj -u -e victor-uv.obj

This command will generate an OBJ file victor-uv.obj, containing the input mesh with UV coordinates. There will be several islands in UV space, since this method will have produced some overlaps, and since the flag unwrapping:cutOverlappingPieces is enabled by default.

Configuration

 back to top

We will now turn overlap removal off and compare the results for all available methods. To visualize the stretch on the 3D surface, we will also assign a simple checkerboard texture. Try now the following command:

rpdx -i victor.obj -u --set_checker_texture -e victor-uv.obj

This will produce a textured 3D mesh in OBJ format, which should look like the following:

Using the default method isometric this result looks already quite nice. However, as we have disabled overlap removal, it can contain UV overlaps (and it does, in this case). If having UVs without overlaps is not important for your application, this might be OK. However, if you would like to have UVs without overlaps, without segmenting the model further, RapidCompact CLI also has a solution to offer. If stretch is not relevant, but it is only relevant that no overlaps occur, you can use the very fast fixedBoundary method, which pins the largest boundary (in this case the one around the neck) to a circle. Finally, in order to obtain a well-balanced result with minimum stretch and without any overlaps, you can use the slower, but high-quality forwardBijective method. The following figure and table shows an overview of the results generated by all available methods. Click the small images to see a larger version.

Method Execution Speed Potential UV Stretch Overlaps Possible? Example 3D Result Example UV Result
conformal Fast Medium
(angles preserved)
Yes
fastConformal Very Fast Medium
(angles approximately preserved)
Yes
isometric Medium Low
(angles /areas preserved)
Yes
fixedBoundary Very Fast High No
forwardBijective Slow Low
(angles /areas preserved)
No

< previous page next page >