Exporting Assets

Export Formats

Threekit supports the following export formats:

glTF

Tips

Material Alpha (Opacity) Blend

Most glTF viewers use render passes to process opaque and transparent materials. Meshes using opaque materials are rendered first, from front to back. Then, meshes using transparent materials are rendered back to front, to properly see the transparency effects. The cut-off, or mask, is a third mode supported by glTF that use a threshold; below that threshold it's transparent and above opaque. The cut-off materials are processed with the opaque ones.

The Render Category property in the material determines which render pass the viewer uses to process each mesh:

  • Guess: Try its best to emulate opaque and transparent; depending on the opacity values, it will put the material in opaque or transparent mode.

  • Opaque: Treat this material as fully opaque, ignores all the opacity properties.

  • Transparent: Set in transparent mode if there's any opacity values (opacityFactor less than 1, opacityMap is set, and/or baseTransparent is checked).

  • Cut-out Transparent: with the Alpha Test Minimum value, which is the threshold.

Texture Tiling and Offsets

Tiling and Offset are for material textures and are supported in some viewers, like the Babylon.js Sandbox. But it's important to test your target viewer first to see if those features are properly supported.

Geometry

  • Avoid using more than two UV channels.

  • Break a PolyMesh into opaque and transparent parts; the render pass used for the mesh greatly affects how it is displayed.

Unsupported Features

Material

  • Transparency

  • Bump

  • Clear Coat (there's the extension KHR_materials_clearcoat for this)

  • Anisotropy

  • Specular

  • Sheen

  • Light Map

  • Canvas textures

  • Tiling/Offsets (depends on the viewer)

Geometry

  • More than two UV Maps

Misc

  • Not exporting cameras and lights

Modifications

These are modifications applied to the data before writing the glTF file.

Geometry

  • The meshes are triangulated.

  • For multi-materials, the faces are split to match their material IDs, which creates multiple meshes. Visually, they will look like they belong to the same object.

    • In WebGL, multi-materials don't exist; the meshes are also split for rendering purposes.

  • (Optional) Compression with Draco3d.

Material/Texture

To reduce the amount of textures needed:

  • Metallic and Roughness maps are combined as blue and green channels respectively.

    • If an Ambient Occlusion map is also available, it is combined as the red channel.

  • Base and Opacity maps are combined.

    • The inverted Opacity map is applied there also.

  • Normal maps are changed if the red/green flip and/or swap red/green switches are set.

USDZ

Tips

Texture Tiling and Offset

For AR Kit, tiling and offset are supported, but they have some bugs. It seems that if a tiling or offset is applied, it's shared between textures. For example, a material with an ambient occlusion map, a normal map, and a roughness map, with tilings of 1x1, 5x5, and 8x8, respectively, would be all combined by AR Kit with a tiling of 1x1.

Geometry

  • Avoid using more than one UV channel.

Unsupported Features

Material

  • Transparency (might be able to support in the future)

  • Bump

  • Anisotropy

  • Specular

  • Sheen

  • Light

  • Canvas textures

  • Cut-Off Render Category

Geometry

  • Multiple UV Maps (in the future, might be able to support two)

Modifications

These are modifications applied to the data before writing the USDZ file.

Material/Texture

  • Inverted Opacity map is converted to a different texture.

  • Base and Opacity maps are combined if the base map uses transparency.

  • Roughness map, scaled by its factor, is passed through a square root operator in order to be displayed properly in AR Kit.

  • Normal map is completely transformed if its factor is less than 1 or if it has the flip or swap switch set.

FBX

Unsupported Features

Material

  • Metallic

  • Roughness (the factor is converted to shininess)

  • Transparency (opacity is used instead)

  • Sheen

  • Anisotropy

  • Light

  • Canvas textures

Modifications

Material

  • Roughness is converted to shininess

STL

STL exports to binary or ASCII formats. Examples below:

Binary (default)

./node_modules/.bin/ts-node src/index.ts export \
--orgId $YOUR_ORG_ID \
--token $TOKEN \
--assetId $YOUR_ASSET_ID \
example_binary.stl

ShellCopy

ASCII

./node_modules/.bin/ts-node src/index.ts export \
--orgId $YOUR_ORG_ID \
--token $TOKEN \
--assetId $YOUR_ASSET_ID \
--settings '{"asciiStl":true}' \
example_ascii.stl

Last updated