Add a "stable" shadow-map option

- "stable" mode disables all resolution optimizations that can affect
stability of the shadow map (e.g. lispsm, focusing)

- expose near/far hint + stable option to java
This commit is contained in:
Mathias Agopian
2019-04-05 11:29:56 -07:00
committed by Mathias Agopian
parent 147dfec5e5
commit bc381ac1b7
9 changed files with 131 additions and 66 deletions
@@ -64,10 +64,17 @@ Java_com_google_android_filament_LightManager_nBuilderCastShadows(JNIEnv *env, j
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv *env, jclass type,
jlong nativeBuilder, jint mapSize, jfloat constantBias, jfloat normalBias, jfloat shadowFar) {
jlong nativeBuilder, jint mapSize, jfloat constantBias, jfloat normalBias, jfloat shadowFar,
jfloat shadowNearHint, jfloat shadowFarHint, jboolean stable) {
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
builder->shadowOptions(
LightManager::ShadowOptions{(uint32_t) mapSize, constantBias, normalBias, shadowFar});
LightManager::ShadowOptions{.mapSize = (uint32_t)mapSize,
.constantBias = constantBias,
.normalBias = normalBias,
.shadowFar = shadowFar,
.shadowNearHint = shadowNearHint,
.shadowFarHint = shadowFarHint,
.stable = (bool)stable});
}
extern "C" JNIEXPORT void JNICALL
@@ -292,4 +299,4 @@ Java_com_google_android_filament_LightManager_nGetHaloFalloff(JNIEnv *env, jclas
jlong nativeLightManager, jint i) {
LightManager *lm = (LightManager *) nativeLightManager;
return lm->getSunHaloFalloff((LightManager::Instance) i);
}
}