1
0
Fork 0

HDR: Fix model-combined when not using a normal map

This commit is contained in:
Fernando García Liñán 2021-08-25 16:49:08 +02:00
parent beb4381ad1
commit a789c24209
2 changed files with 16 additions and 6 deletions

View file

@ -9,6 +9,8 @@ layout(location = 7) in vec3 binormal;
out vec2 texCoord;
out mat3 TBN;
uniform int normalmap_enabled;
uniform mat4 osg_ModelViewProjectionMatrix;
uniform mat3 osg_NormalMatrix;
@ -17,8 +19,16 @@ void main()
gl_Position = osg_ModelViewProjectionMatrix * pos;
texCoord = multiTexCoord0.st;
vec3 T = normalize(osg_NormalMatrix * tangent);
vec3 B = normalize(osg_NormalMatrix * binormal);
vec3 N = normalize(osg_NormalMatrix * normal);
TBN = mat3(T, B, N);
vec3 N = normalize(normal);
vec3 T, B;
if (normalmap_enabled > 0) {
T = tangent;
B = binormal;
} else {
T = cross(N, vec3(1.0, 0.0, 0.0));
B = cross(N, T);
}
TBN = mat3(normalize(osg_NormalMatrix * T),
normalize(osg_NormalMatrix * B),
normalize(osg_NormalMatrix * N));
}

View file

@ -386,8 +386,8 @@ Started September 2000 by David Megginson, david@megginson.com
<hdr>
<antialiasing-technique type="int" userarchive="y">2</antialiasing-technique>
<exposure-compensation type="float">0.0</exposure-compensation>
<bloom-magnitude type="float">1.0</bloom-magnitude>
<bloom-threshold type="float">6.0</bloom-threshold>
<bloom-magnitude type="float">0.5</bloom-magnitude>
<bloom-threshold type="float">8.0</bloom-threshold>
<debug>
<show-gbuffer type="bool">false</show-gbuffer>
<display-ev100 type="bool">false</display-ev100>