kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
263 stars 39 forks source link

Feature Request generating preview image programmatically #151

Closed wave-electron closed 5 years ago

wave-electron commented 5 years ago

@kcoley I've been looking at the usd api for ways to generate a preview.jpg for usdz files programmatically.

I found this viewportShot = usdviewApi.GrabViewportShot()

However, Apple's standalone USD Python doesn't support usdview anyway. Any ideas of other ways to go about this?

kcoley commented 5 years ago

@wave-electron hmm, I haven't used the grabviewportshot api call or tried to create an image from a USD myself. Unless usdview can somehow do this, not sure of a way to do this. You might be able to do this with glTF web apis, but it wouldn't be USD.

wave-electron commented 5 years ago

@kcoley I’m doing some dynamic usdz generation from a mac server using a mix php & python. I’m using glTF templates which don’t change only materials each time. Which is working fine. I was now looking at generating the preview.jpg at the same time so it would preview in safari without using a stock image. The problem is I’ve been unsuccessful building USD on macOS Mojave... and the Apple Standalone USDPython doesn’t include usdview. So I haven’t even been able to try grabviewportshot yet.

Maybe I can do it another way using the preview.app & AppleScript. Or using your glTF web apis suggestion.

open -a Preview file.usdz does preview the usdz file from the command line. Anyway thanks for the feedback. I can close this off if you like.

wave-electron commented 5 years ago

@kcoley

I worked out eventually you could use shell script on Mac... produces a nice size preview.png

#!/bin/sh

qlmanage -t -o ${PWD} camera3.usdz -f 10

exit