diff --git a/Effects/model-pbr.eff b/Effects/model-pbr.eff
index d97e806e4..842bb1970 100644
--- a/Effects/model-pbr.eff
+++ b/Effects/model-pbr.eff
@@ -10,32 +10,33 @@
1.0 1.0 1.0 1.0
- Aircraft/Generic/Effects/null_bumpspec.png
- 2d
- linear-mipmap-linear
- repeat
- repeat
- normalized
+ null-normalmap
-
+
white
1.0
-
+ 1.0
+
white
- 1.0
-
+
white
-
-
- white
-
0.0 0.0 0.0
+
+
+ false
+
+ opaque
+ -1.0
+
+ back
+
+ false
@@ -51,56 +52,49 @@
+
-
1
+
-
2
+
-
3
+
-
4
+
-
-
- 5
-
-
-
-
-
-
-
- back
+
+
+
Shaders/HDR/geometry-pbr.vert
Shaders/HDR/geometry-pbr.frag
@@ -125,24 +119,19 @@
1
- metallic_tex
+ metallic_roughness_tex
sampler-2d
2
- roughness_tex
+ occlusion_tex
sampler-2d
3
-
- occlusion_tex
- sampler-2d
- 4
-
emissive_tex
sampler-2d
- 5
+ 4
base_color_factor
@@ -164,6 +153,16 @@
float-vec3
+
+ alpha_cutoff
+ float
+
+
+
+ flip_vertically
+ bool
+
+
diff --git a/Shaders/HDR/geometry-pbr.frag b/Shaders/HDR/geometry-pbr.frag
index c00d4a589..ce486ab5e 100644
--- a/Shaders/HDR/geometry-pbr.frag
+++ b/Shaders/HDR/geometry-pbr.frag
@@ -9,22 +9,27 @@ in mat3 TBN;
uniform sampler2D base_color_tex;
uniform sampler2D normal_tex;
-uniform sampler2D metallic_tex;
-uniform sampler2D roughness_tex;
+uniform sampler2D metallic_roughness_tex;
uniform sampler2D occlusion_tex;
uniform sampler2D emissive_tex;
uniform vec4 base_color_factor;
uniform float metallic_factor;
uniform float roughness_factor;
uniform vec3 emissive_factor;
+uniform float alpha_cutoff;
vec2 encodeNormal(vec3 n);
vec3 decodeSRGB(vec3 screenRGB);
void main()
{
- vec4 base_color_texel = texture(base_color_tex, texCoord);
- gbuffer0.rgb = decodeSRGB(base_color_texel.rgb); // Ignore alpha
+ vec4 baseColorTexel = texture(base_color_tex, texCoord);
+ vec4 baseColor = vec4(decodeSRGB(baseColorTexel.rgb), baseColorTexel.a)
+ * base_color_factor;
+ if (baseColor.a < alpha_cutoff)
+ discard;
+ gbuffer0.rgb = baseColor.rgb;
+
float occlusion = texture(occlusion_tex, texCoord).r;
gbuffer0.a = occlusion;
@@ -32,8 +37,9 @@ void main()
normal = normalize(TBN * normal);
gbuffer1 = encodeNormal(normal);
- float metallic = texture(metallic_tex, texCoord).r * metallic_factor;
- float roughness = texture(roughness_tex, texCoord).r * roughness_factor;
+ vec4 metallicRoughness = texture(metallic_roughness_tex, texCoord);
+ float metallic = metallicRoughness.r * metallic_factor;
+ float roughness = metallicRoughness.g * roughness_factor;
gbuffer2 = vec4(metallic, roughness, 0.0, 0.0);
vec3 emissive = texture(emissive_tex, texCoord).rgb * emissive_factor;
diff --git a/Shaders/HDR/geometry-pbr.vert b/Shaders/HDR/geometry-pbr.vert
index f1ad780f5..bbd2f50ed 100644
--- a/Shaders/HDR/geometry-pbr.vert
+++ b/Shaders/HDR/geometry-pbr.vert
@@ -12,10 +12,14 @@ out mat3 TBN;
uniform mat4 osg_ModelViewProjectionMatrix;
uniform mat3 osg_NormalMatrix;
+uniform bool flip_vertically;
+
void main()
{
gl_Position = osg_ModelViewProjectionMatrix * pos;
texCoord = multiTexCoord0.st;
+ if (flip_vertically)
+ texCoord.y = 1.0 - texCoord.y;
vec3 T = normalize(osg_NormalMatrix * tangent);
vec3 B = normalize(osg_NormalMatrix * binormal);