Skip to content

Commit

Permalink
converter: Make sure teture modes are set for all textures
Browse files Browse the repository at this point in the history
  • Loading branch information
Moguri committed Apr 21, 2021
1 parent 60adc10 commit aec6080
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gltf/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ def load_material(self, matid, gltf_mat):
texinfos.append(pbrsettings.get('baseColorTexture', pbr_fallback))
if texinfos[-1]['index'] in self.textures:
self.make_texture_srgb(self.textures[texinfos[-1]['index']])
texinfos[-1]['mode'] = TextureStage.M_modulate

texinfos.append(gltf_mat.get('normalTexture', normal_fallback))
texinfos[-1]['mode'] = TextureStage.M_normal
Expand All @@ -613,6 +614,7 @@ def load_material(self, matid, gltf_mat):
texinfos.append(texinfo)
if matsettings['diffuseTextureSrgb'] and texinfo['index'] in self.textures:
self.make_texture_srgb(self.textures[texinfo['index']])
texinfos[-1]['mode'] = TextureStage.M_modulate
else:
pmat.set_diffuse(LColor(*matsettings['diffuseFactor']))

Expand All @@ -621,6 +623,7 @@ def load_material(self, matid, gltf_mat):
texinfos.append(texinfo)
if matsettings['emissionTextureSrgb'] and texinfo['index'] in self.textures:
self.make_texture_srgb(self.textures[texinfo['index']])
texinfos[-1]['mode'] = TextureStage.M_emission
else:
pmat.set_emission(LColor(*matsettings['emissionFactor']))

Expand All @@ -642,7 +645,7 @@ def load_material(self, matid, gltf_mat):
pmat.set_metallic(pbrsettings.get('metallicFactor', 1.0))
pmat.set_roughness(pbrsettings.get('roughnessFactor', 1.0))
texinfos.append(pbrsettings.get('metallicRoughnessTexture', pbr_fallback))
texinfos[-1]['mode'] = TextureStage.M_selector # Unused, but means FFP and auto shader will ignore
texinfos[-1]['mode'] = TextureStage.M_selector

# Normal map
texinfos.append(gltf_mat.get('normalTexture', normal_fallback))
Expand Down

0 comments on commit aec6080

Please sign in to comment.