Kuesa Runtime

MetallicRoughnessProperties Class

class Kuesa::MetallicRoughnessProperties

Kuesa::MetallicRoughnessProperties hold the properties of a physically based rendering (PBR) material based on the glTF 2.0 material description. More...

Header: #include <Kuesa/MetallicRoughnessProperties>
Since: Kuesa 1.1
Instantiated By: MetallicRoughnessProperties
Inherits: Kuesa::GLTF2MaterialProperties

This class was introduced in Kuesa 1.1.

Properties

Public Functions

Qt3DRender::QAbstractTexture *ambientOcclusionMap() const
Kuesa::TextureTransform *ambientOcclusionMapTextureTransform() const
Kuesa::TextureTransform *baseColorMapTextureTransform() const
QColor emissiveFactor() const
Qt3DRender::QAbstractTexture *emissiveMap() const
Kuesa::TextureTransform *emissiveMapTextureTransform() const
bool isAOUsingTexCoord1() const
bool isEmissiveUsingTexCoord1() const
bool isMetallicRoughnessUsingTexCoord1() const
bool isNormalUsingTexCoord1() const
Qt3DRender::QAbstractTexture *metalRoughMap() const
Kuesa::TextureTransform *metalRoughMapTextureTransform() const
float metallicFactor() const
Qt3DRender::QAbstractTexture *normalMap() const
Kuesa::TextureTransform *normalMapTextureTransform() const
float normalScale() const
float roughnessFactor() const

Public Slots

void setAOUsesTexCoord1(bool aoUsesTexCoord1)
void setAmbientOcclusionMap(Qt3DRender::QAbstractTexture *ambientOcclusionMap)
void setEmissiveFactor(const QColor &emissiveFactor)
void setEmissiveMap(Qt3DRender::QAbstractTexture *emissiveMap)
void setEmissiveUsesTexCoord1(bool emissiveUsesTexCoord1)
void setMetalRoughMap(Qt3DRender::QAbstractTexture *metalRoughMap)
void setMetallicFactor(float metallicFactor)
void setMetallicRoughnessUsesTexCoord1(bool metallicRoughnessUsesTexCoord1)
void setNormalMap(Qt3DRender::QAbstractTexture *normalMap)
void setNormalScale(float normalScale)
void setNormalUsesTexCoord1(bool normalUsesTexCoord1)
void setRoughnessFactor(float roughnessFactor)

Signals

void ambientOcclusionMapChanged(Qt3DRender::QAbstractTexture *ambientOcclusionMap)
void aoUsesTexCoord1Changed(bool)
void emissiveFactorChanged(const QColor &emissiveFactor)
void emissiveMapChanged(Qt3DRender::QAbstractTexture *emissiveMap)
void emissiveUsesTexCoord1Changed(bool)
void metalRoughMapChanged(Qt3DRender::QAbstractTexture *metalRoughMap)
void metallicFactorChanged(float metallicFactor)
void metallicRoughnessUsesTexCoord1Changed(bool)
void normalMapChanged(Qt3DRender::QAbstractTexture *normalMapChanged)
void normalScaleChanged(float normalScale)
void normalUsesTexCoord1Changed(bool)
void roughnessFactorChanged(float roughnessFactor)

Detailed Description

The material properties are defined using a common set of parameter that define how light interacts with it. This allows to use a common description of the material so they are rendered consistently across platforms and 3D software and can be described by an intuitive set of parameters.

The MetallicRoughnessProperties consists of the following properties:

For a particular point of an object, the base color is computed as baseColorFactor*baseColorMap*vertexColor. The vertexColor is the interpolated value of the vertex color property of the mesh to which the material is applied.

Kuesa::MetallicRoughnessProperties also supports alpha blending and alpha cutoff. Alpha blending is used to simulate transparent materials, like a glass, while alpha cutoff is used to discard fragment that have an alpha value below a threshold. This is useful to render grass or trees for example.

Kuesa::MetallicRoughnessProperties supports two texture coordinate sets for each map. To specify the texture coordinate set a map must use, you can set the <map>UsesTexCoord1 property to true or false. If it's false, it will use the 0th coordinate set of the primitive, attached to 'defaultTextureCoordinateAttributeName` attribute. If it's true, it will use the 1st coordinate set of the primitive, attached to 'defaultTextureCoordinate1AttributeName`.

A more complete description of the material can be found in https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#materials

Property Documentation

ambientOcclusionMap : Qt3DRender::QAbstractTexture*

Specifies a texture to be used for ambient occlusion. The content of the texture is expected to be a single R channel in linear space. This offers a way of combining the metalRoughMap's G and B channels in the same texture as the ambientOcclusionMap.

Note: If this property is nullptr and is set to a non nullptr value or viceverse, it will trigger a recompilation of the shader.

Access functions:

Qt3DRender::QAbstractTexture *ambientOcclusionMap() const
void setAmbientOcclusionMap(Qt3DRender::QAbstractTexture *ambientOcclusionMap)

Notifier signal:

