diff --git a/pyrender/material.py b/pyrender/material.py index 3ce9c2d..72ce53b 100644 --- a/pyrender/material.py +++ b/pyrender/material.py @@ -429,6 +429,8 @@ def baseColorTexture(self): @baseColorTexture.setter def baseColorTexture(self, value): + if value and (value.mode == 'LA' or value.mode == "L"): + value = value.convert('RGBA') self._baseColorTexture = self._format_texture(value, 'RGBA') self._tex_flags = None diff --git a/pyrender/utils.py b/pyrender/utils.py index 48a11fa..af8fe26 100644 --- a/pyrender/utils.py +++ b/pyrender/utils.py @@ -67,6 +67,8 @@ def format_texture_source(texture, target_channels='RGB'): texture = np.array(texture * 255.0, dtype=np.uint8) elif np.issubdtype(texture.dtype, np.integer): texture = texture.astype(np.uint8) + elif np.issubdtype(texture.dtype, np.bool_): + texture = texture.astype(np.uint8) * 255 else: raise TypeError('Invalid type {} for texture'.format( type(texture)