Materials general shader.
More...
◆ decodeIridescence()
vec2 GPUShaders::Common::Materials::decodeIridescence |
( |
float |
ior, |
|
|
float |
thickness |
|
) |
| |
|
inline |
Convert the iridescence normalized values to the physical quantities.
- Parameters
-
ior | the normalized index of refraction |
thickness | the normalized thickness |
- Returns
- a vector containing a refraction index in [1.2, 2.4] and a thickness in [300nm, 800nm]
◆ decodeMaterial()
uint GPUShaders::Common::Materials::decodeMaterial |
( |
float |
raw | ) |
|
|
inline |
Decode a material ID from its G-buffer representation.
- Parameters
-
raw | the raw value stored in the Gbuffer |
- Returns
- the decoded material identifier
◆ decodeMaterialFromGbuffer()
Material GPUShaders::Common::Materials::decodeMaterialFromGbuffer |
( |
vec2 |
uv, |
|
|
texture2D |
gbuffer0, |
|
|
texture2D |
gbuffer1, |
|
|
texture2D |
gbuffer2 |
|
) |
| |
|
inline |
Populate material parameters from the G-buffer content.
- Parameters
-
uv | the location in the G-buffer |
gbuffer0 | first texture of the G-buffer |
gbuffer1 | second texture of the G-buffer |
gbuffer2 | third texture of the G-buffer |
- Returns
- the decoded material parameters
- Bug:
- There is a precision issue when decoding from the Gbuffer instead of an inline value.
◆ decodeMetalnessAndParameter()
void GPUShaders::Common::Materials::decodeMetalnessAndParameter |
( |
float |
raw, |
|
|
out float |
metalness, |
|
|
out float |
parameter |
|
) |
| |
|
inline |
Decode metalness and another float parameter from a unique 8-bit normalized value, using 5 bits for metalness and 3 bits ofr the other parameter.
- Parameters
-
raw | the packed input value |
metalness | will contain the normalized unpacked metalness |
parameter | will contain the normalized unpacked other parameter |
◆ decodeRgbFrom10Plus2Bits()
vec3 GPUShaders::Common::Materials::decodeRgbFrom10Plus2Bits |
( |
vec2 |
packed | ) |
|
|
inline |
Decode a RGB color from a 10 and a 2 bits normalized values
- Parameters
-
- Returns
- the decoded color
◆ encodeMaterial()
float GPUShaders::Common::Materials::encodeMaterial |
( |
uint |
material | ) |
|
|
inline |
Encode a material ID for storage in the G-buffer.
- Parameters
-
material | the identifier to encode |
- Returns
- the encoded value as a normalized float
◆ encodeMetalnessAndParameter()
float GPUShaders::Common::Materials::encodeMetalnessAndParameter |
( |
float |
metalness, |
|
|
float |
parameter |
|
) |
| |
|
inline |
Encode metalness and another float parameter into a unique 8-bit normalized value, assigning 5 bits to metalness and 3 bits to the other parameter.
- Parameters
-
metalness | the metalness |
parameter | the other parameter to pack |
- Returns
- a normalized float value storing both packed inputs
◆ encodeRgbOn10Plus2Bits()
vec2 GPUShaders::Common::Materials::encodeRgbOn10Plus2Bits |
( |
vec3 |
rgb | ) |
|
|
inline |
Store a RGB color on 12 bits, split into 10 and 2 bits for storage in the Gbuffer.
- Parameters
-
- Returns
- the 10 and 2 bits normalized values encoding the color
◆ initMaterial()
Material GPUShaders::Common::Materials::initMaterial |
( |
| ) |
|
|
inline |
Fill a material with default parameters.
- Returns
- the initialized material
The documentation for this class was generated from the following file:
- resources/pbrdemo/shaders/materials.glsl