kcoley / gltf2usd

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

Model ends up without texture #68

Closed ghost closed 6 years ago

ghost commented 6 years ago

I'm trying to get a GLTF converted in USDZ but somehow, my model ends up without any texture. When I uncompress the .usdz the texture file is in there.

For some context, I installed last week USD by Pixar and gltf2usd on a Debian on AWS EC2. It worked, I was able to export and get a nice looking USDZ.

Then I proceed to do the same again but on an Amazon Linux 2 on AWS EC2 and after some first tests, I see the USDZ doesn't display its texture. I taught it was because of some library compatibility or such kind of problem so I keep digging but now when I resolve myself to go back to use Debian I try again to convert the same GLTF and I get the same without texture model.

I wonder if this could come grom gltf2usd? Is there something obvious I'm missing here?

ghost commented 6 years ago
kcoley commented 6 years ago

Hi @sayduck-daniel . This is definitely odd. I am also seeing all files and references working when opening the usdz file. I also locally converted the original glTF and it looks to work as expected. Are you converting to usdz with usdzip or are you using gltf2usd to do this directly?

Also are you on the lastest master of gltf2usd and on Pixar's USD?

ghost commented 6 years ago

ok... I understand what is the problem...

It was no need for me to build 30h of source code for libraries needed by USD or for me to have to compile from source LLVM or CLANG.

The problem comes from how I call gltf2usd.

Initially, I was doing it with a full path:

python /usr/local/gltf2usd/Source/gltf2usd.py -g ~/workspace/variant.gltf -o ~/workspace/variant.usdz

Then when I switch from Debian to Amazon Linux 2 on EC2, while installing stuff I simplify my script to do instead:

cd  ~/workspace/
python /usr/local/gltf2usd/Source/gltf2usd.py -g ./variant.gltf -o ./variant.usdz

So long story short, I just spent 80h in total for nothing 👍

Relative paths, is it something on your side or USD side? I can open an issue on their repo if needed.

kcoley commented 6 years ago

Ah that makes sense. I think the relative paths would probably have to be handled within this tool. Feel free to file and issue here or make a PR if you think it’s a quick fix!

ghost commented 6 years ago

Could you add this to the README file? Just in case someone else false in this trap.

kcoley commented 6 years ago

@sayduck-daniel actually I had a thought. The converter was able to transfer the textures so the issue may actually be with usdzip. I’ll try to reproduce when I get some time. But I’ll make a note to update the readme

kcoley commented 6 years ago

@sayduck-daniel I just merged a change to support relative paths in the generated usdz file. I basically change to the directory of the usdc file and switch all paths to relative so CreateNewUsdzPackage works as expected. Feel free to give this a try.

ghost commented 6 years ago

Thanks, I'm gonna try o^when we next deploy the latest of USD and your code. I let you know ASAP

MrDChristop commented 6 years ago

Usdzip can not handle relative paths, i already filed a report on USD forum https://groups.google.com/forum/#!topic/usd-interest/jos8g0t8w00

I am not sure if gltf2usd should fix this with a workaround. I also do this manually in my code, change to the directory of where the usd has to be created.

MrDChristop commented 6 years ago

this line which used to work now fails gltf2usd.py -g sdf_vray_utf8.gltf -o das.usdz

Traceback (most recent call last):
  File "C:\Users\d_chr\Downloads\gltf2usd-master\Source\gltf2usd.py", line 742, in <module>
    convert_to_usd(os.path.expanduser(args.gltf_file), os.path.expanduser(args.usd_file), args.fps, args.scale, args.arkit, args.verbose, args.use_euler_rotation)
  File "C:\Users\d_chr\Downloads\gltf2usd-master\Source\gltf2usd.py", line 707, in convert_to_usd
    os.chdir(os.path.dirname(usdc_file))
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: ''

This line has to be given now in the latest version instead gltf2usd.py -g sdf_vray_utf8.gltf -o ./das.usdz

So you must specify a directory now....

kcoley commented 6 years ago

@MrDChristop thanks for flagging the issue. I made a recent change that converts the usd file path to absolute path for now.

MrDChristop commented 6 years ago

Hi. Where is the commit for this?

kcoley commented 6 years ago

@MrDChristop the commit is here at the bottom of gltf2usd.py: https://github.com/kcoley/gltf2usd/pull/83/files