Skip to content
Snippets Groups Projects
Commit 4c1df0f5 authored by Julien Duroure's avatar Julien Duroure
Browse files

glTF exporter: Fix transmission export

parent 564fdcdf
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 2, 17),
"version": (3, 2, 18),
'blender': (3, 1, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
......
......@@ -248,9 +248,10 @@ def __gather_extensions(blender_material, export_settings):
# KHR_materials_transmission
transmission_extension = __gather_transmission_extension(blender_material, export_settings)
transmission_extension, use_actives_uvmap_transmission = __gather_transmission_extension(blender_material, export_settings)
if transmission_extension:
extensions["KHR_materials_transmission"] = transmission_extension
actives_uvmaps.extend(use_actives_uvmap_transmission)
return extensions, actives_uvmaps if extensions else None
......@@ -429,17 +430,19 @@ def __gather_transmission_extension(blender_material, export_settings):
transmission_extension['transmissionFactor'] = transmission_socket.default_value
transmission_enabled = transmission_extension['transmissionFactor'] > 0
elif __has_image_node_from_socket(transmission_socket):
transmission_extension['transmissionFactor'] = 1
transmission_extension['transmissionFactor'] = 1.0
has_transmission_texture = True
transmission_enabled = True
if not transmission_enabled:
return None
return None, None
# Pack transmission channel (R).
if has_transmission_texture:
transmission_slots = (transmission_socket,)
use_actives_uvmaps = []
if len(transmission_slots) > 0:
combined_texture, use_active_uvmap = gltf2_blender_gather_texture_info.gather_texture_info(
transmission_socket,
......@@ -448,8 +451,10 @@ def __gather_transmission_extension(blender_material, export_settings):
)
if has_transmission_texture:
transmission_extension['transmissionTexture'] = combined_texture
if use_active_uvmap:
use_actives_uvmaps.append("transmissionTexture")
return Extension('KHR_materials_transmission', transmission_extension, False), ["transmissionTexture"] if use_active_uvmap else []
return Extension('KHR_materials_transmission', transmission_extension, False), use_actives_uvmaps
def __gather_material_unlit(blender_material, active_uvmap_index, export_settings):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment