45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
// Textured material
|
|
|
|
material {
|
|
name : parquet,
|
|
shadingModel : lit,
|
|
parameters : [
|
|
// Base color sRGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : baseColor
|
|
},
|
|
// Packed ambient occlusion/roughness/metallic RGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : aoRoughnessMetallic
|
|
},
|
|
// Normal map RGB texture
|
|
{
|
|
type : sampler2d,
|
|
name : normal
|
|
}
|
|
],
|
|
// To sample textures our material must declare that it requires
|
|
// a set of UV coordinates from the rendered mesh
|
|
requires: [
|
|
uv0
|
|
]
|
|
}
|
|
|
|
fragment {
|
|
void material(inout MaterialInputs material) {
|
|
// The normal map must be set *before* calling prepareMaterial()
|
|
material.normal = texture(materialParams_normal, getUV0()).xyz * 2.0 - 1.0;
|
|
|
|
prepareMaterial(material);
|
|
|
|
material.baseColor = texture(materialParams_baseColor, getUV0());
|
|
|
|
vec3 aoRoughnessMetallic = texture(materialParams_aoRoughnessMetallic, getUV0()).rgb;
|
|
material.ambientOcclusion = aoRoughnessMetallic.r;
|
|
material.roughness = aoRoughnessMetallic.g;
|
|
material.metallic = aoRoughnessMetallic.b;
|
|
}
|
|
}
|