Skip to content

Instantly share code, notes, and snippets.

@afeozzz
Last active May 2, 2019 00:18
Show Gist options
  • Save afeozzz/91d30e49069c589b8722b9d1aaf21102 to your computer and use it in GitHub Desktop.
Save afeozzz/91d30e49069c589b8722b9d1aaf21102 to your computer and use it in GitHub Desktop.
Our custom material
material {
name : "Card material",
parameters : [
{
type : sampler2d,
name : baseColorMap
},
{
type : sampler2d,
name : normalMap
},
{
type : sampler2d,
name : roughnessMap
},
{
type : sampler2d,
name : metallicMap
},
{
type : sampler2d,
name : reflectanceMap
}
],
requires : [
uv0
],
shadingModel : lit,
}
fragment {
void material(inout MaterialInputs material) {
vec3 normal = texture(materialParams_normalMap, getUV0()).xyz;
material.normal = normal * 2.0 - 1.0; //bump mapping
prepareMaterial(material);
material.baseColor = texture(materialParams_baseColorMap, getUV0());
material.roughness = texture(materialParams_roughnessMap, getUV0()).r;
material.metallic = texture(materialParams_metallicMap, getUV0()).r;
material.reflectance = texture(materialParams_reflectanceMap, getUV0()).r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment