Aggregating UVs

 
< previous page next page >

In this tutorial we will have a look at an alternative to Texture Baking. This method will avoid creating new UV layouts and preparing for baking and instead focuses on aggregating existing UV sets into new combined atlases. Therefore, the original UV layouts will be preserved but it is also possible to save on model, material complexity and draw calls without baking any new maps.

Table of Contents

Key Settings

 back to top

We will use the following settings to aggregate UVs and control if we want to allow for rectangular atlases and texture maps or not:

Name Type Default Valid Range Quick Description
compact:aggregateUVs Flag false {true, false} if UVs are preserved, combines textures from different materials into a single atlas when possible
compact:allowRectangularPOTTextures Flag false {true, false} create rectangular POT textures when beneficial for auto sized textures
decimation:preserveUVs Flag false {true, false} preserves texture coordinates during decimation


Simple Example

 back to top

Let us first have a look at the input model:

The antique camera model from the glTF sample assets is a good simple example. It can be downloaded here.

Input Textures:

The 6 individual input textures.

Let`s try to optimize the asset using aggregation of UV charts:

rpdx -i AntiqueCamera.glb -s compact:aggregateUVs true -s decimation:preserveUVs true -c -e AntiqueCamera_aggregateUVs.glb

Resulting Textures:

As you can see, the aggregation was successful, however the result wastes a lot of UV space.

Now let`s add another setting allowing for a rectangle UV atlas and texture maps:

rpdx -i AntiqueCamera.glb -s compact:aggregateUVs true -s compact:allowRectangularPOTTextures true -s decimation:preserveUVs true -c -e AntiqueCamera_aggregateUVs-rec.glb

Resulting Textures:

As you can see, the aggregation was successful and the texture maps are now rectangular with a 2048x1024 resolution.


More Complex Example

 back to top
The Transmission Test model from the glTF sample assets is a good example for a slightly more complex 3D asset. It can be downloaded here.

Let us first have a look at the input model:

The input has 34 draw calls. Let's see how we can reduce this, while keeping visual fidelity and without the need of unwrapping and texture baking!

Input Textures:

The 9 individual input textures.

Now let`s try again to optimize using both of the settings:

rpdx -i TransmissionTest.glb -s compact:aggregateUVs true -s compact:allowRectangularPOTTextures true -s decimation:preserveUVs true -c -e TransmTest_aggregateUVs-rec.glb

Resulting model:

The output has only 7 draw calls. Let's have a look at how this was achieved below.

As you can see below, the aggregation was successful and due to the merging of the given UV atlases, the scene now has 4 times less draw calls while not suffering on the visual quality side.

Resulting Textures:

The 6 aggregated output textures.



< previous page next page >