Working with tiled textures

 
< previous page next page >

In this tutorial we will have a look at a certain type of input data using tiled textures and therefore tiling- optimized UV atlases to make the most out of performance and visual quality. This type of input data is very common in the 3d production for fashion and furniture items coming from an offline rendering workflow as well as architectural rendering and 3d buildings, where we have alot of repeated structures and details, in general.

We will be able to optimize the model, eg. by reducing polycount, while still preserving the same tiling UVs and tiled textures as in the input as well as in addition also bake a seperate atlas based occlusion map. Let us start with downloading the source model here.

Table of Contents

Settings

 back to top

We will use the following pool of settings to handle input data with tiled textures:

Decimation

Name Type Default Valid Range Quick Description
decimation:preserveTiledUVs Flag true {true, false} preserves repeating texture coordinates during decimation
decimation:tiledUVThreshold Real 1.5 {1 .. inf} UV extent after which a UV channel is considered repeating (= tiling texture)
decimation:preserveMaterialBorders Flag false {true, false} preserves mesh material borders during decimation

Compact

$SETTINGS_TABLE_ROW$(compact:addUVsToTiledMeshes)
Name Type Default Valid Range Quick Description


The armchair model uses tiled texture maps and we will see how we can tackle this kind of input within the optimization process.

Optimizing and Preserving Tiling

 back to top

Let us first have a look at the input model:

As you can see the glTF file, when unpacked to non-binary, comes with 4 tiled textures and one texture with alpha channel for the shadow plane.

Now we can see what is normally happening with the asset if we compact it with default settings:

	rpdx -i armchair.glb -c f:20% -e compact/armchair-compact.gltf
	
This results in RapidCompact baking the tiled information into a number of atlases depending on the chosen flattening. In this case we get one atlas for the shadow plane and one for the opaque armchair.

As you can imagine this result might not be optimal in many cases because of the clever set-up and usage of tiled textures in the original. To preserve the tiling just write a config with the command

rpdx --write_config
and change the following setting in the config file to true:

Decimation

Name Type Default Valid Range Quick Description
decimation:preserveTiledUVs Flag true {true, false} preserves repeating texture coordinates during decimation


Now we can proceed by simply entering the same command again using our new config:

	rpdx -i armchair.glb -c f:20% -e compact-tiling/armchair-compact.gltf
	

As you can see these files look very similar to the original input except for the fact that the mesh now has a much lower face count.

Note however that the preserveTiledUVs setting has similar but not as strict limitations as the preserveUVs setting. Meaning in some situations you might not always be able to reach the desired target resolution and preserve the tiling.


Baking an additional AO

 back to top

In case you want to preserve the Tiling and bake an additional map, which does not work via tiling and thus needs to have an atlas, you can use the following settings in conjunction, setting all of them to true:

Ambient Occlusion

Name Type Default Valid Range Quick Description
ao:enabled Flag false {true, false} turns AO (Ambient Occlusion) generation on/off

Decimation

Name Type Default Valid Range Quick Description
decimation:preserveTiledUVs Flag true {true, false} preserves repeating texture coordinates during decimation

Compact

$SETTINGS_TABLE_ROW$(compact:addUVsToTiledMeshes)
Name Type Default Valid Range Quick Description


Now simply continue by using the following command:

	rpdx -i armchair.glb -c f:20% -e compact-tiling-ao/armchair-compact.gltf
	

Now we have the same output as before but in addition a baked occlusion using the second UV channel of the armchair mesh.

Note that the compact:addUVsToTiledMeshes setting does only work in this way making use of --compact at the moment. Re-baking an existing atlas into the second UV channel is not supported. In addition the MB target will not use the setting.



< previous page next page >