25

I tried to look at the main documentation at http://graphics.pixar.com/usd/docs/index.html and http://graphics.pixar.com/usd/docs/Usdz-File-Format-Specification.html but could not find the details to create a usdz file.

I can get some sample USD files from http://graphics.pixar.com/usd/downloads.html

How can we create one?

MujtabaFR
  • 5,956
  • 6
  • 40
  • 66
Suren Konathala
  • 3,497
  • 5
  • 43
  • 73
  • Heard from Pixar team that as of today June 4th, 2018, teams are still working on implementing the USDZ feature and tools to create these files will be available soon! – Suren Konathala Jun 04 '18 at 19:18
  • The question has still no real answer. What if I do not want to convert but just create a cube directly as USDZ and not as glb or obj etc? – multitudes Jun 01 '21 at 18:18

8 Answers8

25

A gallery of usdz files are provided by Apple at the url below

https://developer.apple.com/arkit/gallery/

You need a device with iOS12 beta installed for the models to be viewable on your mobile device. Basically Apple uses Mime-types model/usd usdz and model/und.pixar.usd .usdz to identify them as AR viewable. You also need to do this via the safari browser... Chrome does not support the file format.

the html to list a thumbnail usdz file would be the following.

<a rel="ar" href="model.usdz">
  <img src="model-preview.jpg">
</a>

to create your own usdz files, Apple has bundled usdz_converter as part of Xcode 10. Its a command line tool for creating the usdz file from OBJ files, Single-frame Alembic (ABC) files, USD file (either .usda or usd.c)

the basic command line is

xcrun usdz_converter Wineglass.obj Wineglass.usdz  

usdz supports physically based renders, to achieve this you add images for each component of the PBR like so,

xcrun usdz_converter Wineglass.obj Wineglass.usdz 
-g WineGlassMesh
-color_map WineGlass_Albedo.png
-metallic_map WineGlass_Metallic.png
-roughness_map WineGlass_Roughness.png
-normal_map .  WineGlass_Normal.png
-emissive_map  WineGlass_Emissive.png

A good video to get you started on how to create usdz files, host on a webpage & create a quicklook in your own app

https://developer.apple.com/videos/play/wwdc2018/603/

Jens Zalzala
  • 2,546
  • 1
  • 22
  • 28
Clay
  • 1,721
  • 2
  • 10
  • 18
  • I was able to show the psdz-files from the ARKit gallery in a QLPreviewController. However, I found out that not every file works. For example, the tulip and retro TV caused a crash, but the gramophone shows up fine. Anyone else has this problem? – Matthijs Jun 13 '18 at 17:19
  • Interesting, I haven’t had a chance to test that yet. However, I could not find usdz_converter in the xcode 10 beta bundle (as stated in the wwdc video). I was hoping to convert my own OBJ files. using the xcrun usdz_converter Windeglass.obj Wineglass.usdz – Clay Jun 13 '18 at 21:03
  • And it works now, my problem was that I didn't the copy my files to the app bundle in the right way – Matthijs Jun 14 '18 at 14:46
  • Hi Ash, how did you add animation to the 3D animated gear USDZ example you have? Do you also use Maya and USD plugin? – user2153553 Jul 05 '18 at 11:32
  • 1
    The gear examples at www.fusionar.app were done by using the usd framework on obj files that support PBR materials. You can create a usda file which supports the PBR materials first... by using the -l -d option in the usdz_converter command. You can then edit the usda file adding rotational translations on the obj meshes. Then execute the usdz_converter on the edited usda file (with animations added). – Clay Jul 09 '18 at 22:47
  • You can also do usdz animations with alembic (abc) assets. Blender, Maya, Modo all have alembic exporters. However, i haven't been able to get bone animations to work yet using Blender, Maya or Modo... there is also a problem with uv materials not rendering correctly... something wrong with the scaling and uv mapping which causes fragment materials. – Clay Jul 09 '18 at 22:53
  • Adding to Ash great answer, you can also try GLTF to USD conversion https://github.com/kcoley/gltf2usd This is totally exciting! So many possibilities. Of course all this conversion business is an annoyance, but still slowly being able to easily export 3D animation to AR. – user2153553 Aug 17 '18 at 03:32
