Skip to content

Instantly share code, notes, and snippets.

@yakivmospan
Created November 19, 2018 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakivmospan/43221b89e68e1fd3c5678a653859cf33 to your computer and use it in GitHub Desktop.
Save yakivmospan/43221b89e68e1fd3c5678a653859cf33 to your computer and use it in GitHub Desktop.
material {
name : "Textured material",
parameters : [
{
type : sampler2d,
name : baseColorMap
},
{
type : sampler2d,
name : normalMap
},
{
type : sampler2d,
name : metallicMap
},
{
type : sampler2d,
name : roughnessMap
}
],
requires : [
uv0
],
shadingModel : lit,
blending : opaque
}
fragment {
void material(inout MaterialInputs material) {
vec3 normal = texture(materialParams_normalMap, getUV0()).xyz;
material.normal = normal * 2.0 - 1.0;
prepareMaterial(material);
material.baseColor = texture(materialParams_baseColorMap, getUV0());
material.metallic = texture(materialParams_metallicMap, getUV0()).r;
material.roughness = texture(materialParams_roughnessMap, getUV0()).r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment