From 253ebbbc8f0cceb7faa993d30498082d23f00b68 Mon Sep 17 00:00:00 2001 From: knn217 Date: Wed, 8 Nov 2023 18:53:01 +0700 Subject: [PATCH] Added support for standalone metalness and roughness textures Users now have another option to plug metalness and roughness textures into the corresponding channels, aside from using the same texture and separate RGB --- io_ogre/ogre/materialv2json.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/io_ogre/ogre/materialv2json.py b/io_ogre/ogre/materialv2json.py index a1159cd..f12f1e6 100644 --- a/io_ogre/ogre/materialv2json.py +++ b/io_ogre/ogre/materialv2json.py @@ -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] @@ -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")