Skip to content

Commit

Permalink
Added support for standalone metalness and roughness textures
Browse files Browse the repository at this point in the history
Users now have another option to plug metalness and roughness textures into the corresponding channels, aside from using the same texture and separate RGB
  • Loading branch information
knn217 committed Nov 8, 2023
1 parent cdc9d06 commit 253ebbb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions io_ogre/ogre/materialv2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ def generate_pbs_datablock(self, material):
}
if tex_filename:
datablock["metalness"]["texture"] = os.path.split(tex_filename)[-1]
datablock["metalness"]["value"] = 0.818 # default mtallic value according to the docs
else: # Support for standalone metallic texture
tex_filename = self.prepare_texture(bsdf.metallic_texture)[0]
if tex_filename:
datablock["metalness"]["texture"] = os.path.split(tex_filename)[-1]
datablock["metalness"]["value"] = 0.818

# Set up normalmap parameters, only if texture is present
tex_filename = self.prepare_texture(bsdf.normalmap_texture)[0]
Expand All @@ -206,6 +212,12 @@ def generate_pbs_datablock(self, material):
}
if tex_filename:
datablock["roughness"]["texture"] = os.path.split(tex_filename)[-1]
datablock["roughness"]["value"] = 1.0 # default roughness value according to the docs
else: # Support for standalone roughness texture
tex_filename = self.prepare_texture(bsdf.roughness_texture)[0]
if tex_filename:
datablock["roughness"]["texture"] = os.path.split(tex_filename)[-1]
datablock["roughness"]["value"] = 1.0

# Set up specular parameters
logger.debug("Specular params")
Expand Down

0 comments on commit 253ebbb

Please sign in to comment.