diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index ca74f938..7221f55d 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -2419,7 +2419,7 @@ Components: Transform Component: Translate: {x: 0, y: 0, z: 0} - Rotate: {x: -7.50001717, y: 1.39999998, z: -3.50001717} + Rotate: {x: -1.48352981, y: 1.39999998, z: -3.50001717} Scale: {x: 1, y: 1, z: 1} IsActive: true Renderable Component: @@ -6858,8 +6858,8 @@ NumberOfChildren: 0 Components: Transform Component: - Translate: {x: 2.13981342, y: 0.0490087792, z: -1.96055627} - Rotate: {x: 0, y: -1.53675354, z: 0} + Translate: {x: 2.13981342, y: 0.0490087792, z: -1.86932743} + Rotate: {x: -0, y: -1.53675354, z: 0} Scale: {x: 1, y: 1, z: 1} IsActive: true Renderable Component: @@ -8216,4 +8216,24 @@ Hovered: false Clicked: false IsActive: true + Scripts: ~ +- EID: 503 + Name: DirectionalLight + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: -0.407547206, y: 3.60323787, z: 2.62217617} + Rotate: {x: -0, y: 0, z: -0} + Scale: {x: 1, y: 1, z: 1} + IsActive: true + Light Component: + Position: {x: 0.300000012, y: 0, z: 0} + Type: Directional + Direction: {x: -1.15900004, y: 4.79300022, z: -0.994000018} + Color: {x: 1, y: 1, z: 1, w: 1} + Layer: 4294967295 + Strength: 0.800000012 + Casting Shadows: true + IsActive: true Scripts: ~ \ No newline at end of file diff --git a/Assets/Shaders/Silhouette_VS.glsl b/Assets/Shaders/Silhouette_VS.glsl index 1b45c333..a7fe585d 100644 --- a/Assets/Shaders/Silhouette_VS.glsl +++ b/Assets/Shaders/Silhouette_VS.glsl @@ -40,6 +40,12 @@ layout(set = 1, binding = 0) uniform CameraData mat4 projMat; } cameraData; +layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices +{ + mat4 data[]; +} BoneMatrices; + + void main() { Out2.materialIndex = gl_InstanceIndex; @@ -63,6 +69,13 @@ void main() Out.normal.rgb = transposeInv * aNormal.rgb; Out.normal.rgb = normalize (Out.normal.rgb); + // Compute bone matrix + mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2]; + boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3]; + // clip space for rendering - gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); + gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f); + // gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/Silhouette_VS.shshaderb b/Assets/Shaders/Silhouette_VS.shshaderb index 1bb76ec4..63185558 100644 Binary files a/Assets/Shaders/Silhouette_VS.shshaderb and b/Assets/Shaders/Silhouette_VS.shshaderb differ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp index ae2b6f35..3f312532 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.cpp @@ -337,9 +337,9 @@ namespace SHADE shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) }); shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots) - shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::UINT32_4D) }, 9, 9); // Attribute bone indices at index 5 - shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_4D) }, 10, 10); // Attribute bone weights at index 6 - shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::UINT32_1D) }, 11, 11); // Instance bone matrix first index at index 7 + shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::UINT32_4D) }, 6, 9); // Attribute bone indices at index 5 + shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_4D) }, 7, 10); // Attribute bone weights at index 6 + shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::UINT32_1D) }, 8, 11); // Instance bone matrix first index at index 7 //shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) }); diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp index 87b3fc10..7eccbc52 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp @@ -496,7 +496,7 @@ namespace SHADE { if (!dummyPipelineLayout) { - auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING); + auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM); std::vector newLayouts = batchingSystemData.descSetLayouts; if (inputDescriptorLayout) {