Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBRMaterial <-> SimpleMaterial conversion seems to be asymmetric #2284

Open
ankuPRK opened this issue Sep 9, 2024 · 1 comment
Open

PBRMaterial <-> SimpleMaterial conversion seems to be asymmetric #2284

ankuPRK opened this issue Sep 9, 2024 · 1 comment

Comments

@ankuPRK
Copy link
Contributor

ankuPRK commented Sep 9, 2024

Hello,

I see the material conversion from SimpleMaterial to PBRMaterial here, where we convert glossiness into roughness:

def to_pbr(self):
"""
Convert the current simple material to a
PBR material.
Returns
------------
pbr : PBRMaterial
Contains material information in PBR format.
"""
# convert specular exponent to roughness
roughness = (2 / (self.glossiness + 2)) ** (1.0 / 4.0)
return PBRMaterial(
roughnessFactor=roughness,
baseColorTexture=self.image,
baseColorFactor=self.diffuse,
)

But the PBRMaterial to SimpleMaterial conversion here doesn't map roughness -> specular:

def to_simple(self):
"""
Get a copy of the current PBR material as
a simple material.
Returns
------------
simple : SimpleMaterial
Contains material information in a simple manner
"""
return SimpleMaterial(image=self.baseColorTexture, diffuse=self.baseColorFactor)

The conversion formula seems to be reversible. Any insights about why we have this asymmetry would be great.

Thanks!

@mikedh
Copy link
Owner

mikedh commented Sep 9, 2024

Hey yeah agreed that seems like it would be pretty easy and would make sense to be bidirectional, it's just not implemented. PR's with a fix and test would be super welcome!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants