Fix, assertion with shadowReceiver = false and VSM (#5055)

This commit is contained in:
Ben Doherty
2022-01-18 13:44:48 -08:00
committed by GitHub
parent 0fb04c576d
commit bf3f7e0aef
2 changed files with 7 additions and 0 deletions

View File

@@ -185,6 +185,10 @@ namespace filament {
if (isValidDepthVariant(variantKey)) {
return variantKey;
}
// if shadow receiver is disabled, turn off VSM
if (isLit && !(variantKey & SHADOW_RECEIVER)) {
return variantKey & ~VSM;
}
// when the shading mode is unlit, remove all the lighting variants
return isLit ? variantKey : (variantKey & UNLIT_MASK);
}

View File

@@ -586,8 +586,11 @@ void SimpleViewer::updateUserInterface() {
}
auto instance = rm.getInstance(entity);
bool scaster = rm.isShadowCaster(instance);
bool sreceiver = rm.isShadowReceiver(instance);
ImGui::Checkbox("casts shadows", &scaster);
rm.setCastShadows(instance, scaster);
ImGui::Checkbox("receives shadows", &sreceiver);
rm.setReceiveShadows(instance, sreceiver);
size_t numPrims = rm.getPrimitiveCount(instance);
for (size_t prim = 0; prim < numPrims; ++prim) {
const char* mname = rm.getMaterialInstanceAt(instance, prim)->getName();