Skip to content

Commit

Permalink
Merge pull request #28 from orange3134/fix/emissive
Browse files Browse the repository at this point in the history
Emissionテクスチャが存在する場合に変換が失敗する問題を修正
  • Loading branch information
kazu0617 authored May 30, 2024
2 parents ce1fc6a + 3379a32 commit 4e8ed8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vrmconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def mtoon_to_bsdf():
main_texture = None
normalmap_texture = None
emission_texture = None
emission_strength = 0.0
mtoon = None

for node in nodes:
Expand All @@ -29,6 +30,7 @@ def mtoon_to_bsdf():
emission_texture = node
if node.name == 'Mtoon1Material.Mtoon1Output':
mtoon = node
emission_strength = mtoon.inputs['Emissive Strength'].default_value

if (not main_texture == None and
not mtoon == None):
Expand All @@ -48,7 +50,8 @@ def mtoon_to_bsdf():
links.new(normalmap_texture.outputs['Color'], normal.inputs['Color'])
links.new(normal.outputs['Normal'], bsdf.inputs['Normal'])
if(not emission_texture == None):
links.new(emission_texture.outputs['Color'], bsdf.inputs['Emission'])
links.new(emission_texture.outputs['Color'], bsdf.inputs['Emission Color'])
bsdf.inputs['Emission Strength'].default_value = emission_strength

def remove_trashes():
bpy.ops.object.mode_set(mode='OBJECT')
Expand Down

0 comments on commit 4e8ed8c

Please sign in to comment.