com.unity.cloud.gltfast icon indicating copy to clipboard operation
com.unity.cloud.gltfast copied to clipboard

.glb with AI painted vertex colors is import failing in 6.10.1, errors about colors

Open FnSolo opened this issue 10 months ago • 10 comments

Describe the bug Classic "import failed", something about the colors and converting "To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job."

Files I bet it doesn't pass the glTFast validator (btw where is it?), but staff told me to make issue. so i did. Here is the .glb model that import failed (it is non-commercial): Train_Passenger_Wagon.zip

To Reproduce Steps to reproduce the behavior:

  1. OS: Win 10 2004, Shap-E ( https://huggingface.co/spaces/hysts/Shap-E?duplicate=true ) model manually turned into low-poly in Blender by decimating, deleting, filling empty places after that without erasing its vertex colors

  2. Export it to .glb

  3. Move the .glb to Unity assets folder

  4. An older version of glTFast ~december 2024, early January

  5. Update to latest Windows 10 22H2

  6. Make a revert to backup with assets only folder (no git, only "Assets/") into new empty project with latest glTFast (6.10.1)

  7. See error

Extra: OS versions probably have nothing to do with it, just for detail.

Expected behavior It continues working as expected, or at least lets me fix issue with (vertex colors)?

Screenshots It is pretty straight "Import failed" with blank white file, except the glTFast in inspector still working and able to "Print to console", no sense in screenshots, applied logs below

Desktop:

  • glTFast version: 6.10.1
  • Unity Editor version: 6000.0.25f1
  • Render Pipeline and version: URP 17.0.3
  • Platform: Editor

Additional context I haven't tried to just use previous versions of glTFast.

Model contains 2 single color materials, both are used.

My assumption why this happens in newer version (probably not, as both math-s and coll-s packages inside project are latest): " "### Changed"

  • Downgraded package dependencies to version bundled with Editor.
    • com.unity.collections to version 1.2.4 (from 1.5.1)
    • com.unity.mathematics to version 1.2.6 (from 1.3.1) "

Here is the Errors on import: Errors, something about colors:

// Here is first error: //

InvalidOperationException: The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job. Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at :0) Unity.Jobs.IJobParallelForExtensions.Schedule[T] (T jobData, System.Int32 arrayLength, System.Int32 innerloopBatchCount, Unity.Jobs.JobHandle dependsOn) (at :0) GLTFast.VertexBufferColors.GetColors32Job (System.Void* input, GLTFast.Schema.GltfComponentType inputType, GLTFast.Schema.GltfAccessorAttributeType attributeType, System.Int32 inputByteStride, Unity.Collections.NativeSlice1[T] output) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:155) GLTFast.VertexBufferColors.ScheduleVertexColorJob (System.Int32 colorAccessorIndex, System.Int32 offset, Unity.Collections.NativeSlice1[T] handles, GLTFast.IGltfBuffers buffers) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:46) GLTFast.VertexBufferGenerator1[TMainBuffer].ScheduleColorsJobs (GLTFast.Schema.Attributes att, System.Int32 i, Unity.Collections.NativeArray1[T] handles, System.Int32& handleIndex) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:356) GLTFast.VertexBufferGenerator1[TMainBuffer].CreateVertexBuffer () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:189) GLTFast.MeshGenerator.GenerateMesh (GLTFast.GltfImportBase gltfImport) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGenerator.cs:189) Rethrow as AggregateException: One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.) System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].get_Result () (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) GLTFast.MeshGeneratorBase.CreateMeshResult () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGeneratorBase.cs:40) GLTFast.GltfImportBase.CreateAllMeshAssignments () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2327) GLTFast.GltfImportBase.Prepare () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2140) GLTFast.GltfImportBase.LoadFromUri (System.Uri url, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:1177) GLTFast.GltfImportBase.Load (System.Uri url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:427) GLTFast.GltfImportBase.Load (System.String url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:409) GLTFast.Utils.AsyncHelpers+<>c__DisplayClass1_01[T].b__0 (System.Object _) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:66) Rethrow as AggregateException: AsyncHelpers.Run method threw an exception. (One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.)) GLTFast.Utils.AsyncHelpers+ExclusiveSynchronizationContext.BeginMessageLoop () (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:122) GLTFast.Utils.AsyncHelpers.RunSync[T] (System.Func`1[TResult] task) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:73) GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/GltfImporter.cs:118) UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <9e3a60dbcacc4e77a9c6e1c14064183a>:0)

// Here is the second: //

Asset import failed, “Assets/D_Models/Train_Passenger_Wagon.glb” > InvalidOperationException: The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job. Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at :0) Unity.Jobs.IJobParallelForExtensions.Schedule[T] (T jobData, System.Int32 arrayLength, System.Int32 innerloopBatchCount, Unity.Jobs.JobHandle dependsOn) (at :0) GLTFast.VertexBufferColors.GetColors32Job (System.Void* input, GLTFast.Schema.GltfComponentType inputType, GLTFast.Schema.GltfAccessorAttributeType attributeType, System.Int32 inputByteStride, Unity.Collections.NativeSlice1[T] output) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:155) GLTFast.VertexBufferColors.ScheduleVertexColorJob (System.Int32 colorAccessorIndex, System.Int32 offset, Unity.Collections.NativeSlice1[T] handles, GLTFast.IGltfBuffers buffers) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:46) GLTFast.VertexBufferGenerator1[TMainBuffer].ScheduleColorsJobs (GLTFast.Schema.Attributes att, System.Int32 i, Unity.Collections.NativeArray1[T] handles, System.Int32& handleIndex) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:356) GLTFast.VertexBufferGenerator1[TMainBuffer].CreateVertexBuffer () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:189) GLTFast.MeshGenerator.GenerateMesh (GLTFast.GltfImportBase gltfImport) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGenerator.cs:189) Rethrow as AggregateException: One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.) System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].get_Result () (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) GLTFast.MeshGeneratorBase.CreateMeshResult () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGeneratorBase.cs:40) GLTFast.GltfImportBase.CreateAllMeshAssignments () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2327) GLTFast.GltfImportBase.Prepare () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2140) GLTFast.GltfImportBase.LoadFromUri (System.Uri url, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:1177) GLTFast.GltfImportBase.Load (System.Uri url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:427) GLTFast.GltfImportBase.Load (System.String url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:409) GLTFast.Utils.AsyncHelpers+<>c__DisplayClass1_01[T].b__0 (System.Object _) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:66) Rethrow as AggregateException: AsyncHelpers.Run method threw an exception. (One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.)) GLTFast.Utils.AsyncHelpers+ExclusiveSynchronizationContext.BeginMessageLoop () (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:122) GLTFast.Utils.AsyncHelpers.RunSync[T] (System.Func`1[TResult] task) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:73) GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/GltfImporter.cs:118) UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <9e3a60dbcacc4e77a9c6e1c14064183a>:0)

