quakeforge/libs/video/renderer/vulkan/shader/iqm.frag
Bill Currie ff27da4a05 [vulkan] Use the shadow matrices when rendering maps
It turns out bsp faces are still back-face culled despite the null point
being on the front of every possible plane... or really, because it's on
the front of every possible plane: sometimes the back face is the front
face, and this breaks the face selection code (a separate traversal
function will be needed for non-culling rendering).

Despite that, other than having to deal with different pipelines,
getting the model renderers working went better than expected.
2023-07-30 11:52:13 +09:00

48 lines
1.4 KiB
GLSL

#version 450
layout (set = 2, binding = 0) uniform sampler2D Skin;
layout (push_constant) uniform PushConstants {
layout (offset = 72)
uint colorA;
uint colorB;
vec4 base_color;
vec4 fog;
};
layout (location = 0) in vec2 texcoord;
layout (location = 1) in vec4 position;
layout (location = 2) in vec3 fnormal;
layout (location = 3) in vec3 ftangent;
layout (location = 4) in vec3 fbitangent;
layout (location = 5) in vec4 color;
layout (location = 0) out vec4 frag_color;
layout (location = 1) out vec4 frag_emission;
layout (location = 2) out vec4 frag_normal;
layout (location = 3) out vec4 frag_position;
void
main (void)
{
vec4 c;
vec4 e;
//vec3 n;
int i;
vec3 normal = normalize (fnormal);
vec3 tangent = normalize (ftangent);
vec3 bitangent = normalize (fbitangent);
//mat3 tbn = mat3 (tangent, bitangent, normal);
c = texture (Skin, texcoord);// * color;
//c = texture (Skin, vec3 (texcoord, 0)) * color;
//c += texture (Skin, vec3 (texcoord, 1)) * unpackUnorm4x8(colorA);
//c += texture (Skin, vec3 (texcoord, 2)) * unpackUnorm4x8(colorB);
//e = texture (Skin, vec3 (texcoord, 3));
//n = texture (Skin, vec3 (texcoord, 4)).xyz * 2 - 1;
frag_color = c;
frag_emission = vec4(0,0,0,1);//e;
frag_normal = vec4(normal,1);//vec4(tbn * n, 1);
frag_position = position;
}