Add support for basic PCSS

This commit is contained in:
Mathias Agopian
2021-12-08 00:17:12 -06:00
committed by Mathias Agopian
parent 332d5681e6
commit 078de4e422
23 changed files with 371 additions and 55 deletions
+6 -1
View File
@@ -768,7 +768,7 @@ void SimpleViewer::updateUserInterface() {
int shadowType = (int)mSettings.view.shadowType;
ImGui::Combo("Shadow type", &shadowType, "PCF\0VSM\0DPCF\0\0");
ImGui::Combo("Shadow type", &shadowType, "PCF\0VSM\0DPCF\0PCSS\0\0");
mSettings.view.shadowType = (ShadowType)shadowType;
if (mSettings.view.shadowType == ShadowType::VSM) {
@@ -789,6 +789,9 @@ void SimpleViewer::updateUserInterface() {
//ImGui::SliderFloat("VSM exponent", &mSettings.view.vsmShadowOptions.exponent, 0.0, 6.0f);
//ImGui::SliderFloat("VSM Light bleed", &mSettings.view.vsmShadowOptions.lightBleedReduction, 0.0, 1.0f);
//ImGui::SliderFloat("VSM min variance scale", &mSettings.view.vsmShadowOptions.minVarianceScale, 0.0, 10.0f);
} else if (mSettings.view.shadowType == ShadowType::DPCF || mSettings.view.shadowType == ShadowType::PCSS) {
ImGui::SliderFloat("Penumbra scale", &light.softShadowOptions.penumbraScale, 0.0f, 100.0f);
ImGui::SliderFloat("Penumbra Ratio scale", &light.softShadowOptions.penumbraRatioScale, 1.0f, 100.0f);
}
int shadowCascades = light.shadowOptions.shadowCascades;
@@ -918,6 +921,8 @@ void SimpleViewer::updateUserInterface() {
// so we can now push them into the Filament View.
applySettings(mSettings.view, mView);
mView->setSoftShadowOptions(mSettings.lighting.softShadowOptions);
if (light.enableSunlight) {
mScene->addEntity(mSunlight);
auto sun = lm.getInstance(mSunlight);