Run shadow render pass and compute light position in vertex shaders

This commit is contained in:
Camden Dixie O'Brien committed 2025-10-04 21:27:46 +01:00
1 parent 73340b3a39
commit 633a922e42
6 files changed
+121 -23

No files matched your search

+9 -5
View File
@@ -6,10 +6,12 @@ layout(location = 2) in uvec4 bone_indices;
layout(location = 3) in vec4 weights;
layout(location = 0) out vec3 frag_normal;
layout(location = 1) out vec4 light_pos;
layout(push_constant) uniform vp_t {
mat4 transform;
} vp;
layout(push_constant) uniform push_t {
mat4 vp;
mat4 light_vp;
} push;
layout(binding = 0) uniform transform_t {
mat4 model;
@@ -25,8 +27,10 @@ void main() {
+ weights.y * bones.matrices[bone_indices.y]
+ weights.z * bones.matrices[bone_indices.z]
+ weights.w * bones.matrices[bone_indices.w];
gl_Position = vp.transform * transform.model * skinning_matrix
* vec4(position, 1.0);
const vec4 world_pos
= transform.model * skinning_matrix * vec4(position, 1.0);
gl_Position = push.vp * world_pos;
frag_normal = transpose(
inverse(mat3(transform.model * skinning_matrix))) * normal;
light_pos = push.light_vp * world_pos;
}