ssao: reduce creases caused by geometry tessellation

We borrow a page from the HBAO book here and allow to limit the angle
with the horizon of SSAO samples. This can help reducing the effects
of low tessellation, which tend to create unwanted creases with SSAO.
This commit is contained in:
Pixelflinger
2020-09-20 01:05:16 -07:00
committed by Mathias Agopian
parent ed8db2f58f
commit 73f1ddfebf
8 changed files with 33 additions and 6 deletions

View File

@@ -196,7 +196,7 @@ Java_com_google_android_filament_View_nGetAmbientOcclusion(JNIEnv*, jclass, jlon
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclass,
jlong nativeView, jfloat radius, jfloat bias, jfloat power, jfloat resolution, jfloat intensity,
jint quality, jint upsampling, jboolean enabled) {
jint quality, jint upsampling, jboolean enabled, jfloat minHorizonAngleRad) {
View* view = (View*) nativeView;
View::AmbientOcclusionOptions options = {
.radius = radius,
@@ -206,7 +206,8 @@ Java_com_google_android_filament_View_nSetAmbientOcclusionOptions(JNIEnv*, jclas
.intensity = intensity,
.quality = (View::QualityLevel)quality,
.upsampling = (View::QualityLevel)upsampling,
.enabled = (bool)enabled
.enabled = (bool)enabled,
.minHorizonAngleRad = minHorizonAngleRad
};
view->setAmbientOcclusionOptions(options);
}