Creates palette textures containing all unique values of scalar
Material properties within the scene, then merges materials. For
scenes with many solid-colored materials (often found in CAD, architectural,
or low-poly styles), texture palettes can reduce the number of materials
used, and significantly increase the number of Mesh objects eligible
for join operations.
Materials already containing texture coordinates (UVs) are not eligible for
texture palette optimizations. Currently only a material's base color,
alpha, emissive factor, metallic factor, and roughness factor are converted
to palette textures.
Creates palette textures containing all unique values of scalar Material properties within the scene, then merges materials. For scenes with many solid-colored materials (often found in CAD, architectural, or low-poly styles), texture palettes can reduce the number of materials used, and significantly increase the number of Mesh objects eligible for join operations.
Materials already containing texture coordinates (UVs) are not eligible for texture palette optimizations. Currently only a material's base color, alpha, emissive factor, metallic factor, and roughness factor are converted to palette textures.
Example:
import { palette, flatten, dequantize, join } from '@gltf-transform/functions'; await document.transform( palette({ min: 5 }), flatten(), dequantize(), join() );
The illustration below shows a typical base color palette texture: