veloren/assets/voxygen/shaders/player-shadow-frag.glsl

49 lines
866 B
Plaintext
Raw Normal View History

2020-04-04 19:36:55 +00:00
#version 330 core
#include <globals.glsl>
in vec3 f_pos;
in vec3 f_col;
flat in vec3 f_norm;
2020-04-25 20:23:57 +00:00
in float f_ao;
in float f_alt;
in vec4 f_shadow;
2020-04-04 19:36:55 +00:00
layout (std140)
uniform u_locals {
mat4 model_mat;
vec4 model_col;
int flags;
};
struct BoneData {
mat4 bone_mat;
};
layout (std140)
uniform u_bones {
BoneData bones[16];
};
#include <sky.glsl>
#include <light.glsl>
#include <srgb.glsl>
out vec4 tgt_color;
void main() {
float distance = distance(vec3(cam_pos), vec3(model_mat * vec4(vec3(0), 1))) - 2;
float opacity = clamp(distance / distance_divider, 0, 1);
if(threshold_matrix[int(gl_FragCoord.x) % 4][int(gl_FragCoord.y) % 4] > opacity) {
discard;
}
if(threshold_matrix[int(gl_FragCoord.x) % 4][int(gl_FragCoord.y) % 4] > shadow_dithering) {
discard;
}
2020-04-04 19:36:55 +00:00
tgt_color = vec4(0.0,0.0,0.0, 1.0);
2020-04-25 20:23:57 +00:00
}