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.
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 |
Let us first have a look at the input model:
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:
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
Let us first have a look at the input model:
Input Textures:
rpdx -i TransmissionTest.glb -s compact:aggregateUVs true -s compact:allowRectangularPOTTextures true -s decimation:preserveUVs true -c -e TransmTest_aggregateUVs-rec.glb
Resulting model:
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: