Closed gordonnl closed 2 years ago
Hey @gordonnl , I believe this is already fixed on latest dev, mind trying that and potentially rebasing there? Thanks!
The actual fix was more complex I think, I decided to actually bake smoothness in since I don't think there's a real conversion from roughness = (1 - (smoothnessFactor * smoothnessMap))
to
roughness = roughnessFactor * roughnessMap
Oh amazing, I'm glad I asked - I didn't realise dev was so far ahead! Thanks for the prompt reply, and that sounds like a great solution to me.
Problem: When using Unity's Standard shader with a Metallic map and Smoothness data in the Alpha channel, and a Smoothness multiplier of
1
, upon export the Smoothness multiplier (_GlossMapScale
) is inverted, resulting in a GLTF with a roughness multiplier value of0
. Resulting in an entirely smooth material.Proposed solution: Don't invert the multiplier when a map is attached. If there is no map, then the smoothness should indeed continue to be inverted.
Possible issue: Majority of the time when using a gloss map, the multiplier would be
1
, however in cases it is less than1
, as the smoothness data in the map is already inverted, the multiplier should be converted with1.0 / _GlossMapScale
. Eg if the pixel smoothness data is0.6
, and the multiplier is0.8
, the smoothness value would be0.48
. Therefore the desired roughness for that pixel would be0.52
. As the pixel data is inverted, giving0.4
, a multiplier of1.25
would be required to achieve the desired value of0.52
. Two issues with this, the potential of dividing by0
, and that Unity doesn't support values above1
.