Changes to shadowpass
This commit is contained in:
@@ -673,6 +673,10 @@ void BasePass::createRenderPass() {
|
||||
{
|
||||
.polygonMode = Gfx::SE_POLYGON_MODE_FILL,
|
||||
},
|
||||
.depthStencilState = {
|
||||
.depthTestEnable = true,
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
.attachmentCount = 1,
|
||||
|
||||
@@ -50,10 +50,10 @@ void ShadowPass::beginFrame(const Component::Camera& camera, const Component::Tr
|
||||
|
||||
float nearClip = camera.nearPlane;
|
||||
float farClip = camera.farPlane;
|
||||
float clipRange = nearClip - farClip;
|
||||
float clipRange = farClip - nearClip;
|
||||
|
||||
float minZ = farClip;
|
||||
float maxZ = nearClip;
|
||||
float minZ = nearClip;
|
||||
float maxZ = farClip;
|
||||
|
||||
float range = maxZ - minZ;
|
||||
float ratio = maxZ / minZ;
|
||||
@@ -63,8 +63,8 @@ void ShadowPass::beginFrame(const Component::Camera& camera, const Component::Tr
|
||||
float log = minZ * std::pow(ratio, p);
|
||||
float uniform = minZ + range * p;
|
||||
float d = cascadeSplitLambda * (log - uniform) + uniform;
|
||||
cascadeSplits[i] = (d - farClip) / clipRange;
|
||||
splitDepths[i] = farClip + cascadeSplits[i] * clipRange;
|
||||
cascadeSplits[i] = (d - nearClip) / clipRange;
|
||||
splitDepths[i] = farClip - cascadeSplits[i] * clipRange;
|
||||
cascades[i].viewParams.clear();
|
||||
}
|
||||
cascadeSplitsBuffer->updateContents(0, sizeof(float) * NUM_CASCADES, splitDepths);
|
||||
@@ -111,7 +111,7 @@ void ShadowPass::beginFrame(const Component::Camera& camera, const Component::Tr
|
||||
Vector cameraPos = frustumCenter - lightDir * -minExtents.z;
|
||||
Matrix4 viewMatrix = glm::lookAt(cameraPos, frustumCenter, Vector(0, 1, 0));
|
||||
Matrix4 projectionMatrix =
|
||||
orthographicProjection(minExtents.x, maxExtents.x, minExtents.y, maxExtents.y, 0.0f, maxExtents.z - minExtents.z);
|
||||
orthographicProjection(minExtents.x, maxExtents.x, minExtents.y, maxExtents.y, maxExtents.z - minExtents.z, 0.0f);
|
||||
Matrix4 viewProjectionMatrix = projectionMatrix * viewMatrix;
|
||||
viewParams = {
|
||||
.viewMatrix = viewMatrix,
|
||||
|
||||
@@ -619,7 +619,7 @@ void VertexData::loadMeshlets(MeshId id, const Array<Vector>& loadedPositions, c
|
||||
// todo: use meshopt for bb generation
|
||||
m.bounding = AABB();
|
||||
for (size_t j = 0; j < m.vertexIndices.size; ++j) {
|
||||
m.bounding.adjust(loadedPositions[vertexIndices[meshoptMeshlets[i].vertex_offset + j]]);
|
||||
m.bounding.adjust(loadedPositions[vertexIndices[meshoptMeshlets[i].vertex_offset + j + m.indicesOffset]]);
|
||||
}
|
||||
}
|
||||
registeredMeshes[id].meshData = MeshData{
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
DescriptorSetHandle(PGraphics graphics, const std::string& name);
|
||||
virtual ~DescriptorSetHandle();
|
||||
constexpr VkDescriptorSet getHandle() const { return handle; }
|
||||
PGraphics graphics;
|
||||
VkDescriptorSet handle = VK_NULL_HANDLE;
|
||||
OBufferAllocation constantsBuffer;
|
||||
bool isUsed = false;
|
||||
|
||||
Reference in New Issue
Block a user