Open CASCADE Technology 7.8.2.dev
|
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. | |
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. | |
void | SetMetallic (Standard_ShortReal theMetallic) |
Modifies metallic coefficient of material in [0, 1] range. | |
Standard_ShortReal | Roughness () const |
Returns real value of roughness in [MinRoughness, 1] range for calculations. | |
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. | |
void | SetRoughness (Standard_ShortReal theRoughness) |
Modifies roughness coefficient of material in [0, 1] range. | |
Standard_ShortReal | IOR () const |
Returns index of refraction in [1, 3] range. | |
void | SetIOR (Standard_ShortReal theIOR) |
Modifies index of refraction in [1, 3] range. In practice affects only on non-metal materials reflection possibilities. | |
const Quantity_ColorRGBA & | Color () 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. | |
Standard_ShortReal | Alpha () const |
Returns alpha component in range [0, 1]. | |
void | SetAlpha (Standard_ShortReal theAlpha) |
Modifies alpha component. | |
Graphic3d_Vec3 | Emission () const |
Returns light intensity emitted by material. Values are greater or equal 0. | |
void | SetEmission (const Graphic3d_Vec3 &theEmission) |
Modifies light intensity emitted by material. | |
void | SetBSDF (const Graphic3d_BSDF &theBSDF) |
Generates material in Metallic-Roughness system from Graphic3d_BSDF. | |
Standard_Boolean | operator== (const Graphic3d_PBRMaterial &theOther) const |
PBR materials comparison operator. | |
void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const |
Dumps the content of me into the stream. | |
Static Public Member Functions | |
static Standard_ShortReal | Roughness (Standard_ShortReal theNormalizedRoughness) |
Maps roughness from [0, 1] to [MinRoughness, 1] for calculations. | |
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. | |
static Standard_ShortReal | RoughnessFromSpecular (const Quantity_Color &theSpecular, const Standard_Real theShiness) |
Compute material roughness from common material (specular color + shininess). | |
static Standard_ShortReal | MetallicFromSpecular (const Quantity_Color &theSpecular) |
Compute material metallicity from common material (specular color). | |
static Standard_ShortReal | MinRoughness () |
Roughness cannot be 0 in real calculations, so it returns minimal achievable level of roughness in practice. | |
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. | |
Class implementing Metallic-Roughness physically based material definition.
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::Graphic3d_PBRMaterial | ( | const Graphic3d_BSDF & | theBSDF | ) |
Creates new physically based material in Metallic-Roughness system from Graphic3d_BSDF.
|
inline |
Returns alpha component in range [0, 1].
|
inline |
Returns albedo color with alpha component of material.
void Graphic3d_PBRMaterial::DumpJson | ( | Standard_OStream & | theOStream, |
Standard_Integer | theDepth = -1 ) const |
Dumps the content of me into the stream.
|
inline |
Returns light intensity emitted by material. Values are greater or equal 0.
|
static |
Generates 2D look up table of scale and bias for fresnell zero coefficient. It is needed for calculation reflectance part of environment lighting.
[out] | theLUT | table storage (must be Image_Format_RGF). |
[in] | theNbIntegralSamples | number of importance samples in hemisphere integral calculation for every table item. |
|
inline |
Returns index of refraction in [1, 3] range.
|
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.
|
inlinestatic |
Compute material metallicity from common material (specular color).
theSpecular | [in] specular color |
|
inlinestatic |
Roughness cannot be 0 in real calculations, so it returns minimal achievable level of roughness in practice.
|
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.
|
inline |
PBR materials comparison operator.
|
inline |
Returns real value of roughness in [MinRoughness, 1] range for calculations.
|
static |
Maps roughness from [0, 1] to [MinRoughness, 1] for calculations.
|
static |
Compute material roughness from common material (specular color + shininess).
theSpecular | [in] specular color |
theShiness | [in] normalized shininess coefficient within [0..1] range |
void Graphic3d_PBRMaterial::SetAlpha | ( | Standard_ShortReal | theAlpha | ) |
Modifies alpha component.
void Graphic3d_PBRMaterial::SetBSDF | ( | const Graphic3d_BSDF & | theBSDF | ) |
Generates material in Metallic-Roughness system from Graphic3d_BSDF.
void Graphic3d_PBRMaterial::SetColor | ( | const Quantity_Color & | theColor | ) |
Modifies only albedo color.
void Graphic3d_PBRMaterial::SetColor | ( | const Quantity_ColorRGBA & | theColor | ) |
Modifies albedo color with alpha component.
void Graphic3d_PBRMaterial::SetEmission | ( | const Graphic3d_Vec3 & | theEmission | ) |
Modifies light intensity emitted by material.
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.
void Graphic3d_PBRMaterial::SetMetallic | ( | Standard_ShortReal | theMetallic | ) |
Modifies metallic coefficient of material in [0, 1] range.
void Graphic3d_PBRMaterial::SetRoughness | ( | Standard_ShortReal | theRoughness | ) |
Modifies roughness coefficient of material in [0, 1] range.
|
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.
theProbability | value 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). |
theRoughness | roughness value of current generated specular IBL map (from 0 to 1). |