quakeforge/libs/video/renderer/vulkan/shader/qskin_fwd.frag
Bill Currie 93d860472d [vulkan] Use the same fragment shader for alias and iqm
In a quake context, I suspect iqm models should use the same skin
concepts as alias models. I'll probably be proven wrong, but it should
make things nicer for now, especially with forward lighting. However,
Mr Fixit is too bright because the skin isn't set up correctly.

Deferred is getting more and more smashed, but I'll fix that up when
I've got forward "done".
2024-01-20 09:44:29 +09:00

30 lines
798 B
GLSL

#version 450
layout (set = 1, binding = 0) uniform sampler2D Palette;
layout (set = 2, binding = 0) uniform sampler2DArray Skin;
layout (push_constant) uniform PushConstants {
layout (offset = 68)
uint colors;
vec4 base_color;
vec4 fog;
};
layout (location = 0) in vec2 st;
layout (location = 1) in vec4 position;
layout (location = 2) in vec3 normal;
layout (location = 0) out vec4 frag_color;
void
main (void)
{
vec4 c = texture (Skin, vec3 (st, 0)) * base_color;
vec4 e = texture (Skin, vec3 (st, 1));
vec4 rows = unpackUnorm4x8(colors);
vec4 cmap = texture (Skin, vec3 (st, 2));
c += texture (Palette, vec2 (cmap.x, rows.x)) * cmap.y;
c += texture (Palette, vec2 (cmap.z, rows.y)) * cmap.w;
frag_color = c + e;//fogBlend (c);
}