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 importer fails on Draco-compressed 2CylinderEngine.gltf from Khronos samples #47822

Closed
akien-mga opened this issue Apr 12, 2021 · 10 comments · Fixed by #56613
Closed

glTF importer fails on Draco-compressed 2CylinderEngine.gltf from Khronos samples #47822

akien-mga opened this issue Apr 12, 2021 · 10 comments · Fixed by #56613

Comments

@akien-mga
Copy link
Member

Godot version:
3.3 RC 8

OS/device including version:
Linux

Issue description:
The Draco-compressed glTF model 2CylinderEngine from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/2CylinderEngine/glTF-Draco fails to import in Godot 3.3 RC 8.

Several errors are reported about issues with the buffer data, and while the imported scene can be opened, it's completely broken.

Example of error:

ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.

It might be that we don't support Draco-compressed glTF files, but if so we need to handle them gracefully by detecting the compression and prevent the engine from trying to import them.

Full log output from an import in 3.3 RC 8 with --verbose:

Verbose log output
Godot Engine v3.3.rc8.official - https://godotengine.org
XInput: Refreshing devices.
XInput: Using touch device: Virtual core pointer
Using GLES3 video driver
OpenGL ES 3.0 Renderer: AMD VEGAM (DRM 3.40.0, 5.11.13-desktop-2.mga9, LLVM 12.0.0)
OpenGL ES Batching: ON
	OPTIONS
	max_join_item_commands 16
	colored_vertex_format_threshold 0.25
	batch_buffer_size 16384
	light_scissor_area_threshold 1
	item_reordering_lookahead 4
	light_max_join_items 32
	single_rect_fallback False
	debug_flash False
	diagnose_frame False
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
JoypadLinux: udev enabled and loaded successfully.
 
CORE API HASH: 11994854998653459370
EDITOR API HASH: 10256337835298950166
Construct gdnative interface

Destruct gdnative interface

Class 'BulletPhysicsDirectBodyState' is not exposed, skipping.
Class 'BulletPhysicsDirectSpaceState' is not exposed, skipping.
Class 'BulletPhysicsServer' is not exposed, skipping.
Class 'GDScriptNativeClass' is not exposed, skipping.
Class 'IP_Unix' is not exposed, skipping.
Class 'InputDefault' is not exposed, skipping.
Class 'Physics2DDirectBodyStateSW' is not exposed, skipping.
Class 'Physics2DDirectSpaceStateSW' is not exposed, skipping.
Class 'Physics2DServerSW' is not exposed, skipping.
Class 'ResourceImporterMP3' is not exposed, skipping.
Class 'ResourceImporterOGGVorbis' is not exposed, skipping.
Loading resource: /home/akien/.config/godot/editor_settings-3.tres
EditorSettings: Load OK!
Loaded builtin certs
EditorSettings: Save OK!
glTF: Importing file res://2CylinderEngine/glTF-Draco/2CylinderEngine.gltf as scene.
glTF: Total buffers: 1
glTF: Total buffer views: 34
glTF: Total accessors: 102
glTF: Total materials: 34
glTF: Parsing mesh: 0
glTF: type vec3 component type: Float stride: 12 amount 2019
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 2019
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 8250
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1296
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1296
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 5034
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 1
glTF: type vec3 component type: Float stride: 12 amount 264
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 264
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 792
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 2
glTF: type vec3 component type: Float stride: 12 amount 670
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 670
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 1530
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 3
glTF: type vec3 component type: Float stride: 12 amount 1553
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1553
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 5640
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 4
glTF: type vec3 component type: Float stride: 12 amount 2470
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: FloatERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
 stride: 12 amount 2470
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 7716
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 5
glTF: type vec3 component type: Float stride: 12 amount 1382
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1382
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 4098
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 6
glTF: type vec3 component type: Float stride: 12 amount 43
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 43
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 123
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 43
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 43
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 123
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 870
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 870
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 4842
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 7
glTF: type vec3 component type: Float stride: 12 amount 294
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 294
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 870
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 8
glTF: type vec3 component type: Float stride: 12 amount 624
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 624
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 1860
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 9
glTF: type vec3 component type: Float stride: 12 amount 408
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 408
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 1140
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 10
glTF: type vec3 component type: Float stride: 12 amount 340
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 340
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 972
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 11
glTF: type vec3 component type: Float stride: 12 amount 324
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 324
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 924
glTF: accessor offset0 view offset: 0 total buffer len: 155392 viewERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
 len 7048
