Skip to content

Commit 1d91bc3

Browse files
authored
Docs: Add USDZExporter page (#31417)
1 parent a3f85f1 commit 1d91bc3

File tree

2 files changed

+131
-1
lines changed

2 files changed

+131
-1
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<base href="../../../" />
6+
<script src="page.js"></script>
7+
<link type="text/css" rel="stylesheet" href="page.css" />
8+
</head>
9+
<body>
10+
<h1>[name]</h1>
11+
12+
<p class="desc">
13+
An exporter for `USDZ`.
14+
<br /><br />
15+
[link:https://graphics.pixar.com/usd/docs/index.html USDZ] (Universal Scene Description ZIP archive) is a
16+
[link:https://openusd.org/release/index.html USD-based format] for 3D content optimized for sharing and viewing.
17+
USDZ files are ZIP archives containing USD scene data and associated textures. The format supports meshes,
18+
materials, textures, and cameras.
19+
</p>
20+
21+
<h2>Import</h2>
22+
23+
<p>
24+
[name] is an add-on, and must be imported explicitly.
25+
See [link:#manual/introduction/Installation Installation / Addons].
26+
</p>
27+
28+
<code>
29+
import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';
30+
</code>
31+
32+
<h2>Features</h2>
33+
34+
<p>
35+
USDZExporter supports the following features:
36+
</p>
37+
38+
<ul>
39+
<li>Meshes with MeshStandardMaterial</li>
40+
<li>Textures (diffuse, normal, emissive, roughness, metalness, alpha, ambient occlusion)</li>
41+
<li>Clearcoat and clearcoat roughness (from MeshPhysicalMaterial)</li>
42+
<li>Cameras (perspective and orthographic)</li>
43+
<li>AR anchoring properties for iOS Quick Look</li>
44+
<li>Texture compression support with texture utils</li>
45+
</ul>
46+
47+
<h2>Code Example</h2>
48+
49+
<code>
50+
// Instantiate a exporter
51+
const exporter = new USDZExporter();
52+
53+
// Configure export options
54+
const options = { maxTextureSize: 2048 };
55+
56+
try {
57+
58+
// Parse the input and generate the USDZ output
59+
const arraybuffer = await exporter.parseAsync( scene, options );
60+
downloadUSDZ( arraybuffer );
61+
62+
} catch ( error ) {
63+
64+
console.error( 'Export failed:', error );
65+
66+
}
67+
</code>
68+
69+
<h2>Examples</h2>
70+
71+
<p>
72+
[example:misc_exporter_usdz]
73+
</p>
74+
75+
<h2>Constructor</h2>
76+
77+
<h3>[name]()</h3>
78+
<p>
79+
</p>
80+
<p>
81+
Creates a new [name].
82+
</p>
83+
84+
<h2>Methods</h2>
85+
86+
<h3>[method:undefined parse]( [param:Object3D scene], [param:Function onCompleted], [param:Function onError], [param:Object options] )</h3>
87+
88+
<p>
89+
[page:Object3D scene] — Scene or object to export.<br />
90+
[page:Function onCompleted] — Will be called when the export completes. The argument will be the generated USDZ ArrayBuffer.<br />
91+
[page:Function onError] — Will be called if there are any errors during the USDZ generation.<br />
92+
[page:Options options] — Export options<br />
93+
<ul>
94+
<li>`maxTextureSize` - int. Restricts the image maximum size (both width and height) to the given value. Default is 1024.</li>
95+
<li>`includeAnchoringProperties` - bool. Whether to include anchoring properties for AR. Default is true.</li>
96+
<li>`quickLookCompatible` - bool. Whether to make the exported USDZ compatible with Apple's QuickLook. Default is false.</li>
97+
<li>`ar` - Object. AR-specific options including anchoring type and plane anchoring alignment.</li>
98+
</ul>
99+
</p>
100+
<p>
101+
Generates a USDZ ArrayBuffer output from the input Object3D. Note that only MeshStandardMaterial is supported.
102+
</p>
103+
104+
<h3>[method:Promise parseAsync]( [param:Object3D scene], [param:Object options] )</h3>
105+
106+
<p>
107+
Generates a USDZ ArrayBuffer output from the input Object3D.
108+
</p>
109+
<p>
110+
This is just like the [page:.parse]() method, but instead of
111+
accepting callbacks it returns a promise that resolves with the
112+
ArrayBuffer result, and otherwise accepts the same options.
113+
</p>
114+
115+
<h3>[method:undefined setTextureUtils]( [param:Object utils] )</h3>
116+
117+
<p>
118+
Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.
119+
Depending on whether you use WebGLRenderer or WebGPURenderer, you must inject the corresponding
120+
texture utils WebGLTextureUtils or WebGPUTextureUtils.
121+
</p>
122+
123+
<h2>Source</h2>
124+
125+
<p>
126+
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/USDZExporter.js examples/jsm/exporters/USDZExporter.js]
127+
</p>
128+
</body>
129+
</html>

docs/list.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@
377377
"GLTFExporter": "examples/en/exporters/GLTFExporter",
378378
"OBJExporter": "examples/en/exporters/OBJExporter",
379379
"PLYExporter": "examples/en/exporters/PLYExporter",
380-
"STLExporter": "examples/en/exporters/STLExporter"
380+
"STLExporter": "examples/en/exporters/STLExporter",
381+
"USDZExporter": "examples/en/exporters/USDZExporter"
381382
},
382383

383384
"Math": {

0 commit comments

Comments
 (0)