5

For creating USDZ files from OBJs on iOS (no xcode needed)

An engineer on my team figured this out last week! (see his rundown on our blog: https://www.scandy.co/blog/how-to-export-simple-3d-objects-as-usdz-on-ios)

Creating USDZ files is funny right now - currently we can fake it by saving a USDC file and... renaming the extension!

First you'll want to load the .obj file at filePath as an MDLAsset

NSURL *url = [NSURL fileURLWithPath:filePath];
MDLAsset *asset = [[MDLAsset alloc]initWithURL:url];

ensure the MDLAsset can write the desired extensions usdc is supported (USD binary format)

if([MDLAsset canExportFileExtension:@"usdc"]){
  NSLog(@"able to export as usdc");

  // save the usdc file
  [asset exportAssetToURL:usdcUrl];
}

rename the usdc to usdz because that's all it takes

NSError *renameErr;
NSFileManager *fm = [[NSFileManager alloc] init];
BOOL mvResult = [fm moveItemAtPath:usdcPath toPath:usdzPath error:& renameErr];
if(! mvResult){
  NSLog(@"Error renaming usdz file: %@", [renameErr localizedDescription]);
}

Hope this helps until Apple can give us a more thorough how-to.

gtfargo
  • 337
  • 2
  • 5
  • 2
    Amazing idea! I'm wondering if its possible to run this on Swift backend framework like Vapor. And even if it has to run on OSx machine or it could be Linux. What do you think? – Alex Mensak Dec 16 '18 at 13:37
  • Dear @AlexMensak great question, did you have any luck in these years? did you figure it out? – Alberto Tono Jan 13 '21 at 07:39
4

You can now easily create/export USDZ from Unity:

https://blogs.unity3d.com/2019/03/28/pixars-universal-scene-description-for-unity-out-in-preview/

Jeremy Cowles
  • 1,171
  • 1
  • 9
  • 13
3

@Ash, you have to activate the command line tools in Xcode preferences, in case they're not actived yet (that was my case). See image below.

enter image description here

Matthijs
  • 515
  • 4
  • 8
2

Assuming that you're on macOS, since you're trying to create USDZ files, then Apple released Reality Converter (currently Beta) in January of this year (2020). It allows you to drag and drop OBJ files and export to USDZ.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
kcamel
  • 145
  • 7
1

Using Reality Composer.

Reality Composer lets you create all sorts of shapes in am easy to understand interface, and since Xcode 12, it is possible to export your creation to .usdz if enabled in settings/preferences. The software is still in beta, so it might have some glitches but it is helpful for prototyping.

Open Reality Composer and go to settings with command+ ,

Check Enable USDZ export

screenshot of the settings page

multitudes
  • 2,898
  • 2
  • 22
  • 29
0

You can now create usdz files in SketchUp Pro using a prebuilt plugin.

  1. Download usdz plugin from https://github.com/drwave/usd-sketchup/blob/master/USDExporter.plugin.zip

  2. Unzip file, and place USDExporter.plugin in Plugins directory inside the SketchUp Pro app bundle. You can do this from Terminal by the following. Note you will need to type an admin password, as the directory is probably write-protected

    Sudo cp -rf USDExporter.plugin /Applications/SketchUp\ 2018/SketchUp.app/Contents/Plugins/

Clay
  • 1,721
  • 2
  • 10
  • 18
-2

You can create usdz files online in a tool called Vectary:

  1. Open Vectary editor.

  2. Create your 3D model or import your 3D file with drag and drop (OBJ, STL, GLTF, DAE).

  3. Export as USDZ 3D file in the right panel.

  4. You will receive an email with a link to download your USDZ file.

More info on the url below:
https://www.vectary.com/3d-modeling-how-to/how-to-create-usdz-file-for-ar-online/

You don't need to rewrite the names of the object or materials, the tool does all the work.

Teo.sk
  • 2,619
  • 5
  • 25
  • 30