From e49613a5f9c879b1b525e8ac3e3c8af31c3eabcd Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Fri, 19 Apr 2019 23:06:18 +0200 Subject: glTF: better occlusion map management At import, create a node group where you can link an image texture At export, use this node group to create correctly the material TODO: doc update --- io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py') diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index dbee622e..3e905a7d 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -170,10 +170,12 @@ def __get_image_data(sockets_or_slots, export_settings) -> gltf2_blender_image.E composed_image = gltf2_blender_image.ExportImage.white_image(image.width, image.height) # Change target channel for metallic and roughness. - if elem.to_socket.name == 'Metallic': + if socket.name == 'Metallic': composed_image[2] = image[source_channel] - elif elem.to_socket.name == 'Roughness': + elif socket.name == 'Roughness': composed_image[1] = image[source_channel] + elif socket.name == 'Occlusion' and len(sockets_or_slots) > 2: + composed_image[0] = image[source_channel] else: composed_image.update(image) -- cgit v1.2.3