void ambientOcclusionMapChanged(Qt3DRender::QAbstractTexture *ambientOcclusionMap)

aoUsesTexCoord1 : bool

False if the map must use the 0th texture coordinate set, binded to 'defaultTextureCoordinateName' attribute. True if the map must use the 1st texture coordinate set, binded to 'defaultTextureCoordinate1Name' attribute.

Access functions:

bool isAOUsingTexCoord1() const
void setAOUsesTexCoord1(bool aoUsesTexCoord1)

Notifier signal:

void aoUsesTexCoord1Changed(bool)

emissiveFactor : QColor

Specifies an emissive factor to be used for emissive surfaces.

Access functions:

QColor emissiveFactor() const
void setEmissiveFactor(const QColor &emissiveFactor)

Notifier signal:

void emissiveFactorChanged(const QColor &emissiveFactor)

emissiveMap : Qt3DRender::QAbstractTexture*

Specifies a texture to be used for emissive surfaces. The content of the texture is expected to be in sRGB color space.

Note: If this property is nullptr and is set to a non nullptr value or viceverse, it will trigger a recompilation of the shader.

Access functions:

Qt3DRender::QAbstractTexture *emissiveMap() const
void setEmissiveMap(Qt3DRender::QAbstractTexture *emissiveMap)

Notifier signal:

void emissiveMapChanged(Qt3DRender::QAbstractTexture *emissiveMap)

emissiveUsesTexCoord1 : bool

False if the map must use the 0th texture coordinate set, binded to 'defaultTextureCoordinateName' attribute. True if the map must use the 1st texture coordinate set, binded to 'defaultTextureCoordinate1Name' attribute.

Access functions:

bool isEmissiveUsingTexCoord1() const
void setEmissiveUsesTexCoord1(bool emissiveUsesTexCoord1)

Notifier signal:

void emissiveUsesTexCoord1Changed(bool)

metalRoughMap : Qt3DRender::QAbstractTexture*

Specifies a texture to be used as metallic and roughness factor. The metallic factor is sampled for the B channel of the texture, while the roughness factor is sampled from the G channel. R and A channel are unused. This offers a way of combining the ambientOcclusionMap's R channel in the same texture as the metalRoughMap. The content of the texture is expected to be in linear RGB color space.

Note: If this property is nullptr and is set to a non nullptr value or viceverse, it will trigger a recompilation of the shader.

Access functions:

Qt3DRender::QAbstractTexture *metalRoughMap() const
void setMetalRoughMap(Qt3DRender::QAbstractTexture *metalRoughMap)

Notifier signal:

void metalRoughMapChanged(Qt3DRender::QAbstractTexture *metalRoughMap)

metallicFactor : float

Specifies the metallic factor of the material. Set this value between 0.0 and 1.0 to module how metallic the material is.

Access functions:

float metallicFactor() const
void setMetallicFactor(float metallicFactor)

Notifier signal:

void metallicFactorChanged(float metallicFactor)

metallicRoughnessUsesTexCoord1 : bool

False if the map must use the 0th texture coordinate set, binded to 'defaultTextureCoordinateName' attribute. True if the map must use the 1st texture coordinate set, binded to 'defaultTextureCoordinate1Name' attribute.

Access functions:

bool isMetallicRoughnessUsingTexCoord1() const
void setMetallicRoughnessUsesTexCoord1(bool metallicRoughnessUsesTexCoord1)

Notifier signal:

void metallicRoughnessUsesTexCoord1Changed(bool)

normalMap : Qt3DRender::QAbstractTexture*

Specifies a normal map for the material. This allows to simulate very detailed surfaces without a huge number of triangles. The content of the texture is expected to be in linear RGB color space.

Note: If this property is nullptr and is set to a non nullptr value or viceverse, it will trigger a recompilation of the shader.

Access functions:

Qt3DRender::QAbstractTexture *normalMap() const
void setNormalMap(Qt3DRender::QAbstractTexture *normalMap)

Notifier signal:

void normalMapChanged(Qt3DRender::QAbstractTexture *normalMapChanged)

normalScale : float

Specifies a scale for the normal map calculations. A bigger number is used to simulated bigger bumps in the surface

Access functions:

float normalScale() const
void setNormalScale(float normalScale)

Notifier signal:

void normalScaleChanged(float normalScale)

normalUsesTexCoord1 : bool

False if the map must use the 0th texture coordinate set, binded to 'defaultTextureCoordinateName' attribute. True if the map must use the 1st texture coordinate set, binded to 'defaultTextureCoordinate1Name' attribute.

Access functions:

bool isNormalUsingTexCoord1() const
void setNormalUsesTexCoord1(bool normalUsesTexCoord1)

Notifier signal:

void normalUsesTexCoord1Changed(bool)

roughnessFactor : float

Specifies the roughness factor of the material. Set the value between 0.0 and 1.0 to modulate how rough the material is.

Access functions:

float roughnessFactor() const
void setRoughnessFactor(float roughnessFactor)

Notifier signal:

void roughnessFactorChanged(float roughnessFactor)