QtCraft API C++ classes QML types Handbook

QcMaterialParams Struct

The surface of one procedural texture for its material maps (decision E-908), before it is painted per texel by QcMaterialSynthesizer. More...

Header: #include <clientcore/materials/QcMaterialParams.h>

Public Types

struct Inclusion
enum class Metal { None, Iron, Gold, Aluminium, Chrome, …, Albedo }

Public Variables

float bump
float emission
float emissionTexels
std::optional<QcMaterialParams::Inclusion> inclusion
QcMaterialParams::Metal metal
float porosity
int reflectance
float smoothness

Static Public Members

QcMaterialParams flat()
std::optional<QcMaterialParams::Metal> metalFromName(const QString &name)
QcMaterialParams withOverrides(QcMaterialParams base, const QJsonObject &material)

Detailed Description

Values follow the labPBR conventions of the reference game's shader packs: perceptual smoothness 0..1, reflectance at normal incidence (F0) as a code 0..229 for dielectrics (F0 = code / 255) or a metal code 230..237 (QcMaterialParams::Metal), 255 for a metal coloured by the texture itself, porosity 0..1 and emission 0..1.

Member Type Documentation

enum class QcMaterialParams::Metal

The labPBR codes of the hardcoded metals (green channel of the specular map).

ConstantValueDescription
QcMaterialParams::Metal::None0A dielectric, F0 from reflectance
QcMaterialParams::Metal::Iron230Iron
QcMaterialParams::Metal::Gold231Gold
QcMaterialParams::Metal::Aluminium232Aluminium
QcMaterialParams::Metal::Chrome233Chrome
QcMaterialParams::Metal::Copper234Copper
QcMaterialParams::Metal::Lead235Lead
QcMaterialParams::Metal::Platinum236Platinum
QcMaterialParams::Metal::Silver237Silver
QcMaterialParams::Metal::Albedo255A metal coloured by the texture itself

Member Function Documentation

[static] QcMaterialParams QcMaterialParams::flat()

Returns the flat material of textures without maps: smooth 0, F0 0.04, no relief, no light.

[static] std::optional<QcMaterialParams::Metal> QcMaterialParams::metalFromName(const QString &name)

Returns the metal called name ("iron", "gold", …; "albedo"), unset for unknown names.

[static] QcMaterialParams QcMaterialParams::withOverrides(QcMaterialParams base, const QJsonObject &material)

Returns base with the fields of a "material" object of a texture definition or pack spec, material (docs/Texturpakete.md): smoothness, reflectance, metal, bump, porosity, emission, emissionTexels; unknown or out-of-range values keep the base value.

Member Variable Documentation

float QcMaterialParams::bump

Strength of the normals from the texture's brightness (0: flat).

float QcMaterialParams::emission

Light of its own: 0 none; else the share of the brightest texels that glow (emissionTexels) with this strength.

float QcMaterialParams::emissionTexels

Share (0..1) of the brightest texels that glow when emission > 0.

std::optional<QcMaterialParams::Inclusion> QcMaterialParams::inclusion

What the texels of the secondary colour get; unset: the same as the rest.

QcMaterialParams::Metal QcMaterialParams::metal

Metal code; None for a dielectric.

float QcMaterialParams::porosity

How much water the surface takes in (darker and smoother when wet).

int QcMaterialParams::reflectance

F0 * 255 of a dielectric (10: 0.04, most stone and wood); unused for a metal.

float QcMaterialParams::smoothness

Perceptual smoothness (0..1).