mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[vulkan] Normalize iqm normals
Same mistake as for alias, I simply forgot to do it for iqm when I got it working.
This commit is contained in:
parent
c59ab8882d
commit
18af340160
2 changed files with 8 additions and 4 deletions
|
@ -12,9 +12,9 @@ layout (push_constant) uniform PushConstants {
|
||||||
|
|
||||||
layout (location = 0) in vec2 texcoord;
|
layout (location = 0) in vec2 texcoord;
|
||||||
layout (location = 1) in vec4 position;
|
layout (location = 1) in vec4 position;
|
||||||
layout (location = 2) in vec3 normal;
|
layout (location = 2) in vec3 fnormal;
|
||||||
layout (location = 3) in vec3 tangent;
|
layout (location = 3) in vec3 ftangent;
|
||||||
layout (location = 4) in vec3 bitangent;
|
layout (location = 4) in vec3 fbitangent;
|
||||||
layout (location = 5) in vec4 color;
|
layout (location = 5) in vec4 color;
|
||||||
|
|
||||||
layout (location = 0) out vec4 frag_color;
|
layout (location = 0) out vec4 frag_color;
|
||||||
|
@ -29,6 +29,9 @@ main (void)
|
||||||
vec4 e;
|
vec4 e;
|
||||||
//vec3 n;
|
//vec3 n;
|
||||||
int i;
|
int i;
|
||||||
|
vec3 normal = normalize (fnormal);
|
||||||
|
vec3 tangent = normalize (ftangent);
|
||||||
|
vec3 bitangent = normalize (fbitangent);
|
||||||
//mat3 tbn = mat3 (tangent, bitangent, normal);
|
//mat3 tbn = mat3 (tangent, bitangent, normal);
|
||||||
|
|
||||||
c = texture (Skin, texcoord);// * color;
|
c = texture (Skin, texcoord);// * color;
|
||||||
|
|
|
@ -49,8 +49,9 @@ main (void)
|
||||||
mat3 adjTrans = mat3 (cross(m[1].xyz, m[2].xyz),
|
mat3 adjTrans = mat3 (cross(m[1].xyz, m[2].xyz),
|
||||||
cross(m[2].xyz, m[0].xyz),
|
cross(m[2].xyz, m[0].xyz),
|
||||||
cross(m[0].xyz, m[1].xyz));
|
cross(m[0].xyz, m[1].xyz));
|
||||||
normal = mat3 (Model) * vnormal * adjTrans;
|
normal = normalize (mat3 (Model) * vnormal * adjTrans);
|
||||||
tangent = mat3 (Model) * vtangent.xyz * adjTrans;
|
tangent = mat3 (Model) * vtangent.xyz * adjTrans;
|
||||||
|
tangent = normalize (tangent - dot (tangent, normal) * normal);
|
||||||
bitangent = cross (normal, tangent) * vtangent.w;
|
bitangent = cross (normal, tangent) * vtangent.w;
|
||||||
texcoord = vtexcoord;
|
texcoord = vtexcoord;
|
||||||
color = vcolor;
|
color = vcolor;
|
||||||
|
|
Loading…
Reference in a new issue