prefrontalcortex / UnityGLTF

Runtime GLTF Loader for Unity3D
MIT License
163 stars 41 forks source link

Exception when exporting in HDRP and no Materials #62

Open steoberg opened 2 years ago

steoberg commented 2 years ago

Hi there,

I try to export a gameobject in HDRP at runtime. First I got an exception in MaterialExtensionsConfig line 125. "profiles" was null. This happend also in the "ExportTestScene". For some reason this doesn't happen anymore but in any case, the materials are all white. The asset contains some custom shaders (Shader Graph) but mostly HDRP/Lit shaders. Both are white after exporting.

The validation report on gltf viewer shows two messages "UNUSED_MESH_TANGENT" and "UNSUED_OBJECT", both many times.

I'm using Unity 2022.2.0a17.

Any ideas? Thanks!

hybridherbst commented 2 years ago

Hi, does the same happen on Unity 2021.3 LTS in HDRP? Do you have a simple scene for reproduction?

The validation messages are expected, the validator complains that these are "unused" since the materials using those meshes don't need them, but UnityGltf can't know if you want to retain the data nonetheless for other softwares. Stripping them out would mean when you switch the material in an external software you're now missing the mesh data.

If you want "clean" validated files please use pipeline processing tools such as gltf-transform to prune unneeded data for delivery.