===== Here is the "Print to console" error, just in case if its not the same as import ones:

Asset import failed, "Assets/Tets/Train_Passenger_Wagon.glb" > InvalidOperationException: The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job. Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at :0) Unity.Jobs.IJobParallelForExtensions.Schedule[T] (T jobData, System.Int32 arrayLength, System.Int32 innerloopBatchCount, Unity.Jobs.JobHandle dependsOn) (at :0) GLTFast.VertexBufferColors.GetColors32Job (System.Void* input, GLTFast.Schema.GltfComponentType inputType, GLTFast.Schema.GltfAccessorAttributeType attributeType, System.Int32 inputByteStride, Unity.Collections.NativeSlice1[T] output) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:155) GLTFast.VertexBufferColors.ScheduleVertexColorJob (System.Int32 colorAccessorIndex, System.Int32 offset, Unity.Collections.NativeSlice1[T] handles, GLTFast.IGltfBuffers buffers) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferColors.cs:46) GLTFast.VertexBufferGenerator1[TMainBuffer].ScheduleColorsJobs (GLTFast.Schema.Attributes att, System.Int32 i, Unity.Collections.NativeArray1[T] handles, System.Int32& handleIndex) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:356) GLTFast.VertexBufferGenerator1[TMainBuffer].CreateVertexBuffer () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/VertexBufferGenerator.cs:189) GLTFast.MeshGenerator.GenerateMesh (GLTFast.GltfImportBase gltfImport) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGenerator.cs:189) Rethrow as AggregateException: One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.) System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) System.Threading.Tasks.Task1[TResult].get_Result () (at <321eb2db7c6d43ea8fc39b54eaca3452>:0) GLTFast.MeshGeneratorBase.CreateMeshResult () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/MeshGeneratorBase.cs:40) GLTFast.GltfImportBase.CreateAllMeshAssignments () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2327) GLTFast.GltfImportBase.Prepare () (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:2140) GLTFast.GltfImportBase.LoadFromUri (System.Uri url, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:1177) GLTFast.GltfImportBase.Load (System.Uri url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:427) GLTFast.GltfImportBase.Load (System.String url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast/Runtime/Scripts/GltfImport.cs:409) GLTFast.Utils.AsyncHelpers+<>c__DisplayClass1_01[T].<RunSync>b__0 (System.Object _) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:66) Rethrow as AggregateException: AsyncHelpers.Run method threw an exception. (One or more errors occurred. (The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job.)) GLTFast.Utils.AsyncHelpers+ExclusiveSynchronizationContext.BeginMessageLoop () (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:122) GLTFast.Utils.AsyncHelpers.RunSync[T] (System.Func`1[TResult] task) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/AsyncHelpers.cs:73) GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.cloud.gltfast/Editor/Scripts/GltfImporter.cs:118) UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <9e3a60dbcacc4e77a9c6e1c14064183a>:0) UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

(Filename: C:\build\output\unity\unity\Modules\AssetPipelineEditor\Public\ScriptedImporter.cpp Line: 216)

FnSolo avatar Feb 05 '25 19:02 FnSolo

Same issue, InvalidOperationException: The previously scheduled job ConvertColorsRgbaUInt8ToRGBAFloatJob writes to the Unity.Collections.NativeArray`1[Unity.Mathematics.float4] ConvertColorsRgbaUInt8ToRGBAFloatJob.result. You are trying to schedule a new job ConvertColorsRgbaUInt8ToRGBAFloatJob, which writes to the same Unity.Collections.NativeArray`1[Unity.Mathematics.float4] (via ConvertColorsRgbaUInt8ToRGBAFloatJob.result). To guarantee safety, you must include ConvertColorsRgbaUInt8ToRGBAFloatJob as a dependency of the newly scheduled job. Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at <6f7018b8b8c149e68c4a65a05ac289be>:0)

Looks like its coming from GLTFast.VertexBufferColors.GetColors32Job (System.Void* input, GLTFast.Schema.GltfComponentType inputType, GLTFast.Schema.GltfAccessorAttributeType attributeType, System.Int32 inputByteStride, Unity.Collections.NativeSlice`1[T] output) (at ./Library/PackageCache/[email protected]/Runtime/Scripts/VertexBufferColors.cs:155)

