From 2e2c57a8c04575eec164279a49947cfdba250853 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Fri, 26 Jul 2024 23:15:22 +1000 Subject: scenes and pbr cleanup to handle missing texture of param --- assets/shaders/pbr_textured.frag | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'assets') diff --git a/assets/shaders/pbr_textured.frag b/assets/shaders/pbr_textured.frag index 5353fa7..8148f05 100644 --- a/assets/shaders/pbr_textured.frag +++ b/assets/shaders/pbr_textured.frag @@ -21,11 +21,16 @@ uniform Lights { PointLight pointLights[NUM_POINT_LIGHTS]; } scene; +uniform PBR_Params { + vec3 albedo; + float metallic; + float roughness; + float ao; +} params; // Material Textures uniform sampler2D albedoMap; uniform sampler2D metallicRoughnessMap; -// uniform sampler2D roughnessMap; uniform sampler2D aoMap; uniform sampler2D normalMap; @@ -56,9 +61,9 @@ vec3 getNormalFromMap() void main() { // vec3 albedo = pow(texture(albedoMap, fragTexCoords).rgb, vec3(2.2)); - vec3 albedo = texture(albedoMap, fragTexCoords).rgb; - float metallic = texture(metallicRoughnessMap, fragTexCoords).b; - float roughness = texture(metallicRoughnessMap, fragTexCoords).g; + vec3 albedo = params.albedo * texture(albedoMap, fragTexCoords).rgb; + float metallic = params.metallic * texture(metallicRoughnessMap, fragTexCoords).b; + float roughness = params.roughness * texture(metallicRoughnessMap, fragTexCoords).g; float ao = texture(aoMap, fragTexCoords).r; // vec3 norm = normalize(fragNormal); // N -- cgit v1.2.3-70-g09d2