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

Fix #2435 make sure colors are white if only alpha is used #2438

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Fix #2435 make sure colors are white if only alpha is used
  • Loading branch information
julienduroure committed Dec 11, 2024
commit 88c282ae72e5beaea3bdc7e54ecf4412e0104ecc
11 changes: 11 additions & 0 deletions addons/io_scene_gltf2/blender/exp/material/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ def __get_image_data_mapping(sockets, results, use_tile, export_settings) -> Exp
composed_image.fill_white(Channel.G)
elif socket.socket.name == 'Roughness' and not composed_image.is_filled(Channel.B):
composed_image.fill_white(Channel.B)

# Since Alpha is always used together with BaseColor in glTF, make sure
# the other channels are filled.
# All these channels may be overwritten later by BaseColor socket
if socket.socket.name == 'Alpha' and not composed_image.is_filled(Channel.R):
composed_image.fill_white(Channel.R)
if socket.socket.name == 'Alpha' and not composed_image.is_filled(Channel.G):
composed_image.fill_white(Channel.G)
if socket.socket.name == 'Alpha' and not composed_image.is_filled(Channel.B):
composed_image.fill_white(Channel.B)

else:
# copy full image...eventually following sockets might overwrite things
if use_tile is None:
Expand Down
Loading