Unity-Technologies / usd-unity-sdk

Integration of Pixar's Universal Scene Description into Unity. UPDATE: This package has been superseded by our new bundle of USD packages. Please see README & link below for further details.
https://forum.unity.com/threads/new-openusd-packages-now-available.1524583/
Apache License 2.0
499 stars 74 forks source link

Official Unity Example Scene does not export properly (FTV-280) (USDU-324) #125

Open hybridherbst opened 5 years ago

hybridherbst commented 5 years ago

The default scene Unity shows when starting a new project with the template "3D With Extras" has a number of issues with USD and USDZ export.

1) USD export does not support Occlusion channel, seems to always render as black image After removing the Occlusion map from all materials, it's getting better, but it looks like

2) Texture tiling is not exported, everything exports as clamped texture image After hacking in the wrapS and wrapT properties into ShaderExporterBase, the result still looks wrong in usdview: image

3) USDZ export does not support TIF, only PNG and JPEG. Exporting this scene (with occlusion maps removed) to USD "kinda works" (minus the tiling/clamping), but exporting to USDZ still renders as black as all albedo etc. are exported straight from disk but in a format (tif) that's not actually supported. Same would go for PSD, EXR and others.

122 contains the beginnings of a fix for this that would improve USDZ export in that regard. Note that e.g. GLTF exporter and FBX exporter are able to handle this properly.

4) USD export is factor 100x smaller than USDZ export.

To reproduce: 1) create a new Unity project with 2019.1.x or 2.x with the "3D with Extras" preset 2) select "ExampleAssets" 3) export to USD and USDZ 4) view in usdview

jcowles commented 5 years ago

This is an excellent test case, great idea -- and thank you for the thorough bug report!

jcowles commented 5 years ago

1: Perhaps occlusion is inverted, I believe 1.0 in UsdPreviewSurface means completely not occluded

2: Wrapping was a known limitation of the initial implementation. Texture scaling is probably the other issue, which was not supported in UsdPreviewSurface until 19.05, so we can now add proper support.

3: This is a known issue, I believe there is an internal bug open.

4: The USDZ scale difference is intentional, since (AFAIK) USDZ / Apple AR Quick Look is specified in centimeters, but Unity is in meters.

I believe Apple may have recently changed this, we will investigate.

hybridherbst commented 5 years ago

Regarding (3) would be great if you can tell me the state that work is in / if it's worth for me to continue with my fixes/improvements for this (as I started in https://github.com/prefrontalcortex/usd-unity-sdk/tree/texture-export).

jcowles commented 5 years ago

As far as I know, work on (3) is not yet started internally, so if you send a PR addressing the issue, it would be greatly appreciated. We'll keep you in the loop if that changes (CC @mfe @lucillecaillaud)