glTF: Parsing mesh: 12
glTF: type vec3 component type: Float stride: 12 amount 96
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 96
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 276
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 13
glTF: type vec3 component type: Float stride: 12 amount 348
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 348
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 1044
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 14
glTF: type vec3 component type: Float stride: 12 amount 1413
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1413
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 4956
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 15
glTF: type vec3 component type: Float stride: 12 amount 1942
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1942
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 8016
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 16
glTF: type vec3 component type: Float stride: 12 amount 1755
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1755
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 9060
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 17
glTF: type vec3 component type: Float stride: 12 amount 1750
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1750
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 9036
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 18
glTF: type vec3 component type: Float stride: 12 amount 5481
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 5481
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 17556
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 19
glTF: type vec3 component type: Float stride: 12 amount 372
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 372
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 1080
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 20
glTF: type vec3 component type: Float stride: 12 amount 240
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 240
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 672
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 21
glTF: type vec3 component type: Float stride: 12 amount 1417
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view lenERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: _decode_buffer_view: Condition "buffer_end > bv.byte_length" is true. Returned: ERR_PARSE_ERROR
   At: editor/import/editor_scene_importer_gltf.cpp:625.
ERROR: mesh_add_surface_from_arrays: Condition "array_len == 0" is true.
   At: servers/visual_server.cpp:965.
ERROR: add_surface_from_arrays: Condition "len == 0" is true.
   At: scene/resources/mesh.cpp:851.
ERROR: surface_set_material: Index p_idx = -1 is out of bounds (surfaces.size() = 0).
   At: scene/resources/mesh.cpp:977.
 7048