Unity 2022.3.20f1 GLTFast 6.10.1 Draco 5.1.4

Unable to supply 3D model due to NDA concerns, apologies

pcareyASM avatar Feb 11 '25 00:02 pcareyASM

Removing baked vertex colors leaves me with: InvalidOperationException: The previously scheduled job SortAndNormalizeBoneWeightsJob writes to the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] SortAndNormalizeBoneWeightsJob.bones. You must call JobHandle.Complete() on the job SortAndNormalizeBoneWeightsJob, before you can read from the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] safely. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <6f7018b8b8c149e68c4a65a05ac289be>:0) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <6f7018b8b8c149e68c4a65a05ac289be>:0) Unity.Collections.LowLevel.Unsafe.NativeArrayUnsafeUtility.GetUnsafeReadOnlyPtr[T] (Unity.Collections.NativeArray`1[T] nativeArray) (at <6f7018b8b8c149e68c4a65a05ac289be>:0) GLTFast.VertexBufferBones.ScheduleVertexBonesJob (System.Int32 weightsAccessorIndex, System.Int32 jointsAccessorIndex, System.Int32 offset, GLTFast.IGltfBuffers buffers) (at ./Library/PackageCache/[email protected]/Runtime/Scripts/VertexBufferBones.cs:47)

Im pretty sure we need bone weights, so this isnt great :D

pcareyASM avatar Feb 11 '25 01:02 pcareyASM

@pcareyASM

Well. this is sad, not even erasing vertex colors fix stuff it seems. Have you tried reverting to glTFast version before the update with making different materialed stuff submeshes instead of separating them to different meshes right inside .glb?

(Btw, yeah, one of my models bugged because there is a submesh system now in inspector, but that was an easy fix, just copied World Transform from older, then pasted to newer and deleted older, oh, seems like now if i revert the glTFast version now this model will break? Lol.)

FnSolo avatar Feb 13 '25 16:02 FnSolo

We actually switched to this version because we needed the material submesh changes 😂 Our plugin is engine-agnostic, so we needed to get parity with how UE applies materials on their version of gltfast.

For more info, we've found that erasing vertex colors allows us to import at runtime, which suits our usecase. So likely the SortAndNormalizeBoneWeightsJob error is in the editor only area.

pcareyASM avatar Feb 14 '25 03:02 pcareyASM

@pcareyASM so if i import this kind of .glb blank file:

(just example of the icon, when it doesn't work, but inspector on the right still see it as .glb, but an empty one) Image

, but in runtime like from some script instead of in the editor drag into the Assets folder from any Windows folder it will work?

(If it really is, then we really do live in a society, lol.).

Or the runtime import just still works like there is still no submesh system and i can see each material as separate GameObject with its mesh, hm?

FnSolo avatar Feb 15 '25 10:02 FnSolo

Thanks for reporting.

I can confirm the issue. It's related to vertex colors on meshes with multiple primitives. It might be a regression introduced in 6.10.0, which was the first with improved submesh support. Feel free to try glTFast 6.9.0 as a workaround.

atteneder avatar Mar 14 '25 13:03 atteneder

@atteneder Do you have any timeline on when this might be addressed? We require 6.10 as we need the submesh fix (#153).

Right now we're simply restricting users from using models containing vertex information, which isnt great!

pcareyASM avatar Mar 24 '25 01:03 pcareyASM

Sure. The fix landed in our development branch on Friday, which means it didn't make it into 6.11.0 which is expected to ship today. It'll land in 6.11.1 which is expected to ship in about a week or two.

Again, thanks for your contribution and patience.

atteneder avatar Mar 24 '25 09:03 atteneder

Thats great to know, appreciate the information and the work put in!

pcareyASM avatar Mar 24 '25 23:03 pcareyASM

~~Non normalized vertex weights hits the error here in general, the easy solution is to normalize weights before exporting (at least in blender) so it doesnt trigger SortAndNormalizeBoneWeightsJob~~ This applies to all armature as far as i can tell, anything past 6.10 as stated above. I'm going to stay on 6.9.1 for now.

mriise avatar Apr 30 '25 03:04 mriise