Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.95 KB

README.md

File metadata and controls

36 lines (28 loc) · 1.95 KB

USD Thumbnail Generator

Purpose

Given a USD file, take a picture and assign it as it's thumbnail.

Usage

python generate_thumbnail.py <usd_file>

positional arguments:

  • usd_file : The USD file you want to add a thumbnail to. If USDZ is input, a new USD file will be created to wrap the existing one called <subject_usd_file>_Thumbnail.usd

optional arguments:

  • -h, --help : Show help
  • --create-usdz-result : Returns the resulting files as a new USDZ file called <subject_usd_file>_Thumbnail.usdz
  • --verbose : Prints out the steps as they happen

Note: You must have usd installed and available in your path. Install Steps Here

How it works

Given a USD file to use as the subject of the thumbnail do the following

  1. Generate a camera such that the subject is in view
  2. Sublayer the subject in the camera
  3. Run usdrecord to take a snapshot and store it in /renders/<input>.0.png
    • macOS
      • usdrecord --frames 0:0 --camera ZCamera --imageWidth 2048 --renderer Metal camera.usda <input>.#.png
    • windows
      • usdrecord --frames 0:0 --camera ZCamera --imageWidth 2048 --renderer GL camera.usda <input>.#.png
      • note: this will run with shell=True for the subprocess call
    • linux
      • usdrecord --frames 0:0 --camera ZCamera --imageWidth 2048 --renderer Metal camera.usda <input>.#.png
    • ZCamera & camera.usda are generated in step 2
  4. If the file is not a USDZ file, assign that image as the usd's thumbnail image
  5. If the file is a USDZ file, create a new <subject_usd_file>_Thumbnail.usda, assign the image as the thumbnail, and sublayer <subject_usd_file>.usdz
  6. If --create-usdz-result is passed in, combine all of the files into a USDZ, in the case of a USD file it would be the input file and the image. In the case of a USDZ file it would be the new USDA, the image, and the input USDZ