glTF: type vec3 component type: Float stride: 12 amount 1417
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 4974
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 22
glTF: type vec3 component type: Float stride: 12 amount 5370
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 5370
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 17094
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 23
glTF: type vec3 component type: Float stride: 12 amount 192
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 192
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 564
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 24
glTF: type vec3 component type: Float stride: 12 amount 8618
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 8618
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 27684
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 25
glTF: type vec3 component type: Float stride: 12 amount 8618
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 8618
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 27684
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 26
glTF: type vec3 component type: Float stride: 12 amount 3677
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 3677
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 14874
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 27
glTF: type vec3 component type: Float stride: 12 amount 1289
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 1289
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 3903
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 180
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 180
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 960
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Parsing mesh: 28
glTF: type vec3 component type: Float stride: 12 amount 143
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 143
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 423
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 386
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type vec3 component type: Float stride: 12 amount 386
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: type float component type: UShort stride: 2 amount 2163
glTF: accessor offset0 view offset: 0 total buffer len: 155392 view len 7048
glTF: Total meshes: 29
glTF: Total cameras: 1
glTF: Creating spatial for: Node
glTF: Creating mesh for: Mesh67
glTF: Creating mesh for: Mesh66
glTF: Creating mesh for: Mesh65
glTF: Creating mesh for: Mesh64
glTF: Creating mesh for: Mesh63
glTF: Creating mesh for: Mesh62
glTF: Creating mesh for: Mesh61
glTF: Creating mesh for: Mesh60
glTF: Creating spatial for: Node6
glTF: Creating mesh for: Mesh59
glTF: Creating mesh for: Mesh58
glTF: Creating mesh for: Mesh57
glTF: Creating mesh for: Mesh56
glTF: Creating mesh for: Mesh55
glTF: Creating mesh for: Mesh54
glTF: Creating mesh for: Mesh53
glTF: Creating mesh for: Mesh52
glTF: Creating spatial for: Node7
glTF: Creating mesh for: Mesh51
glTF: Creating mesh for: Mesh50
glTF: Creating mesh for: Mesh49
glTF: Creating mesh for: Mesh48
glTF: Creating mesh for: Mesh47
glTF: Creating mesh for: Mesh46
glTF: Creating mesh for: Mesh45
glTF: Creating mesh for: Mesh44
glTF: Creating mesh for: Mesh43
glTF: Creating spatial for: Node12
glTF: Creating mesh for: Mesh42
glTF: Creating mesh for: Mesh41
glTF: Creating spatial for: Node14
glTF: Creating mesh for: Mesh40
glTF: Creating mesh for: Mesh39
glTF: Creating mesh for: Mesh38
glTF: Creating mesh for: Mesh37
glTF: Creating spatial for: Node13
glTF: Creating mesh for: Mesh36
glTF: Creating mesh for: Mesh35
glTF: Creating mesh for: Mesh34
glTF: Creating mesh for: Mesh33
glTF: Creating spatial for: Node10
glTF: Creating mesh for: Mesh32
glTF: Creating mesh for: Mesh31
glTF: Creating spatial for: Node11
glTF: Creating mesh for: Mesh30
glTF: Creating mesh for: Mesh29
glTF: Creating mesh for: Mesh28
glTF: Creating mesh for: Mesh27
glTF: Creating mesh for: Mesh26
glTF: Creating mesh for: Mesh25
glTF: Creating mesh for: Mesh24
glTF: Creating mesh for: Mesh23
glTF: Creating mesh for: Mesh22
glTF: Creating mesh for: Mesh21
glTF: Creating spatial for: Node8
glTF: Creating mesh for: Mesh20
glTF: Creating mesh for: Mesh19
glTF: Creating spatial for: Node9
glTF: Creating mesh for: Mesh18
glTF: Creating mesh for: Mesh17
glTF: Creating mesh for: Mesh16
glTF: Creating mesh for: Mesh15
glTF: Creating mesh for: Mesh14
glTF: Creating mesh for: Mesh13
glTF: Creating mesh for: Mesh12
glTF: Creating mesh for: Mesh11
glTF: Creating mesh for: Mesh10
glTF: Creating mesh for: Mesh9
glTF: Creating spatial for: Node5
glTF: Creating mesh for: Mesh8
glTF: Creating mesh for: Mesh7
glTF: Creating spatial for: Node4
glTF: Creating mesh for: Mesh6
glTF: Creating mesh for: Mesh5
glTF: Creating spatial for: Node3
glTF: Creating mesh for: Mesh4
glTF: Creating mesh for: Mesh3
glTF: Creating spatial for: Node2
glTF: Creating mesh for: Mesh2
glTF: Creating mesh for: Mesh
glTF: Creating camera for: Camera
Loading resource: res://2CylinderEngine/glTF-Draco/Material_16.material
Loading resource: res://2CylinderEngine/glTF-Draco/Material_17.material
Loading resource: res://2CylinderEngine/glTF-Draco/Material_18.material
Loading resource: res://2CylinderEngine/glTF-Draco/Material_20.material
Loading resource: res://2CylinderEngine/glTF-Draco/Material_22.material
Loading resource: res://2CylinderEngine/glTF-Draco/Material_23.material
Saving scene to: res://.import/2CylinderEngine.gltf-e24711c3fb53889f6c46d21a2534fb5a.scn
Loading resource: res://Node2D.tscn
EditorSettings: Save OK!

I also tested in the master branch, and the same errors seem to be raised (so it wasn't fixed by #34193), and the new meshoptimizer code actually asserts on that scene:

godot-git: thirdparty/meshoptimizer/simplifier.cpp:62: void meshopt::updateEdgeAdjacency(meshopt::EdgeAdjacency&, const unsigned int*, size_t, size_t, const unsigned int*): Assertion `v < vertex_count' failed.

Steps to reproduce:

  • Open attached MRP with 2CylinderEngine.gltf from the glTF-Draco folder.

Minimal reproduction project:
gltf-draco-2cylinderengine-bug.zip

@akien-mga
Copy link
Member Author

akien-mga commented Apr 12, 2021

Testing with some more models from glTF-Sample-Models, Avocado's Draco-compressed version also seems not to import properly. It doesn't generate any errors though, but it looks like this:

Screenshot_20210412_114239

To compare with the glTF-Binary version:
Screenshot_20210412_114303

Similar issue with BarramundiFish. it's probably the same for all Draco-compressed models.

BrainStem's Draco version is another example of a scene which prints a number of errors when being imported (like 2CylinderEngine).

@fire
Copy link
Member

fire commented Apr 12, 2021

Draco is an extension so there's a string that say it is used per file in the json.

@lyuma
Copy link
Contributor

lyuma commented May 23, 2021

On master branch, 45d3b96 after the new meshoptimizer was merged, this is now a crash (well, assertion failure crash):

ERROR: Condition "vertex_count == 0" is true.
   at: EditorSceneImporterMesh::add_surface (editor\import\scene_importer_mesh.cpp:68)
ERROR: Condition "buffer_end > bv->byte_length" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_decode_buffer_view (modules\gltf\gltf_document.cpp:1304)
ERROR: Condition "buffer_end > bv->byte_length" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_decode_buffer_view (modules\gltf\gltf_document.cpp:1304)
ERROR: Condition "buffer_end > bv->byte_length" is true. Returning: ERR_PARSE_ERROR
   at: GLTFDocument::_decode_buffer_view (modules\gltf\gltf_document.cpp:1304)
ERROR: Condition "vertex_count == 0" is true.
   at: EditorSceneImporterMesh::add_surface (editor\import\scene_importer_mesh.cpp:68)
ERROR: Condition "surfaces.size() == 0" is true. Returning: Ref<ArrayMesh>()
   at: EditorSceneImporterMesh::get_mesh (editor\import\scene_importer_mesh.cpp:247)
ERROR: Condition "surfaces.size() == 0" is true. Returning: Ref<ArrayMesh>()
   at: EditorSceneImporterMesh::get_mesh (editor\import\scene_importer_mesh.cpp:247)
ERROR: Condition "surfaces.size() == 0" is true. Returning: Ref<ArrayMesh>()
   at: EditorSceneImporterMesh::get_mesh (editor\import\scene_importer_mesh.cpp:247)
ERROR: Condition "surfaces.size() == 0" is true. Returning: Ref<ArrayMesh>()
   at: EditorSceneImporterMesh::get_mesh (editor\import\scene_importer_mesh.cpp:247)
Assertion failed: v < vertex_count, file thirdparty\meshoptimizer\simplifier.cpp, line 64
[1]+  Exit 127                /s/godot/bin/godot.windows.opt.tools.64.exe -e -w
$

Reproduction project:
MeshOptimizerCrash.zip

I propose that the assertion failures be removed from meshoptimizer and replaced with a ERR_FAIL type macro.

Again, the crash here only affects master branch. This is not a crash on godot 3.x

@fire
Copy link
Member

fire commented May 23, 2021

An alternative would be to validate all the inputs of:

meshopt_simplify

void EditorSceneImporterMesh::generate_lods()

The loop can continue when vertex_count is zero.

@Calinou
Copy link
Member

Calinou commented Jun 24, 2021

I can confirm that a glTF 2.0 file exported from Blender 2.93 with compression enabled (in the export dialog's Geometry section) fails to load correctly in 3.3.2.

@fire
Copy link
Member

fire commented Jun 25, 2021

Fix plan order:

  1. Don't support Draco-compressed glTF files by detecting its extension and blocking it.
  2. (optional) Support Draco

@fire
Copy link
Member

fire commented Jul 30, 2021

Initial design.

If godot doesn't know about the required extension then it aborts the load.

@Calinou
Copy link
Member

Calinou commented Jul 30, 2021

How much work would it be to integrate support for Draco compression in our glTF importer?

Also, is there an external tool that can be used to decompress Draco-compressed glTF files into uncompressed glTF files? This is useful when downloading third-party glTF files you don't have the source of.

@scurest
Copy link
Contributor

scurest commented Jul 30, 2021

Also, is there an external tool that can be used to decompress Draco-compressed glTF files into uncompressed glTF files?

glTF-Tranform, see KhronosGroup/glTF-Blender-IO#252 (comment).

@fire
Copy link
Member

fire commented Oct 16, 2021

Can confirm this is still valid on the nearest build to my custom build.

96410f5

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

Successfully merging a pull request may close this issue.

5 participants