Files
HelloVulkan/shaders/env/shadow.vert
T
atdunbg f73e52926f Reorganize directory layout: editor panels/, grouped shaders, drop stale header
- App/editor: move 7 panels into panels/ (Editor core stays at root)
- shaders/: group into pbr/ post/ debug/ env/ (runtime load paths updated)
- Delete outdated duplicate Engine/src/Renderer/VulkanAssetUploader.h
2026-10-07 09:52:17 +08:00

42 lines
1.5 KiB
GLSL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#version 450
// Shadow pass vertex:光源视角写深度。
// GPUDriven:模型矩阵经 gl_InstanceIndex 从实例缓冲取(与 Forward
// 共用同一份数据),push 只带 lightVP(全 pass 一次)。
// 骨骼蒙皮与 Forward 同一套数据(binding 3/4),阴影与主体形变一致。
layout(location = 0) in vec3 inPosition;
layout(location = 4) in uvec4 inBoneIds; // 骨骼槽(palette 下标)
layout(location = 5) in vec4 inWeights; // 蒙皮权重(无骨骼顶点 = (1,0,0,0))
layout(std430, set = 0, binding = 1) readonly buffer ObjectBuffer {
mat4 models[];
} objects;
// 骨骼蒙皮:与 simple_shader.vert 同布局(Set0 binding 3/4)
layout(std430, set = 0, binding = 3) readonly buffer SkinOffsetBuffer {
uint skinBases[];
} skinOffsets;
layout(std430, set = 0, binding = 4) readonly buffer SkinPaletteBuffer {
mat4 bones[];
} skinPalettes;
layout(push_constant) uniform PushConstants {
mat4 lightVP;
} pc;
mat4 SkinMatrix() {
uint base = skinOffsets.skinBases[gl_InstanceIndex];
return skinPalettes.bones[base + inBoneIds.x] * inWeights.x +
skinPalettes.bones[base + inBoneIds.y] * inWeights.y +
skinPalettes.bones[base + inBoneIds.z] * inWeights.z +
skinPalettes.bones[base + inBoneIds.w] * inWeights.w;
}
void main() {
mat4 skin = SkinMatrix();
vec3 skinnedPos = (skin * vec4(inPosition, 1.0)).xyz;
gl_Position = pc.lightVP * objects.models[gl_InstanceIndex] * vec4(skinnedPos, 1.0);
}