Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gltf importing fails #344

Closed
davidejensen opened this issue Jul 4, 2022 · 1 comment
Closed

Gltf importing fails #344

davidejensen opened this issue Jul 4, 2022 · 1 comment
Assignees

Comments

@davidejensen
Copy link
Member

Summary

Since the addition of the hologram shader functionality the desktop project fails to import gltf assets and subsequently fails in execution during the loading of the avatar.
The importing error can be seen in the CI but doesn't happen locally when we run the desktop-project.

CI Stacktrace

In the CI the importing error is related to the shader used by the model, here's the full stacktrace

Asset import failed, "Packages/com.decentraland.unity-renderer/Rendering/LoadingAvatar/CrossSection/Avatar_Male_SingleMesh.glb" > ShaderNotFoundException: DCL/Universal Render Pipeline/Lit not found. Did you forget to add it to the build?
UnityGLTF.StandardMap..ctor (System.String shaderName, System.Int32 MaxLOD) (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/UniformMaps/StandardMap.cs:67)
UnityGLTF.MetalRough2StandardMap..ctor (System.String shaderName, System.Int32 MaxLOD) (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/UniformMaps/MetalRough2StandardMap.cs:8)
UnityGLTF.MetalRoughMap..ctor (System.Int32 MaxLOD) (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/UniformMaps/MetalRoughMap.cs:7)
UnityGLTF.GLTFSceneImporter+<ConstructMaterial>d__136.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:2068)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<DownloadAndConstructMaterial>d__130.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:1755)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<ConstructPrimitiveMaterials>d__128.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:1656)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<ConstructMesh>d__129.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:1716)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<ConstructScene>d__115.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:1317)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<CreateScene>d__99.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:613)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Cysharp.Threading.Tasks.UniTask+ExceptionResultSource.GetResult (System.Int16 token) (at Library/PackageCache/com.cysharp.unitask@9e2163616b/Runtime/UniTask.Factory.cs:211)
UnityGLTF.GLTFSceneImporter+<LoadScene>d__86.MoveNext () (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:366)
Rethrow as AggregateException: One or more errors occurred.
System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Threading.Tasks.Task.Wait (System.TimeSpan timeout) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityGLTF.GLTFImporter.CreateGLTFScene (System.String projectFilePath) (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/Editor/GLTFImporter.cs:136)
UnityGLTF.GLTFImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at /tmp/workspace/explorer-desktop/unity-renderer/unity-renderer/Assets/UnityGLTF/Scripts/Editor/GLTFImporter.cs:109)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /home/bokken/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22)

Tried fixes/workarounds

Different things have been tried to pinpoint the issue,

  • Thinking the issue was caused by the import from the unity package I've tried adding the avatar gltf model directly in the desktop project but it fails even in this case
  • I've tried re exporting the model both in glb and gltf with different options, with and without materials, without and without the import materials check in unity but it still fails
  • I've tried changing the shader of the material auto generated by unity when importing the model but the error still points to the Lit shader
  • I've verified and the shader is correctly included in the shader variants
  • I've tried duplicating the shader inside the explorer-desktop project but nothing changes
  • Something that was suggested might be that the glb is being imported before importing the shader, but from the logs it doesn't seem the case
    image (2)

Additional info

@AjimenezDCL
Copy link
Contributor

The root cause were the materials, we fixed the Import Materials. Using the materials constructed by a GLTF in editor is a really edge case with no use case at the moment. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants