Describe the bug
When exporting a file with a model using a principled BSDF material that has a specular value of 0.0 and an IOR of 1.0 a ZeroDivisionError occurs and the export fails.
The stack trace:
Traceback (most recent call last):
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\__init__.py", line 648, in execute
return gltf2_blender_export.save(context, export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 35, in save
json, buffer = __export(export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 52, in __export
__gather_gltf(exporter, export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 66, in __gather_gltf
active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 30, in gather_gltf2
scenes.append(__gather_scene(blender_scene, export_settings))
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
result = func(*args, **kwargs)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 69, in __gather_scene
node = gltf2_blender_gather_nodes.gather_node(
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 35, in gather_node
mesh=__gather_mesh(vnode, blender_object, export_settings),
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 246, in __gather_mesh
result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
result = func(*args, **kwargs)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 61, in gather_mesh
primitives=__gather_primitives(blender_mesh, uuid_for_skined_data, vertex_groups, modifiers, materials, export_settings),
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 147, in __gather_primitives
return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
result = func(*args, **kwargs)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_primitives.py", line 83, in gather_primitives
material = gltf2_blender_gather_materials.gather_material(
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
result = func(*args, **kwargs)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 57, in gather_material
extensions, uvmap_actives_extensions = __gather_extensions(blender_material, emissive_factor, export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 250, in __gather_extensions
specular_extension, use_actives_uvmap_specular = export_specular(blender_material, export_settings)
File "E:\Program Files\Blender Foundation\blender-3.3.1-windows-x64\3.3\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials_specular.py", line 124, in export_specular
specular_color = (1 - transmission) * (1 / f0_from_ior) * 0.08 * specular * tint_strength + transmission * tint_strength
ZeroDivisionError: float division by zero
To Reproduce
Create a file with a model using a principled BSDF material that has a specular value of 0.0 and an IOR of 1.0 and try to export the file.
Expected behavior
The scene successfully exports
Screenshots
If applicable, add screenshots to help explain your problem.
.blend file
Very simple to reproduce but here is one anyway:
export_crash_bug.zip
Describe the bug When exporting a file with a model using a principled BSDF material that has a specular value of 0.0 and an IOR of 1.0 a ZeroDivisionError occurs and the export fails.
The stack trace:
To Reproduce Create a file with a model using a principled BSDF material that has a specular value of 0.0 and an IOR of 1.0 and try to export the file.
Expected behavior The scene successfully exports
Screenshots If applicable, add screenshots to help explain your problem.
.blend file Very simple to reproduce but here is one anyway: export_crash_bug.zip
Version Blender 3.3.1 on Windows