Skip to content

Commit f71f222

Browse files
committed
wip
1 parent d3220f0 commit f71f222

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

HelloVulkan/Source/Apps/AppPBRShadow.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,6 @@ void AppPBRShadow::UpdateUBOs()
146146
skyboxUbo.view = glm::mat4(glm::mat3(skyboxUbo.view));
147147
skyboxPtr_->SetCameraUBO(vulkanContext_, skyboxUbo);
148148

149-
// Shadow mapping
150-
// Temp
151-
/*for (size_t i = 0; i < ShadowConfig::CascadeCount; ++i)
152-
{
153-
shadowUBO_.lightSpaceMatrices[i] = glm::mat4(1.0f);
154-
shadowUBO_.splitValues[i] = (i + 1) * 2;
155-
}*/
156-
157-
//LightData light = resLights_->lights_[0];
158-
/*glm::mat4 lightProjection = glm::perspective(glm::radians(45.f), 1.0f, shadowUBO_.shadowNearPlane, shadowUBO_.shadowFarPlane);
159-
glm::mat4 lightView = glm::lookAt(glm::vec3(light.position_), glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));
160-
glm::mat4 lightSpaceMatrix = lightProjection * lightView;
161-
shadowUBO_.lightSpaceMatrices[0] = lightSpaceMatrix;
162-
shadowUBO_.lightPosition = light.position_;
163-
*/
164149
shadowPtr_->CalculateCascade(vulkanContext_, camera_.get(), & (resLight_->lights_[0]), &shadowUBO_);
165150
pbrPtr_->SetShadowMapConfigUBO(vulkanContext_, shadowUBO_);
166151
}
@@ -207,7 +192,7 @@ void AppPBRShadow::UpdateUI()
207192
ImGui::SliderFloat("Max Bias", &staticShadowUBO.shadowMaxBias, 0.001f, 0.1f);
208193
ImGui::SliderFloat("Near Plane", &staticShadowUBO.shadowNearPlane, 0.1f, 50.0f);
209194
ImGui::SliderFloat("Far Plane", &staticShadowUBO.shadowFarPlane, 10.0f, 150.0f);
210-
ImGui::SliderFloat("PCF Scale", &staticShadowUBO.pcfScale, 0.1f, 1.0f);
195+
ImGui::SliderFloat("PCF Scale", &staticShadowUBO.pcfScale, 0.1f, 3.0f);
211196
ImGui::SliderInt("PCF Iteration", &staticPCFIteration, 1, 10);
212197

213198
ImGui::SeparatorText("Light position");

Shaders/ShadowMapping/PCF.glsl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ float ShadowPCF(vec4 sc, uint cascadeIndex)
99
vec3 lightDir = normalize(shadowUBO.lightPosition.xyz - worldPos);
1010
float bias = max(shadowUBO.shadowMaxBias * (1.0 - dot(N, lightDir)), shadowUBO.shadowMinBias);
1111

12-
// TODO Very slow, consider change to a constant for better performance
13-
//const int range = 2;
14-
int range = int(shadowUBO.pcfIteration);
12+
const int range = 2;
1513
float shadow = 0.0;
1614
int count = 0;
1715
for (int x = -range; x <= range; x++)

0 commit comments

Comments
 (0)