playcanvas / engine

Powerful web graphics runtime built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.73k stars 1.36k forks source link

GltfExporter - GLB Files Compliance with glTF 2.0 Specifications #7144

Open AlbertoMalavasi opened 2 days ago

AlbertoMalavasi commented 2 days ago

Description

GLB files exported seems not to comply with glTF 2.0 specifications, leading to potential rendering issues. The validator identifies multiple errors related to inconsistent bufferView target assignments and missing skin definitions for skinned meshes. These issues result in an invalid file that may not render correctly or work as intended in standard glTF viewers.

Export Tool: PlayCanvas GltfExporter

File/Example: Link

Validator Tool: KhronosGroup glTF Validator (Version 2.0.0-dev.3.9)

Issue Summary:

Critical Errors: Buffer view target overrides (e.g., IndexBuffer overwritten as Image or VertexBuffer overwritten as IndexBuffer).

Warnings: Missing skin definitions for nodes with skinned meshes.

Info: Unused attributes (TEXCOORD_1) and empty nodes.

Impact: The GLB file seems not to comply with glTF 2.0 specifications, leading to potential rendering issues.

ValidationReport.pdf

mvaligursky commented 2 days ago

related to https://github.com/playcanvas/engine/issues/5001

willeastcott commented 1 day ago

I've fixed the critical buffer view target overrides issue here:

https://github.com/playcanvas/engine/pull/7152

image

willeastcott commented 1 day ago

I've also submitted a PR that optionally strips unused vertex attributes but it defaults to false (since we can't make assumptions about what you plan to do with vertex attributes at runtime - say with a custom shader):

https://github.com/playcanvas/engine/pull/7153

AlbertoMalavasi commented 17 hours ago

Thank you, @willeastcott, for both. We really appreciate your help.