mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vulkan] Get spotlight shadows working
They currently have a hard-coded bias of 0.5 pixels (if I'm doing my math correctly) to combat the shadow acne, but look pretty good.
This commit is contained in:
parent
a626dc7ca8
commit
1fe0f5ffd5
3 changed files with 10 additions and 3 deletions
|
@ -1555,7 +1555,7 @@ renderpasses = {
|
|||
color = {
|
||||
light = {
|
||||
layout = color_attachment_optimal;
|
||||
blend = $blend_disable;
|
||||
blend = $additive_blend;
|
||||
};
|
||||
};
|
||||
preserve = (depth, output);
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
#version 450
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
layout (set = 0, binding = 0) buffer ShadowMatrices {
|
||||
mat4 shadow_mats[];
|
||||
};
|
||||
layout (set = 3, binding = 0) uniform sampler2DArrayShadow shadow_map[32];
|
||||
|
||||
float
|
||||
shadow (uint map_id, uint layer, uint mat_id, vec3 pos)
|
||||
{
|
||||
return 1;
|
||||
vec4 p = shadow_mats[mat_id] * vec4 (pos, 1);
|
||||
p = p / (p.w - 0.5); //FIXME hard-coded bias
|
||||
float depth = p.z;
|
||||
vec2 uv = (p.xy + vec2(1)) / 2;
|
||||
return texture (shadow_map[map_id], vec4 (uv, layer, depth));
|
||||
}
|
||||
|
||||
#include "lighting_main.finc"
|
||||
|
|
|
@ -112,7 +112,7 @@ samplers = {
|
|||
anisotropyEnable = false;
|
||||
maxAnisotropy = 0;
|
||||
compareEnable = true;
|
||||
compareOp = less;
|
||||
compareOp = greater_or_equal;
|
||||
minLod = 0;
|
||||
maxLod = 1000;
|
||||
borderColor = float_opaque_white;
|
||||
|
|
Loading…
Reference in a new issue