mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3.02k stars 583 forks source link

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

Open ankuPRK opened 2 months ago

ankuPRK commented 2 months ago

Hello,

I see the material conversion from SimpleMaterial to PBRMaterial here, where we convert glossiness into roughness: https://github.com/mikedh/trimesh/blob/634c608f129d15a307557800deaba954f8a30a3e/trimesh/visual/material.py#L198-L215

But the PBRMaterial to SimpleMaterial conversion here doesn't map roughness -> specular: https://github.com/mikedh/trimesh/blob/634c608f129d15a307557800deaba954f8a30a3e/trimesh/visual/material.py#L675-L686

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

Thanks!

mikedh commented 2 months ago

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!!