KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.48k stars 316 forks source link

Error exporting with Draco #1423

Open h7seiji opened 3 years ago

h7seiji commented 3 years ago

Describe the bug I have an object that I'm trying to export with Draco compression, but I get an error when using compression. When the compression is disabled the export runs fine. It might also be related to the UV, since not exporting the UV also exports fine, even with compression. I'm only having problems with this specific object. The object is in the blend file attached below.

To Reproduce Steps to reproduce the behavior:

  1. Export gltf
  2. Enable UVs and Compression
  3. Run Export
  4. See error

Error log

  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\__init__.py", line 626, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 46, in save
    json, buffer = __export(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 63, in __export
    __gather_gltf(exporter, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 78, in __gather_gltf
    gltf2_io_draco_compression_extension.encode_scene_primitives(scenes, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_draco_compression_extension.py", line 71, in encode_scene_primitives
    __traverse_node(node, lambda node: __encode_node(node, dll, export_settings, encoded_primitives_cache))
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_draco_compression_extension.py", line 95, in __traverse_node
    f(node)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_draco_compression_extension.py", line 71, in <lambda>
    __traverse_node(node, lambda node: __encode_node(node, dll, export_settings, encoded_primitives_cache))
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_draco_compression_extension.py", line 105, in __encode_node
    __encode_primitive(primitive, dll, export_settings, encoded_primitives_cache)
  File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_draco_compression_extension.py", line 153, in __encode_primitive
    if not dll.encoderEncode(encoder, preserve_triangle_order):
OSError: exception: access violation writing 0x0000000000000000

.blend file/ .gltf draco-error.zip

Version

julienduroure commented 3 years ago

Confirmed @McNopper @UX3D-nopper Can someone of your team can have a lot on it?

UX3D-nopper commented 3 years ago

Sure :-)

ghost commented 3 years ago

This is a bug in Draco. When encoding the model using the tool in the official Draco repository, it also crashes.

There is already an open issue: https://github.com/google/draco/issues/669

Upon fixing this bug the Draco source files in the Blender repository needs to be updated by opening a new Blender differential. I presume that neither the glTF-Blender-IO addon nor the "bridge" code need to be updated.

julienduroure commented 2 years ago

Seems https://github.com/google/draco/issues/669 is now solved. We need to test again, and if issue is solved, create a diff in dev

ghost commented 2 years ago

There is a Blender diff open at D15233 which updates the integrated Draco sources to 1.5.2.

Unfortunatly, this does not fix exporting this specific asset as Draco still crashes. However, after exporting to an uncompressed glTF and importing back into Blender, you can now export to glTF with Draco compression enabled.

ghost commented 2 years ago

Update: D15233 has been accepted