mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
Metallic-Roughness shading model Graphic3d_TOSM_PBR has been implemented. New materials descriptors Graphic3d_PBRMaterial have been added to Graphic3d_MaterialAspect. PBR shading model requires OpenGL 3.0+ or OpenGL ES 3.0+ hardware. Environment cubemap is expected to be provided for realistic look of metallic materials. occLight_IsHeadlight() now returns bool instead of int. Avoid using lowp for enumerations to workaround occLight_IsHeadlight() ignorance on Adreno 308 caused by some GLSL optimizator bugs. OpenGl_Texture::EstimatedDataSize() - fixed estimation for Cubemap textures. OpenGl_Sampler::applySamplerParams() - fixed uninitialized GL_TEXTURE_WRAP_R in case of GL_TEXTURE_CUBE_MAP target.
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <Graphic3d_BSDF.hxx>
|
||||
|
||||
#include <Graphic3d_PBRMaterial.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// =======================================================================
|
||||
@@ -63,6 +65,7 @@ Graphic3d_Fresnel Graphic3d_Fresnel::CreateConductor (const Graphic3d_Vec3& theR
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_BSDF::Graphic3d_BSDF()
|
||||
: Ks (Graphic3d_Vec3 (0.f), 1.f)
|
||||
{
|
||||
FresnelCoat = Graphic3d_Fresnel::CreateConstant (0.f);
|
||||
FresnelBase = Graphic3d_Fresnel::CreateConstant (1.f);
|
||||
@@ -189,4 +192,21 @@ Graphic3d_BSDF Graphic3d_BSDF::CreateGlass (const Graphic3d_Vec3& theWeight,
|
||||
theAbsorptionCoeff);
|
||||
|
||||
return aBSDF;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CreateMetallicRoughness
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_BSDF Graphic3d_BSDF::CreateMetallicRoughness (const Graphic3d_PBRMaterial& thePbr)
|
||||
{
|
||||
const Graphic3d_Vec3 aDiff = (Graphic3d_Vec3 )thePbr.Color().GetRGB() * thePbr.Alpha();
|
||||
const Standard_ShortReal aRougness2 = thePbr.NormalizedRoughness() * thePbr.NormalizedRoughness();
|
||||
|
||||
Graphic3d_BSDF aBsdf;
|
||||
aBsdf.FresnelBase = Graphic3d_Fresnel::CreateSchlick (aDiff * thePbr.Metallic());
|
||||
aBsdf.Ks.SetValues (Graphic3d_Vec3 (thePbr.Alpha()), aRougness2);
|
||||
aBsdf.Kt = Graphic3d_Vec3 (1.0f - thePbr.Alpha());
|
||||
aBsdf.Kd = aDiff * (1.0f - thePbr.Metallic());
|
||||
return aBsdf;
|
||||
}
|
||||
|
Reference in New Issue
Block a user