Open CASCADE Technology  7.5.0
Public Member Functions | Static Public Member Functions

Graphic3d_PBRMaterial Class Reference

Class implementing Metallic-Roughness physically based material definition. More...

#include <Graphic3d_PBRMaterial.hxx>

Public Member Functions

 Graphic3d_PBRMaterial ()
 Creates new physically based material in Metallic-Roughness system. 'metallic' parameter is 0 by default. 'roughness' parameter is 1 by default. 'color' parameter is (0, 0, 0) by default. 'alpha' parameter is 1 by default. 'IOR' parameter is 1.5 by default. 'emission' parameter is (0, 0, 0) by default. More...
 
 Graphic3d_PBRMaterial (const Graphic3d_BSDF &theBSDF)
 Creates new physically based material in Metallic-Roughness system from Graphic3d_BSDF. More...
 
Standard_ShortReal Metallic () const
 Returns material's metallic coefficient in [0, 1] range. 1 for metals and 0 for dielectrics. It is preferable to be exactly 0 or 1. Average values are needed for textures mixing in shader. More...
 
void SetMetallic (Standard_ShortReal theMetallic)
 Modifies metallic coefficient of material in [0, 1] range. More...
 
Standard_ShortReal Roughness () const
 Returns real value of roughness in [MinRoughness, 1] range for calculations. More...
 
Standard_ShortReal NormalizedRoughness () const
 Returns roughness mapping parameter in [0, 1] range. Roughness is defined in [0, 1] for handful material settings and is mapped to [MinRoughness, 1] for calculations. More...
 
void SetRoughness (Standard_ShortReal theRoughness)
 Modifies roughness coefficient of material in [0, 1] range. More...
 
Standard_ShortReal IOR () const
 Returns index of refraction in [1, 3] range. More...
 
void SetIOR (Standard_ShortReal theIOR)
 Modifies index of refraction in [1, 3] range. In practice affects only on non-metal materials reflection possibilities. More...
 
const Quantity_ColorRGBAColor () const
 Returns albedo color with alpha component of material. More...
 
void SetColor (const Quantity_ColorRGBA &theColor)
 Modifies albedo color with alpha component. More...
 
void SetColor (const Quantity_Color &theColor)
 Modifies only albedo color. More...
 
Standard_ShortReal Alpha () const
 Returns alpha component in range [0, 1]. More...
 
void SetAlpha (Standard_ShortReal theAlpha)
 Modifies alpha component. More...
 
Graphic3d_Vec3 Emission () const
 Returns light intensity emitted by material. Values are greater or equal 0. More...
 
void SetEmission (const Graphic3d_Vec3 &theEmission)
 Modifies light intensity emitted by material. More...
 
void SetBSDF (const Graphic3d_BSDF &theBSDF)
 Generates material in Metallic-Roughness system from Graphic3d_BSDF. More...
 
Standard_Boolean operator== (const Graphic3d_PBRMaterial &theOther) const
 PBR materials comparison operator. More...
 
void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream. More...
 

Static Public Member Functions

static Standard_ShortReal Roughness (Standard_ShortReal theNormalizedRoughness)
 Maps roughness from [0, 1] to [MinRoughness, 1] for calculations. More...
 
static void GenerateEnvLUT (const Handle< Image_PixMap > &theLUT, unsigned int theNbIntegralSamples=1024)
 Generates 2D look up table of scale and bias for fresnell zero coefficient. It is needed for calculation reflectance part of environment lighting. More...
 
static Standard_ShortReal RoughnessFromSpecular (const Quantity_Color &theSpecular, const Standard_Real theShiness)
 Compute material roughness from common material (specular color + shininess). More...
 
static Standard_ShortReal MetallicFromSpecular (const Quantity_Color &theSpecular)
 Compute material metallicity from common material (specular color). More...
 
static Standard_ShortReal MinRoughness ()
 Roughness cannot be 0 in real calculations, so it returns minimal achievable level of roughness in practice. More...
 
static Standard_ShortReal SpecIBLMapSamplesFactor (Standard_ShortReal theProbability, Standard_ShortReal theRoughness)
 Shows how much times less samples can be used in certain roughness value specular IBL map generation in compare with samples number for map with roughness of 1. Specular IBL maps with less roughness values have higher resolution but require less samples for the same quality of baking. So that reducing samples number is good strategy to improve performance of baking. The samples number for specular IBL map with roughness of 1 (the maximum possible samples number) is expected to be defined as baking parameter. Samples number for other roughness values can be calculated by multiplication origin samples number by this factor. More...
 

Detailed Description

Class implementing Metallic-Roughness physically based material definition.

Constructor & Destructor Documentation

◆ Graphic3d_PBRMaterial() [1/2]

Graphic3d_PBRMaterial::Graphic3d_PBRMaterial ( )

Creates new physically based material in Metallic-Roughness system. 'metallic' parameter is 0 by default. 'roughness' parameter is 1 by default. 'color' parameter is (0, 0, 0) by default. 'alpha' parameter is 1 by default. 'IOR' parameter is 1.5 by default. 'emission' parameter is (0, 0, 0) by default.

◆ Graphic3d_PBRMaterial() [2/2]

Graphic3d_PBRMaterial::Graphic3d_PBRMaterial ( const Graphic3d_BSDF theBSDF)

Creates new physically based material in Metallic-Roughness system from Graphic3d_BSDF.

Member Function Documentation

◆ Alpha()

Standard_ShortReal Graphic3d_PBRMaterial::Alpha ( ) const
inline

Returns alpha component in range [0, 1].

◆ Color()

const Quantity_ColorRGBA& Graphic3d_PBRMaterial::Color ( ) const
inline

Returns albedo color with alpha component of material.

◆ DumpJson()

