Skip to content

Texture Optimization

TextureConverter is a specialized command-line tool provided by Apple for processing, compressing, and converting textures for use with Metal and Apple Silicon GPUs. It is distributed with Xcode’s Metal developer tools.

FormatUsageNotes
ASTCPreferred for visionOSSupports varying block sizes (4x4 to 12x12) and HDR.
BC1-7Desktop / ConsoleStandard generic compression.
ETC2Mobile (Legacy)Older Android/iOS standard.
  • KTX2 (.ktx2): The preferred modern container for streaming textures.
  • OpenEXR (.exr): For HDR environment maps and light probes.

You can access the tool via xcrun:

Terminal window
xcrun TextureConverter [options] input.png

This provides the highest visual quality for character skins or hero assets.

Terminal window
xcrun TextureConverter \
--compression_format=ASTC4x4 \
--compression_quality=Highest \
--output=Hero_Diff.ktx2 \
Hero_Diff.png

Best for background props or roughness/metallic maps where high frequency detail matters less.

Terminal window
xcrun TextureConverter \
--compression_format=ASTC8x8 \
--compression_quality=Medium \
--output=Prop_Rough.ktx2 \
Prop_Rough.png

Assemble 6 faces into a single .ktx2 environment map.

Terminal window
xcrun TextureConverter --mode=convert --build_cubemap --output=Skybox.ktx2 \
posx.png negx.png posy.png negy.png posz.png negz.png

Preflight uses TextureConverter under the hood for its fix:setTexture optimization tools.

When you choose to “Optimize Texture” in the Inspector:

  1. Preflight analyzes the source image resolution (e.g., 4096x4096).
  2. It selects an appropriate ASTC block size (4x4 for 4K, 6x6 for 2K).
  3. It runs TextureConverter to generate a .ktx2 file.
  4. It updates the USD reference to point to the new file.

Note: You must have Xcode Command Line Tools installed for this feature to work.