- float metallic = texture(metallicRoughnessMap, texCoords).b;
- float roughness = texture(metallicRoughnessMap, texCoords).g;
- float ao = texture(aoMap, texCoords).r;
+
+ float metallic = 0, roughness = 1;
+ if (mat.hasMetallicRoughness) {
+ metallic = texture(mat.metallicRoughnessMap, texCoords).b;
+ roughness = texture(mat.metallicRoughnessMap, texCoords).g;
+ }
+ float ao = mat.hasAo ? texture(mat.aoMap, texCoords).r : 1;