void Graphic3d_PBRMaterial::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const

Dumps the content of me into the stream.

◆ Emission()

Graphic3d_Vec3 Graphic3d_PBRMaterial::Emission ( ) const
inline

Returns light intensity emitted by material. Values are greater or equal 0.

◆ GenerateEnvLUT()

static void Graphic3d_PBRMaterial::GenerateEnvLUT ( const Handle< Image_PixMap > &  theLUT,
unsigned int  theNbIntegralSamples = 1024 
)
static

Generates 2D look up table of scale and bias for fresnell zero coefficient. It is needed for calculation reflectance part of environment lighting.

Parameters
[out]theLUTtable storage (must be Image_Format_RGF).
[in]theIntegralSamplesCountnumber of importance samples in hemisphere integral calculation for every table item.

◆ IOR()

Standard_ShortReal Graphic3d_PBRMaterial::IOR ( ) const
inline

Returns index of refraction in [1, 3] range.

◆ Metallic()

Standard_ShortReal Graphic3d_PBRMaterial::Metallic ( ) const
inline

Returns material's metallic coefficient in [0, 1] range. 1 for metals and 0 for dielectrics. It is preferable to be exactly 0 or 1. Average values are needed for textures mixing in shader.

◆ MetallicFromSpecular()

static Standard_ShortReal Graphic3d_PBRMaterial::MetallicFromSpecular ( const Quantity_Color theSpecular)
inlinestatic

Compute material metallicity from common material (specular color).

Parameters
theSpecular[in] specular color
Returns
metallicity within [0..1] range

◆ MinRoughness()

static Standard_ShortReal Graphic3d_PBRMaterial::MinRoughness ( )
inlinestatic

Roughness cannot be 0 in real calculations, so it returns minimal achievable level of roughness in practice.

◆ NormalizedRoughness()

Standard_ShortReal Graphic3d_PBRMaterial::NormalizedRoughness ( ) const
inline

Returns roughness mapping parameter in [0, 1] range. Roughness is defined in [0, 1] for handful material settings and is mapped to [MinRoughness, 1] for calculations.

◆ operator==()

Standard_Boolean Graphic3d_PBRMaterial::operator== ( const Graphic3d_PBRMaterial theOther) const
inline

PBR materials comparison operator.

◆ Roughness() [1/2]

static Standard_ShortReal Graphic3d_PBRMaterial::Roughness ( Standard_ShortReal  theNormalizedRoughness)
static

Maps roughness from [0, 1] to [MinRoughness, 1] for calculations.

◆ Roughness() [2/2]

Standard_ShortReal Graphic3d_PBRMaterial::Roughness ( ) const
inline

Returns real value of roughness in [MinRoughness, 1] range for calculations.

◆ RoughnessFromSpecular()

static Standard_ShortReal Graphic3d_PBRMaterial::RoughnessFromSpecular ( const Quantity_Color theSpecular,
const Standard_Real  theShiness 
)
static

Compute material roughness from common material (specular color + shininess).

Parameters
theSpecular[in] specular color
theShiness[in] normalized shininess coefficient within [0..1] range
Returns
roughness within [0..1] range

◆ SetAlpha()

void Graphic3d_PBRMaterial::SetAlpha ( Standard_ShortReal  theAlpha)

Modifies alpha component.

◆ SetBSDF()

void Graphic3d_PBRMaterial::SetBSDF ( const Graphic3d_BSDF theBSDF)

Generates material in Metallic-Roughness system from Graphic3d_BSDF.

◆ SetColor() [1/2]

void Graphic3d_PBRMaterial::SetColor ( const Quantity_ColorRGBA theColor)

Modifies albedo color with alpha component.

◆ SetColor() [2/2]

void Graphic3d_PBRMaterial::SetColor ( const Quantity_Color theColor)

Modifies only albedo color.

◆ SetEmission()

void Graphic3d_PBRMaterial::SetEmission ( const Graphic3d_Vec3 theEmission)

Modifies light intensity emitted by material.

◆ SetIOR()

void Graphic3d_PBRMaterial::SetIOR ( Standard_ShortReal  theIOR)

Modifies index of refraction in [1, 3] range. In practice affects only on non-metal materials reflection possibilities.

◆ SetMetallic()

void Graphic3d_PBRMaterial::SetMetallic ( Standard_ShortReal  theMetallic)

Modifies metallic coefficient of material in [0, 1] range.

◆ SetRoughness()

void Graphic3d_PBRMaterial::SetRoughness ( Standard_ShortReal  theRoughness)

Modifies roughness coefficient of material in [0, 1] range.

◆ SpecIBLMapSamplesFactor()

static Standard_ShortReal Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor ( Standard_ShortReal  theProbability,
Standard_ShortReal  theRoughness 
)
static

Shows how much times less samples can be used in certain roughness value specular IBL map generation in compare with samples number for map with roughness of 1. Specular IBL maps with less roughness values have higher resolution but require less samples for the same quality of baking. So that reducing samples number is good strategy to improve performance of baking. The samples number for specular IBL map with roughness of 1 (the maximum possible samples number) is expected to be defined as baking parameter. Samples number for other roughness values can be calculated by multiplication origin samples number by this factor.

Parameters
theProbabilityvalue from 0 to 1 controlling strength of samples reducing. Bigger values result in slower reduction to provide better quality but worse performance. Value of 1 doesn't affect at all so that 1 will be returned (it can be used to disable reduction strategy).
theRoughnessroughness value of current generated specular IBL map (from 0 to 1).
Returns
factor to calculate number of samples for current specular IBL map baking. Be aware! It has no obligation to return 1 in case of roughness of 1. Be aware! It produces poor quality with small number of origin samples. In that case it is recommended to be disabled.

The documentation for this class was generated from the following file: