Add support for screen-space contact shadows (#2245)
* Add support for screen-space contact shadows This CL adds support and always enables it. toggles and setting in the next CL (same PR). * Plumb settings for screen-space contact shadows screen-space contact shadows is handled like a shadow option, parameters (including on/off) are set in the LightManager, using the existing ShadowOptions API. Additionally there is a per-renderable toggle. Both toggles are off by default. * Allow contact shadows when shadowing is auto-disabled Shadowing can be auto-disabled when for instance there are no shadow casters in the scene. We still allow contact shadows in that case. This would allow for instance, to make the vegetation on a terrain not shadow-casting, and still get some shadowing there by using contact shadows instead. * apply micro-shadowing after contact shadows also, don't compute contact shadows when we know we're fully shadowed.
This commit is contained in:
@@ -66,7 +66,8 @@ Java_com_google_android_filament_LightManager_nBuilderCastShadows(JNIEnv*, jclas
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv*, jclass,
|
||||
jlong nativeBuilder, jint mapSize, jfloat constantBias, jfloat normalBias, jfloat shadowFar,
|
||||
jfloat shadowNearHint, jfloat shadowFarHint, jboolean stable) {
|
||||
jfloat shadowNearHint, jfloat shadowFarHint, jboolean stable,
|
||||
jboolean screenSpaceContactShadows, jint stepCount, jfloat maxShadowDistance) {
|
||||
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
|
||||
builder->shadowOptions(
|
||||
LightManager::ShadowOptions{.mapSize = (uint32_t)mapSize,
|
||||
@@ -75,7 +76,10 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv*, jcl
|
||||
.shadowFar = shadowFar,
|
||||
.shadowNearHint = shadowNearHint,
|
||||
.shadowFarHint = shadowFarHint,
|
||||
.stable = (bool)stable});
|
||||
.stable = (bool)stable,
|
||||
.screenSpaceContactShadows = (bool)screenSpaceContactShadows,
|
||||
.stepCount = uint8_t(stepCount),
|
||||
.maxShadowDistance = maxShadowDistance});
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
|
||||
Reference in New Issue
Block a user