mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0032524: Data Exchange, RWGltf_CafWriter - avoid writing translucent metallic materials
RWGltf_GltfMaterialMap::DefineMaterial() and XCAFDoc_VisMaterial::ConvertToPbrMaterial() now reset matallic factor to 0.0f in case of transparent color.
This commit is contained in:
parent
45fc824bac
commit
aeef9e2c13
@ -420,6 +420,7 @@ void RWGltf_GltfMaterialMap::DefineMaterial (const XCAFPrs_Style& theStyle,
|
||||
aPbrMat.BaseColor.SetRGB (theStyle.GetColorSurf());
|
||||
if (theStyle.GetColorSurfRGBA().Alpha() < 1.0f)
|
||||
{
|
||||
aPbrMat.Metallic = 0.0f;
|
||||
aPbrMat.BaseColor.SetAlpha (theStyle.GetColorSurfRGBA().Alpha());
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,9 @@ XCAFDoc_VisMaterialPBR XCAFDoc_VisMaterial::ConvertToPbrMaterial()
|
||||
aPbrMat.BaseColorTexture = myCommonMat.DiffuseTexture;
|
||||
aPbrMat.BaseColor.SetRGB (myCommonMat.DiffuseColor);
|
||||
aPbrMat.BaseColor.SetAlpha (1.0f - myCommonMat.Transparency);
|
||||
aPbrMat.Metallic = Graphic3d_PBRMaterial::MetallicFromSpecular (myCommonMat.SpecularColor);
|
||||
aPbrMat.Metallic = myCommonMat.Transparency <= ShortRealEpsilon()
|
||||
? Graphic3d_PBRMaterial::MetallicFromSpecular (myCommonMat.SpecularColor)
|
||||
: 0.0f;
|
||||
aPbrMat.Roughness = Graphic3d_PBRMaterial::RoughnessFromSpecular (myCommonMat.SpecularColor, myCommonMat.Shininess);
|
||||
aPbrMat.EmissiveFactor = myCommonMat.EmissiveColor;
|
||||
return aPbrMat;
|
||||
@ -218,7 +220,9 @@ void XCAFDoc_VisMaterial::FillMaterialAspect (Graphic3d_MaterialAspect& theAspec
|
||||
{
|
||||
Graphic3d_PBRMaterial aPbr;
|
||||
aPbr.SetColor (myCommonMat.DiffuseColor);
|
||||
aPbr.SetMetallic (Graphic3d_PBRMaterial::MetallicFromSpecular (myCommonMat.SpecularColor));
|
||||
aPbr.SetMetallic (myCommonMat.Transparency <= ShortRealEpsilon()
|
||||
? Graphic3d_PBRMaterial::MetallicFromSpecular (myCommonMat.SpecularColor)
|
||||
: 0.0f);
|
||||
aPbr.SetRoughness (Graphic3d_PBRMaterial::RoughnessFromSpecular (myCommonMat.SpecularColor, myCommonMat.Shininess));
|
||||
aPbr.SetEmission (myCommonMat.EmissiveColor);
|
||||
theAspect.SetPBRMaterial (aPbr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user