diff --git a/Effects/model-combined.eff b/Effects/model-combined.eff index 8b70c8fb1..6f3b3174e 100644 --- a/Effects/model-combined.eff +++ b/Effects/model-combined.eff @@ -16,7 +16,12 @@ please see Docs/README.model-combined.eff for documentation 0 1.0 - null-normalmap + Aircraft/Generic/Effects/null_bumpspec.png + 2d + linear-mipmap-linear + clamp + clamp + normalized 0 @@ -1330,6 +1335,16 @@ please see Docs/README.model-combined.eff for documentation sampler-2d 1 + + normalmap_enabled + int + normalmap-enabled + + + normalmap_tiling + float + normalmap-tiling + diff --git a/Shaders/HDR/geometry-combined.frag b/Shaders/HDR/geometry-combined.frag index c31685745..a9ff63f8a 100644 --- a/Shaders/HDR/geometry-combined.frag +++ b/Shaders/HDR/geometry-combined.frag @@ -9,18 +9,24 @@ in mat3 TBN; uniform sampler2D color_tex; uniform sampler2D normal_tex; +uniform int normalmap_enabled; +uniform float normalmap_tiling; const float DEFAULT_COMBINED_METALNESS = 0.0; const float DEFAULT_COMBINED_ROUGHNESS = 0.1; vec2 encodeNormal(vec3 n); +vec3 decodeSRGB(vec3 screenRGB); void main() { - gbuffer0.rgb = pow(texture(color_tex, texCoord).rgb, vec3(2.2)); // Gamma correction + gbuffer0.rgb = decodeSRGB(texture(color_tex, texCoord).rgb); gbuffer0.a = 1.0; - vec3 normal = texture(normal_tex, texCoord).rgb * 2.0 - 1.0; + vec3 normal = vec3(0.5, 0.5, 1.0); + if (normalmap_enabled > 0) { + normal = texture(normal_tex, texCoord * normalmap_tiling).rgb * 2.0 - 1.0; + } normal = normalize(TBN * normal); gbuffer1 = encodeNormal(normal); diff --git a/Shaders/HDR/geometry.frag b/Shaders/HDR/geometry.frag index a051ae953..9ec86494f 100644 --- a/Shaders/HDR/geometry.frag +++ b/Shaders/HDR/geometry.frag @@ -13,10 +13,11 @@ const float DEFAULT_METALNESS = 0.0; const float DEFAULT_ROUGHNESS = 0.8; vec2 encodeNormal(vec3 n); +vec3 decodeSRGB(vec3 screenRGB); void main() { - gbuffer0.rgb = pow(texture(color_tex, texCoord).rgb, vec3(2.2)); // Gamma correction + gbuffer0.rgb = decodeSRGB(texture(color_tex, texCoord).rgb); gbuffer0.a = 1.0; gbuffer1 = encodeNormal(normalVS); gbuffer2 = vec4(DEFAULT_METALNESS,