Skip to content

Commit

Permalink
Merge branch 'rc/1.9.4' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Oct 12, 2020
2 parents 826e8d1 + 523f402 commit 39862c9
Show file tree
Hide file tree
Showing 61 changed files with 30,128 additions and 550 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ filament/docs/html/**
*tmp*.png
civetweb.txt
/TAGS
settings.json
test*.png
test*.json
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL)
set(LINUX TRUE)
endif()

if (LINUX)
execute_process(COMMAND uname -p
OUTPUT_VARIABLE PROCESSOR_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if ("${PROCESSOR_ARCH}" STREQUAL "aarch64")
set(LINUX_AARCH64 TRUE)
endif()
endif()

if (ANDROID OR WEBGL OR IOS)
set(IS_MOBILE_TARGET TRUE)
endif()
Expand Down Expand Up @@ -593,14 +603,14 @@ set(FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples)
if (WEBGL)
add_subdirectory(web/filament-js)
add_subdirectory(web/samples)
add_subdirectory(${EXTERNAL}/imgui/tnt)
endif()

if (IS_HOST_PLATFORM)
add_subdirectory(${LIBRARIES}/bluegl)
add_subdirectory(${LIBRARIES}/filamentapp)
add_subdirectory(${LIBRARIES}/filagui)
add_subdirectory(${LIBRARIES}/imageio)
add_subdirectory(${LIBRARIES}/viewer)

add_subdirectory(${FILAMENT}/java/filamat)
add_subdirectory(${FILAMENT}/java/filament)
Expand All @@ -611,6 +621,7 @@ if (IS_HOST_PLATFORM)
add_subdirectory(${EXTERNAL}/astcenc/tnt)
add_subdirectory(${EXTERNAL}/etc2comp)
add_subdirectory(${EXTERNAL}/imgui/tnt)
add_subdirectory(${EXTERNAL}/jsmn/tnt)
add_subdirectory(${EXTERNAL}/libassimp/tnt)
add_subdirectory(${EXTERNAL}/libpng/tnt)
add_subdirectory(${EXTERNAL}/libsdl2/tnt)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.9.3'
implementation 'com.google.android.filament:filament-android:1.9.4'
}
```

Expand Down Expand Up @@ -63,7 +63,7 @@ A much smaller alternative to `filamat-android` that can only generate OpenGL sh
iOS projects can use CocoaPods to install the latest release:

```
pod 'Filament', '~> 1.9.3'
pod 'Filament', '~> 1.9.4'
```

### Snapshots
Expand Down
11 changes: 10 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
This file contains one line summaries of commits that are worthy of mentioning in release notes.
A new header is inserted each time a *tag* is created.

## Next release (v1.9.4)
## Next release (v1.9.5)

## v1.9.4

- Add screen space cone tracing (SSCT)
- Improvements to VSM shadow quality
- New `ShadowOptions` control to render Variance Shadow Maps (VSM) with MSAA (experimental)
- Improvements and fixes to screen-space ambient occlusion
- gltf_viewer: add --headless option
- gltf_viewer: Add new automation UI and functionality

## v1.9.3

Expand Down
7 changes: 5 additions & 2 deletions android/filament-android/src/main/cpp/LightManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env,
jlong nativeBuilder, jint mapSize, jint cascades, jfloatArray splitPositions,
jfloat constantBias, jfloat normalBias, jfloat shadowFar, jfloat shadowNearHint,
jfloat shadowFarHint, jboolean stable, jboolean screenSpaceContactShadows, jint stepCount,
jfloat maxShadowDistance) {
jfloat maxShadowDistance, jint vsmMsaaSamples) {
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
LightManager::ShadowOptions shadowOptions {
.mapSize = (uint32_t)mapSize,
Expand All @@ -90,7 +90,10 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env,
.stable = (bool)stable,
.screenSpaceContactShadows = (bool)screenSpaceContactShadows,
.stepCount = uint8_t(stepCount),
.maxShadowDistance = maxShadowDistance
.maxShadowDistance = maxShadowDistance,
.vsm = {
.msaaSamples = (uint8_t) vsmMsaaSamples
}
};
jfloat *nativeSplits = env->GetFloatArrayElements(splitPositions, NULL);
const jsize splitCount = std::min((jsize) 3, env->GetArrayLength(splitPositions));
Expand Down
54 changes: 41 additions & 13 deletions android/filament-android/src/main/cpp/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jcla
view->setDynamicResolutionOptions(options);
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetShadowType(JNIEnv*, jclass, jlong nativeView, jint type) {
View* view = (View*) nativeView;
view->setShadowType((View::ShadowType) type);
}

extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetRenderQuality(JNIEnv*, jclass,
Expand Down Expand Up @@ -196,19 +202,41 @@ 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, jfloat minHorizonAngleRad) {
View* view = (View*) nativeView;
View::AmbientOcclusionOptions options = {
.radius = radius,
.power = power,
.bias = bias,
.resolution = resolution,
.intensity = intensity,
.quality = (View::QualityLevel)quality,
.upsampling = (View::QualityLevel)upsampling,
.enabled = (bool)enabled,
.minHorizonAngleRad = minHorizonAngleRad
};
jint quality, jint lowPassFilter, jint upsampling, jboolean enabled, jfloat minHorizonAngleRad) {
View* view = (View*) nativeView;
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
options.radius = radius;
options.power = power;
options.bias = bias;
options.resolution = resolution;
options.intensity = intensity;
options.quality = (View::QualityLevel)quality;
options.lowPassFilter = (View::QualityLevel)lowPassFilter;
options.upsampling = (View::QualityLevel)upsampling;
options.enabled = (bool)enabled;
options.minHorizonAngleRad = minHorizonAngleRad;
view->setAmbientOcclusionOptions(options);
}


extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetSSCTOptions(JNIEnv *, jclass, jlong nativeView,
jfloat ssctLightConeRad, jfloat ssctStartTraceDistance, jfloat ssctContactDistanceMax,
jfloat ssctIntensity, jfloat ssctLightDirX, jfloat ssctLightDirY, jfloat ssctLightDirZ,
jfloat ssctDepthBias, jfloat ssctDepthSlopeBias, jint ssctSampleCount,
jint ssctRayCount, jboolean ssctEnabled) {
View* view = (View*) nativeView;
View::AmbientOcclusionOptions options = view->getAmbientOcclusionOptions();
options.ssct.lightConeRad = ssctLightConeRad;
options.ssct.shadowDistance = ssctStartTraceDistance;
options.ssct.contactDistanceMax = ssctContactDistanceMax;
options.ssct.intensity = ssctIntensity;
options.ssct.lightDirection = math::float3{ ssctLightDirX, ssctLightDirY, ssctLightDirZ };
options.ssct.depthBias = ssctDepthBias;
options.ssct.depthSlopeBias = ssctDepthSlopeBias;
options.ssct.sampleCount = (uint8_t)ssctSampleCount;
options.ssct.rayCount = (uint8_t)ssctRayCount;
options.ssct.enabled = (bool)ssctEnabled;
view->setAmbientOcclusionOptions(options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ public static class ShadowOptions {
*</p>
*/
public float maxShadowDistance = 0.3f;

/*
* Options prefixed with 'vsm' are available when the View's ShadowType is set to VSM.
*
* @see View#setShadowType
*/

/**
* The number of MSAA samples to use when rendering VSM shadow maps.
* Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns
* off MSAA.
* Higher values may not be available depending on the underlying hardware.
*
* <p>
* <strong>Warning: This API is still experimental and subject to change.</strong>
* </p>
*/
@IntRange(from = 1)
public int vsmMsaaSamples = 1;
}

public static class ShadowCascades {
Expand Down Expand Up @@ -433,7 +452,7 @@ public Builder shadowOptions(@NonNull ShadowOptions options) {
options.mapSize, options.shadowCascades, options.cascadeSplitPositions,
options.constantBias, options.normalBias, options.shadowFar, options.shadowNearHint,
options.shadowFarHint, options.stable, options.screenSpaceContactShadows,
options.stepCount, options.maxShadowDistance);
options.stepCount, options.maxShadowDistance, options.vsmMsaaSamples);
return this;
}

Expand Down Expand Up @@ -1059,7 +1078,7 @@ public long getNativeObject() {
private static native void nDestroyBuilder(long nativeBuilder);
private static native boolean nBuilderBuild(long nativeBuilder, long nativeEngine, int entity);
private static native void nBuilderCastShadows(long nativeBuilder, boolean enable);
private static native void nBuilderShadowOptions(long nativeBuilder, int mapSize, int cascades, float[] splitPositions, float constantBias, float normalBias, float shadowFar, float shadowNearHint, float shadowFarhint, boolean stable, boolean screenSpaceContactShadows, int stepCount, float maxShadowDistance);
private static native void nBuilderShadowOptions(long nativeBuilder, int mapSize, int cascades, float[] splitPositions, float constantBias, float normalBias, float shadowFar, float shadowNearHint, float shadowFarhint, boolean stable, boolean screenSpaceContactShadows, int stepCount, float maxShadowDistance, int vsmMsaaSamples);
private static native void nBuilderCastLight(long nativeBuilder, boolean enabled);
private static native void nBuilderPosition(long nativeBuilder, float x, float y, float z);
private static native void nBuilderDirection(long nativeBuilder, float x, float y, float z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ public static class AmbientOcclusionOptions {
@NonNull
public QualityLevel quality = QualityLevel.LOW;

/**
* The lowPassFilter setting controls the quality of the low pass filter applied to
* AO estimation. The default is QualityLevel.MEDIUM which is sufficient for most mobile
* applications. QualityLevel.LOW disables the filter entirely.
*/
@NonNull
public QualityLevel lowPassFilter = QualityLevel.MEDIUM;

/**
* The upsampling setting controls the quality of the ambient occlusion buffer upsampling.
* The default is QualityLevel.LOW and uses bilinear filtering, a value of
Expand All @@ -195,6 +203,64 @@ public static class AmbientOcclusionOptions {
* For e.g. a good values to try could be around 0.2.
*/
public float minHorizonAngleRad = 0.0f;


/**
* Full cone angle in radian, between 0 and pi/2. This affects the softness of the shadows,
* as well as how far they are cast. A smaller angle yields to sharper and shorter shadows.
* The default angle is about 60 degrees.
*/
public float ssctLightConeRad = 1.0f;

/**
* Distance from where tracing starts.
* This affects how far shadows are cast.
*/
public float ssctStartTraceDistance = 0.01f;

/**
* Maximum contact distance with the cone. Intersections between the traced cone and
* geometry samller than this distance are ignored.
*/
public float ssctContactDistanceMax = 1.0f;

/**
* Intensity of the shadows.
*/
public float ssctIntensity = 0.8f;

/**
* Light direction.
*/
@NonNull @Size(min = 3)
public float[] ssctLightDirection = { 0, -1, 0 };

/**
* Depth bias in world units (mitigate self shadowing)
*/
public float ssctDepthBias = 0.01f;

/**
* Depth slope bias (mitigate self shadowing)
*/
public float ssctDepthSlopeBias = 0.01f;

/**
* Tracing sample count, between 1 and 255. This affects the quality as well as the
* distance of the shadows.
*/
public int ssctSampleCount = 4;

/**
* Numbers of rays to trace, between 1 and 255. This affects the noise of the shadows.
* Performance degrades quickly with this value.
*/
public int ssctRayCount = 1;

/**
* Enables or disables SSCT.
*/
public boolean ssctEnabled = false;
}

/**
Expand Down Expand Up @@ -499,6 +565,23 @@ public enum Dithering {
TEMPORAL
}

/**
* List of available shadow mapping techniques.
*
* @see #setShadowType
*/
public enum ShadowType {
/**
* Percentage-closer filtered shadows (default).
*/
PCF,

/**
* Variance shadows.
*/
VSM
}

/**
* Used to select buffers.
*/
Expand Down Expand Up @@ -1080,6 +1163,17 @@ public void setDynamicLightingOptions(float zLightNear, float zLightFar) {
nSetDynamicLightingOptions(getNativeObject(), zLightNear, zLightFar);
}

/**
* Sets the shadow mapping technique this View uses.
*
* The ShadowType affects all the shadows seen within the View.
*
* <strong>Warning: This API is still experimental and subject to change.</strong>
*/
public void setShadowType(ShadowType type) {
nSetShadowType(getNativeObject(), type.ordinal());
}

/**
* Activates or deactivates ambient occlusion.
* @see #setAmbientOcclusionOptions
Expand Down Expand Up @@ -1109,8 +1203,12 @@ public AmbientOcclusion getAmbientOcclusion() {
public void setAmbientOcclusionOptions(@NonNull AmbientOcclusionOptions options) {
mAmbientOcclusionOptions = options;
nSetAmbientOcclusionOptions(getNativeObject(), options.radius, options.bias, options.power,
options.resolution, options.intensity, options.quality.ordinal(), options.upsampling.ordinal(),
options.resolution, options.intensity, options.quality.ordinal(), options.lowPassFilter.ordinal(), options.upsampling.ordinal(),
options.enabled, options.minHorizonAngleRad);
nSetSSCTOptions(getNativeObject(), options.ssctLightConeRad, options.ssctStartTraceDistance, options.ssctContactDistanceMax, options.ssctIntensity,
options.ssctLightDirection[0], options.ssctLightDirection[1], options.ssctLightDirection[2],
options.ssctDepthBias, options.ssctDepthSlopeBias, options.ssctSampleCount,
options.ssctRayCount, options.ssctEnabled);
}

/**
Expand Down Expand Up @@ -1267,14 +1365,16 @@ void clearNativeObject() {
private static native void nSetDynamicResolutionOptions(long nativeView, boolean enabled, boolean homogeneousScaling, float minScale, float maxScale, int quality);
private static native void nSetRenderQuality(long nativeView, int hdrColorBufferQuality);
private static native void nSetDynamicLightingOptions(long nativeView, float zLightNear, float zLightFar);
private static native void nSetShadowType(long nativeView, int type);
private static native void nSetColorGrading(long nativeView, long nativeColorGrading);
private static native void nSetPostProcessingEnabled(long nativeView, boolean enabled);
private static native boolean nIsPostProcessingEnabled(long nativeView);
private static native void nSetFrontFaceWindingInverted(long nativeView, boolean inverted);
private static native boolean nIsFrontFaceWindingInverted(long nativeView);
private static native void nSetAmbientOcclusion(long nativeView, int ordinal);
private static native int nGetAmbientOcclusion(long nativeView);
private static native void nSetAmbientOcclusionOptions(long nativeView, float radius, float bias, float power, float resolution, float intensity, int quality, int upsampling, boolean enabled, float minHorizonAngleRad);
private static native void nSetAmbientOcclusionOptions(long nativeView, float radius, float bias, float power, float resolution, float intensity, int quality, int lowPassFilter, int upsampling, boolean enabled, float minHorizonAngleRad);
private static native void nSetSSCTOptions(long nativeView, float ssctLightConeRad, float ssctStartTraceDistance, float ssctContactDistanceMax, float ssctIntensity, float v, float v1, float v2, float ssctDepthBias, float ssctDepthSlopeBias, int ssctSampleCount, int ssctRayCount, boolean ssctEnabled);
private static native void nSetBloomOptions(long nativeView, long dirtNativeObject, float dirtStrength, float strength, int resolution, float anamorphism, int levels, int blendMode, boolean threshold, boolean enabled, float highlight);
private static native void nSetFogOptions(long nativeView, float distance, float maximumOpacity, float height, float heightFalloff, float v, float v1, float v2, float density, float inScatteringStart, float inScatteringSize, boolean fogColorFromIbl, boolean enabled);
private static native void nSetBlendMode(long nativeView, int blendMode);
Expand Down
1 change: 0 additions & 1 deletion android/gltfio-android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ set(GLTFIO_SRCS
${GLTFIO_DIR}/include/gltfio/AssetLoader.h
${GLTFIO_DIR}/include/gltfio/MaterialProvider.h
${GLTFIO_DIR}/include/gltfio/ResourceLoader.h
${GLTFIO_DIR}/include/gltfio/SimpleViewer.h
${GLTFIO_DIR}/include/gltfio/FilamentAsset.h
${GLTFIO_DIR}/include/gltfio/FilamentInstance.h

Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.9.3
VERSION_NAME=1.9.4

POM_DESCRIPTION=Real-time physically based rendering engine for Android.

Expand Down
1 change: 1 addition & 0 deletions build/common/test_list.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
libs/viewer/test_settings
filament/test/test_filament --gtest_filter=-FilamentTest.FroxelData:FilamentExposureWithEngineTest.SetExposure:FilamentExposureWithEngineTest.ComputeEV100:RenderingTest.*
filament/test/test_material_parser
libs/math/test_math
Expand Down
Loading

0 comments on commit 39862c9

Please sign in to comment.