Skip to content

Kuesa::Qt3D::MetallicRoughnessProperties

Module: Kuesa Qt 3D API

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

#include <Kuesa/Qt3D/api/materials/metallicroughnessproperties.h>

Inherits from Kuesa::Qt3D::GLTF2MaterialProperties, Qt3DCore::QNode

Public Slots

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

Public Signals

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

Public Functions

Name
MetallicRoughnessProperties(Qt3DCore::QNode * parent =nullptr)
~MetallicRoughnessProperties()
virtual Qt3DRender::QShaderData * shaderData() const override
bool isMetallicRoughnessUsingTexCoord1() const
bool isNormalUsingTexCoord1() const
bool isAOUsingTexCoord1() const
bool isEmissiveUsingTexCoord1() const
Kuesa::Qt3D::TextureTransform * baseColorMapTextureTransform() const
float metallicFactor() const
float roughnessFactor() const
Qt3DRender::QAbstractTexture * metalRoughMap() const
Kuesa::Qt3D::TextureTransform * metalRoughMapTextureTransform() const
float normalScale() const
Qt3DRender::QAbstractTexture * normalMap() const
Kuesa::Qt3D::TextureTransform * normalMapTextureTransform() const
Qt3DRender::QAbstractTexture * ambientOcclusionMap() const
Kuesa::Qt3D::TextureTransform * ambientOcclusionMapTextureTransform() const
QColor emissiveFactor() const
Qt3DRender::QAbstractTexture * emissiveMap() const
Kuesa::Qt3D::TextureTransform * emissiveMapTextureTransform() const

Public Properties

Name
bool metallicRoughnessUsesTexCoord1
bool normalUsesTexCoord1
bool aoUsesTexCoord1
bool emissiveUsesTexCoord1
Kuesa::Qt3D::TextureTransform * baseColorMapTextureTransform
float metallicFactor
float roughnessFactor
Qt3DRender::QAbstractTexture * metalRoughMap
Kuesa::Qt3D::TextureTransform * metalRoughMapTextureTransform
float normalScale
Qt3DRender::QAbstractTexture * normalMap
Kuesa::Qt3D::TextureTransform * normalMapTextureTransform
Qt3DRender::QAbstractTexture * ambientOcclusionMap
Kuesa::Qt3D::TextureTransform * ambientOcclusionMapTextureTransform
QColor emissiveFactor
Qt3DRender::QAbstractTexture * emissiveMap
Kuesa::Qt3D::TextureTransform * emissiveMapTextureTransform

Friends

Name
class MetallicRoughnessMaterial

Additional inherited members

Public Slots inherited from Kuesa::Qt3D::GLTF2MaterialProperties

Name
void setBaseColorUsesTexCoord1(bool baseColorUsesTexCoord1)
void setBaseColorFactor(const QColor & baseColorFactor)
void setBaseColorMap(Qt3DRender::QAbstractTexture * baseColorMap)
void setAlphaCutoff(float alphaCutoff)
void setReceivesShadows(bool receivesShadows)
void setShadowMapDepthTexture(Qt3DRender::QAbstractTexture * depthTexture)
void setShadowMapCubeDepthTexture(Qt3DRender::QAbstractTexture * cubeMapDepthTexture)

Public Signals inherited from Kuesa::Qt3D::GLTF2MaterialProperties

Name
void baseColorUsesTexCoord1Changed(bool )
void baseColorFactorChanged(const QColor & baseColorFactor)
void baseColorMapChanged(Qt3DRender::QAbstractTexture * baseColorMap)
void alphaCutoffChanged(float alphaCutoff)
void receivesShadowsChanged(bool receivesShadows)
void shadowMapDepthTextureChanged(Qt3DRender::QAbstractTexture * depthTexture)
void shadowMapCubeDepthTextureChanged(Qt3DRender::QAbstractTexture * cubeMapDepthTexture)

Public Functions inherited from Kuesa::Qt3D::GLTF2MaterialProperties

Name
GLTF2MaterialProperties(Qt3DCore::QNode * parent =nullptr)
~GLTF2MaterialProperties()
bool isBaseColorUsingTexCoord1() const
QColor baseColorFactor() const
Qt3DRender::QAbstractTexture * baseColorMap() const
float alphaCutoff() const
void addClientMaterial(Qt3DRender::QMaterial * material)
QVector< Qt3DRender::QMaterial * > clientMaterials() const
bool receivesShadows() const
Qt3DRender::QAbstractTexture * shadowMapDepthTexture() const
Qt3DRender::QAbstractTexture * shadowMapCubeDepthTexture() const

Public Properties inherited from Kuesa::Qt3D::GLTF2MaterialProperties

Name
bool baseColorUsesTexCoord1
QColor baseColorFactor
Qt3DRender::QAbstractTexture * baseColorMap
float alphaCutoff
bool receivesShadows

Detailed Description

1
class Kuesa::Qt3D::MetallicRoughnessProperties;

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

Since: Kuesa 2.0

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:

  • baseColorFactor: Base color of the material
  • baseColorMap: A texture specifying the base color of the material
  • baseColorMapTextureTransform: Texture transform for the base color map
  • metallicFactor: The metalness of the material
  • roughnessFactor: The roughness of the material
  • metalRoughMap: A texture specifying both metalness and roughness of the material
  • metalRoughMapTextureTransform: Texture transform for the metalRough map
  • normalMap: Normal texture for normal mapping. This allows to simulate very detailed surfaces without too many triangle
  • normalMapTextureTransform: Texture transform for the normal map
  • normalScale: A scale factor for the normal map
  • ambientOcclusionMap: An ambient occlusion map. This allows to simulate ambient occlusion and shadow zones that otherwise will be too bright
  • ambientOcclusionMapTextureTransform: Texture transform for the ambient occlusion map
  • emissiveFactor: The emissive strength of the material
  • emissiveMap: A texture specifying the emissive property of the material
  • emissiveMapTextureTransform: Texture transform for the emissive map For a particular point of an object, the base color is computed as baseColorFactorbaseColorMapvertexColor. The vertexColor is the interpolated value of the vertex color property of the mesh to which the material is applied.

Kuesa::Qt3D::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::Qt3D::MetallicRoughnessProperties supports two texture coordinate sets for each map. To specify the texture coordinate set a map must use, you can set the UsesTexCoord1 property to true or false. If it's false, it will use the 0th coordinate set of the primitive, attached to 'defaultTextureCoordinateAttributeNameattribute. 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

Public Slots Documentation

slot setMetallicRoughnessUsesTexCoord1

1
2
3
void setMetallicRoughnessUsesTexCoord1(
    bool metallicRoughnessUsesTexCoord1
)

slot setNormalUsesTexCoord1

1
2
3
void setNormalUsesTexCoord1(
    bool normalUsesTexCoord1
)

slot setAOUsesTexCoord1

1
2
3
void setAOUsesTexCoord1(
    bool aoUsesTexCoord1
)

slot setEmissiveUsesTexCoord1

1
2
3
void setEmissiveUsesTexCoord1(
    bool emissiveUsesTexCoord1
)

slot setMetallicFactor

1
2
3
void setMetallicFactor(
    float metallicFactor
)

slot setRoughnessFactor

1
2
3
void setRoughnessFactor(
    float roughnessFactor
)

slot setMetalRoughMap

1
2
3
void setMetalRoughMap(
    Qt3DRender::QAbstractTexture * metalRoughMap
)

slot setNormalScale

1
2
3
void setNormalScale(
    float normalScale
)

slot setNormalMap

1
2
3
void setNormalMap(
    Qt3DRender::QAbstractTexture * normalMap
)

slot setAmbientOcclusionMap

1
2
3
void setAmbientOcclusionMap(
    Qt3DRender::QAbstractTexture * ambientOcclusionMap
)

slot setEmissiveFactor

1
2
3
void setEmissiveFactor(
    const QColor & emissiveFactor
)

slot setEmissiveMap

1
2
3
void setEmissiveMap(
    Qt3DRender::QAbstractTexture * emissiveMap
)

Public Signals Documentation

signal metallicRoughnessUsesTexCoord1Changed

1
2
3
void metallicRoughnessUsesTexCoord1Changed(
    bool 
)

signal normalUsesTexCoord1Changed

1
2
3
void normalUsesTexCoord1Changed(
    bool 
)

signal aoUsesTexCoord1Changed

1
2
3
void aoUsesTexCoord1Changed(
    bool 
)

signal emissiveUsesTexCoord1Changed

1
2
3
void emissiveUsesTexCoord1Changed(
    bool 
)

signal metallicFactorChanged

1
2
3
void metallicFactorChanged(
    float metallicFactor
)

signal roughnessFactorChanged

1
2
3
void roughnessFactorChanged(
    float roughnessFactor
)

signal metalRoughMapChanged

1
2
3
void metalRoughMapChanged(
    Qt3DRender::QAbstractTexture * metalRoughMap
)

signal normalScaleChanged

1
2
3
void normalScaleChanged(
    float normalScale
)

signal normalMapChanged

1
2
3
void normalMapChanged(
    Qt3DRender::QAbstractTexture * normalMapChanged
)

signal ambientOcclusionMapChanged

1
2
3
void ambientOcclusionMapChanged(
    Qt3DRender::QAbstractTexture * ambientOcclusionMap
)

signal emissiveFactorChanged

1
2
3
void emissiveFactorChanged(
    const QColor & emissiveFactor
)

signal emissiveMapChanged

1
2
3
void emissiveMapChanged(
    Qt3DRender::QAbstractTexture * emissiveMap
)

Public Functions Documentation

function MetallicRoughnessProperties

1
2
3
explicit MetallicRoughnessProperties(
    Qt3DCore::QNode * parent =nullptr
)

function ~MetallicRoughnessProperties

1
~MetallicRoughnessProperties()

function shaderData

1
virtual Qt3DRender::QShaderData * shaderData() const override

Reimplements: Kuesa::Qt3D::GLTF2MaterialProperties::shaderData

function isMetallicRoughnessUsingTexCoord1

1
bool isMetallicRoughnessUsingTexCoord1() const

function isNormalUsingTexCoord1

1
bool isNormalUsingTexCoord1() const

function isAOUsingTexCoord1

1
bool isAOUsingTexCoord1() const

function isEmissiveUsingTexCoord1

1
bool isEmissiveUsingTexCoord1() const

function baseColorMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * baseColorMapTextureTransform() const

function metallicFactor

1
float metallicFactor() const

function roughnessFactor

1
float roughnessFactor() const

function metalRoughMap

1
Qt3DRender::QAbstractTexture * metalRoughMap() const

function metalRoughMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * metalRoughMapTextureTransform() const

function normalScale

1
float normalScale() const

function normalMap

1
Qt3DRender::QAbstractTexture * normalMap() const

function normalMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * normalMapTextureTransform() const

function ambientOcclusionMap

1
Qt3DRender::QAbstractTexture * ambientOcclusionMap() const

function ambientOcclusionMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * ambientOcclusionMapTextureTransform() const

function emissiveFactor

1
QColor emissiveFactor() const

function emissiveMap

1
Qt3DRender::QAbstractTexture * emissiveMap() const

function emissiveMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * emissiveMapTextureTransform() const

Public Property Documentation

property metallicRoughnessUsesTexCoord1

1
bool metallicRoughnessUsesTexCoord1;

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.

property normalUsesTexCoord1

1
bool normalUsesTexCoord1;

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.

property aoUsesTexCoord1

1
bool aoUsesTexCoord1;

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.

property emissiveUsesTexCoord1

1
bool emissiveUsesTexCoord1;

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.

property baseColorMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * baseColorMapTextureTransform;

property metallicFactor

1
float metallicFactor;

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

property roughnessFactor

1
float roughnessFactor;

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

property metalRoughMap

1
Qt3DRender::QAbstractTexture * metalRoughMap;

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

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.

property metalRoughMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * metalRoughMapTextureTransform;

property normalScale

1
float normalScale;

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

property normalMap

1
Qt3DRender::QAbstractTexture * normalMap;

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

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.

property normalMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * normalMapTextureTransform;

property ambientOcclusionMap

1
Qt3DRender::QAbstractTexture * 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.

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.

property ambientOcclusionMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * ambientOcclusionMapTextureTransform;

property emissiveFactor

1
QColor emissiveFactor;

Specifies an emissive factor to be used for emissive surfaces.

property emissiveMap

1
Qt3DRender::QAbstractTexture * emissiveMap;

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

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

property emissiveMapTextureTransform

1
Kuesa::Qt3D::TextureTransform * emissiveMapTextureTransform;

Friends

friend MetallicRoughnessMaterial

1
2
3
friend class MetallicRoughnessMaterial(
    MetallicRoughnessMaterial 
);

Updated on 2022-10-18 at 11:12:52 +0200