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

Diffuse bsdf export #2449

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
has_image_node_from_socket, \
get_const_from_default_value_socket, \
get_socket, \
get_node_socket, \
get_factor_from_socket, \
gather_alpha_info, \
gather_color_info
Expand Down Expand Up @@ -96,6 +97,8 @@ def __gather_base_color_factor(blender_material, export_settings):
if base_color_socket.socket is None:
base_color_socket = get_socket_from_gltf_material_node(
blender_material.node_tree, blender_material.use_nodes, "BaseColorFactor")
if base_color_socket.socket is None:
base_color_socket = get_node_socket(blender_material.node_tree, bpy.types.ShaderNodeBsdfDiffuse, "Color")
if base_color_socket.socket is not None and isinstance(base_color_socket.socket, bpy.types.NodeSocket):
if export_settings['gltf_image_format'] != "NONE":
rgb_vc_info = gather_color_info(base_color_socket.to_node_nav())
Expand Down Expand Up @@ -144,6 +147,8 @@ def __gather_base_color_texture(blender_material, export_settings):
if base_color_socket.socket is None:
base_color_socket = get_socket_from_gltf_material_node(
blender_material.node_tree, blender_material.use_nodes, "BaseColor")
if base_color_socket.socket is None:
base_color_socket = get_node_socket(blender_material.node_tree, bpy.types.ShaderNodeBsdfDiffuse, "Color")

alpha_socket = get_socket(blender_material.node_tree, blender_material.use_nodes, "Alpha")

Expand Down
6 changes: 3 additions & 3 deletions docs/blender_docs/scene_gltf2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ The material export process handles the settings described below.
Base Color
^^^^^^^^^^

The glTF base color is determined by looking for a Base Color input on a Principled BSDF node.
If the input is unconnected, the input's default color (the color field next to the unconnected socket)
is used as the Base Color for the glTF material.
The glTF base color is determined by looking for a Base Color input on a Principled BSDF node
or a Color input on a Diffuse BSDF node. If the input is unconnected, the input's default color
(the color field next to the unconnected socket) is used as the Base Color for the glTF material.

.. figure:: /images/addons_import-export_scene-gltf2_material-base-color-solid-green.png

Expand Down