Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
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.
 
 Graphic3d_PBRMaterial (const Graphic3d_BSDF &theBSDF)
 Creates new physically based material in Metallic-Roughness system from Graphic3d_BSDF.
 
float 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.
 
void SetMetallic (float theMetallic)
 Modifies metallic coefficient of material in [0, 1] range.
 
float Roughness () const
 Returns real value of roughness in [MinRoughness, 1] range for calculations.
 
float 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.
 
void SetRoughness (float theRoughness)
 Modifies roughness coefficient of material in [0, 1] range.
 
float IOR () const
 Returns index of refraction in [1, 3] range.
 
void SetIOR (float theIOR)
 Modifies index of refraction in [1, 3] range. In practice affects only on non-metal materials reflection possibilities.
 
const Quantity_ColorRGBAColor () const
 Returns albedo color with alpha component of material.
 
void SetColor (const Quantity_ColorRGBA &theColor)
 Modifies albedo color with alpha component.
 
void SetColor (const Quantity_Color &theColor)
 Modifies only albedo color.
 
float Alpha () const
 Returns alpha component in range [0, 1].
 
void SetAlpha (float theAlpha)
 Modifies alpha component.
 
NCollection_Vec3< floatEmission () const
 Returns light intensity emitted by material. Values are greater or equal 0.
 
void SetEmission (const NCollection_Vec3< float > &theEmission)
 Modifies light intensity emitted by material.
 
void SetBSDF (const Graphic3d_BSDF &theBSDF)
 Generates material in Metallic-Roughness system from Graphic3d_BSDF.
 
bool operator== (const Graphic3d_PBRMaterial &theOther) const
 PBR materials comparison operator.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 

Static Public Member Functions

static float Roughness (float theNormalizedRoughness)
 Maps roughness from [0, 1] to [MinRoughness, 1] for calculations.
 
static void GenerateEnvLUT (const occ::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.
 
static float RoughnessFromSpecular (const Quantity_Color &theSpecular, const double theShiness)
 Compute material roughness from common material (specular color + shininess).
 
static float MetallicFromSpecular (const Quantity_Color &theSpecular)
 Compute material metallicity from common material (specular color).
 
static float MinRoughness ()
 Roughness cannot be 0 in real calculations, so it returns minimal achievable level of roughness in practice.
 
static float SpecIBLMapSamplesFactor (float theProbability, float 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.
 

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()

float 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,
int theDepth = -1 ) const

Dumps the content of me into the stream.

◆ Emission()

NCollection_Vec3< float > Graphic3d_PBRMaterial::Emission ( ) const
inline

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

◆ GenerateEnvLUT()

static void Graphic3d_PBRMaterial::GenerateEnvLUT ( const occ::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]theNbIntegralSamplesnumber of importance samples in hemisphere integral calculation for every table item.

◆ IOR()

float Graphic3d_PBRMaterial::IOR ( ) const
inline

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

◆ Metallic()

float 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 float Graphic3d_PBRMaterial::MetallicFromSpecular ( const Quantity_Color & theSpecular)
inlinestatic

Compute material metallicity from common material (specular color).

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

◆ MinRoughness()

static float Graphic3d_PBRMaterial::MinRoughness ( )
inlinestatic

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

◆ NormalizedRoughness()

float 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==()

bool Graphic3d_PBRMaterial::operator== ( const Graphic3d_PBRMaterial & theOther) const
inline

PBR materials comparison operator.

◆ Roughness() [1/2]

float Graphic3d_PBRMaterial::Roughness ( ) const
inline

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

◆ Roughness() [2/2]

static float Graphic3d_PBRMaterial::Roughness ( float theNormalizedRoughness)
static

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

◆ RoughnessFromSpecular()

static float Graphic3d_PBRMaterial::RoughnessFromSpecular ( const Quantity_Color & theSpecular,
const double theShiness )
static

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

Parameters
[in]theSpecularspecular color
[in]theShinessnormalized shininess coefficient within [0..1] range
Returns
roughness within [0..1] range

◆ SetAlpha()

void Graphic3d_PBRMaterial::SetAlpha ( float 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_Color & theColor)

Modifies only albedo color.

◆ SetColor() [2/2]

void Graphic3d_PBRMaterial::SetColor ( const Quantity_ColorRGBA & theColor)

Modifies albedo color with alpha component.

◆ SetEmission()

void Graphic3d_PBRMaterial::SetEmission ( const NCollection_Vec3< float > & theEmission)

Modifies light intensity emitted by material.

◆ SetIOR()

void Graphic3d_PBRMaterial::SetIOR ( float theIOR)

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

◆ SetMetallic()

void Graphic3d_PBRMaterial::SetMetallic ( float theMetallic)

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

◆ SetRoughness()

void Graphic3d_PBRMaterial::SetRoughness ( float theRoughness)

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

◆ SpecIBLMapSamplesFactor()

static float Graphic3d_PBRMaterial::SpecIBLMapSamplesFactor ( float theProbability,
float 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: