thinking about shaders
This commit is contained in:
@@ -36,16 +36,17 @@ float fetch_shadow(int light_id, vec4 homogeneous_coords) {
|
||||
if (homogeneous_coords.w <= 0.0) {
|
||||
return 1.0;
|
||||
}
|
||||
// compensate for the Y-flip difference between the NDC and texture coordinates
|
||||
// compensate for the Y-flip difference between the normalized device
|
||||
// coordinates (NDC) and texture coordinates
|
||||
const vec2 flip_correction = vec2(0.5, -0.5);
|
||||
// compute texture coordinates for shadow lookup
|
||||
vec4 light_local = vec4(
|
||||
// I don't know what kind of jank shit is going on on this line
|
||||
homogeneous_coords.xy * flip_correction/homogeneous_coords.w + 0.5,
|
||||
light_id,
|
||||
homogeneous_coords.z / homogeneous_coords.w
|
||||
light_id, // array layer
|
||||
homogeneous_coords.z / homogeneous_coords.w // D-Ref
|
||||
);
|
||||
// do the lookup, using HW PCF and comparison
|
||||
// do the lookup, using HW percentage closer filtering(PCF) and comparison
|
||||
return texture(sampler2DArrayShadow(t_Shadow, s_Shadow), light_local);
|
||||
}
|
||||
|
||||
|
||||
4
shaders/g_buffer_input.frag
Normal file
4
shaders/g_buffer_input.frag
Normal file
@@ -0,0 +1,4 @@
|
||||
#version 450
|
||||
|
||||
void main() {
|
||||
}
|
||||
20
shaders/g_buffer_input.vert
Normal file
20
shaders/g_buffer_input.vert
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 a_Pos;
|
||||
|
||||
layout(set = 0, binding = 0) uniform Globals {
|
||||
mat4 u_ViewProj;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 1) uniform Globals {
|
||||
mat4 u_ViewProj;
|
||||
};
|
||||
|
||||
layout(set = 1, binding = 0) uniform Entity {
|
||||
mat4 u_World;
|
||||
vec4 u_Color;
|
||||
};
|
||||
|
||||
void main() {
|
||||
gl_Position = u_ViewProj * u_World * vec4(a_Pos);
|
||||
}
|
||||
Reference in New Issue
Block a user