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 #2372 - fix emission export when no factor #2375

Closed
wants to merge 1 commit into from
Closed
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 @@ -91,25 +91,34 @@ def gather_data_sampled_keyframes(
pass # Don't need to do anything, as we are in the range [0,1]

if export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['path'] == "/materials/XXX/extensions/KHR_materials_emissive_strength/emissiveStrength":
# We need to retrieve the emissive factor
factor = get_cache_data(
'value',
blender_id,
export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'],
action_name,
frame,
step,
export_settings
)

factor = [f * value for f in factor]
if any([i>1.0 for i in factor or []]):
# Clamp to range [0,1]
# Official glTF clamp to range [0,1]
# If we are outside, we need to use extension KHR_materials_emissive_strength
value = max(factor)
if export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'] is not None:

# We need to retrieve the emissive factor
factor = get_cache_data(
'value',
blender_id,
export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'],
action_name,
frame,
step,
export_settings
)

factor = [f * value for f in factor]
if any([i>1.0 for i in factor or []]):
# Clamp to range [0,1]
# Official glTF clamp to range [0,1]
# If we are outside, we need to use extension KHR_materials_emissive_strength
value = max(factor)
else:
value = 1.0 # no need to have an emissiveStrength extension for this frame
else:
value = 1.0 # no need to have an emissiveStrength extension for this frame
# No factor exists, so set it as 1.0 / 1.0 / 1.0
# This is because the emission is linked to a texture, without a factor
# No need to change the value
factor = [1.0, 1.0, 1.0]




# For specularFactor and specularColorFactor, we already multiplied it by 2.0, and clamp it to 1.0 (and adapt specularColor accordingly)
Expand Down
Loading