This replaces the previous "curvature to roughness" method. Both are related
and rely on the screen space variance of geometric normals but this new
solution offers more control (the screen space variance and the clamping
threshold can be controlled).
Filament references a few classes from native code and by reflections,
so when proguarding binaries we typically had to add an exception for
filament to make it run:
-keep class com.google.android.filament.** {*;}
In a compiled .dex file, the filament namespace takes about 120kb
(before compression), even if the classes aren't used.
To enable proguarding and stripping out unused filament classes,
introduce a UsedByNative and UsedByReflection annotation to explicitly
mark classes that need to be kept in the dex, so that the rest can be
potentially stripped out.
In my testing, this reduces the filament namespace in the .dex from
120kb->40kb, which translates to about 30kb apk size savings after
compression.
This includes a small change to our custom material task because old
gradle passed only the contents of out-of-date directories, newer gradle
passes both the contents and the directory itself.
* Add new shading model to Filament for specularGlossiness.
This adds a shading model based on KHR_materials_pbrSpecularGlossiness.
The corollary gltfio change will be in an upcoming PR.
* Improve documentation for specular-glossiness
* MaterialInstance now has setMaskThreshold for convenience.
* Materials now support dynamic doubleSided property.
This does not change the format of material packages because they
already have both getDoubleSided() and getDoubleSidedSet().
The only way in which this change could impact existing applications is
that materials that explicity set doubleSided to "false" will now
respect the material's culling mode, rather than forcing it to NONE.
Fixes gltf_viewer with littlest_tokyo in ubershader mode.
Fixes#963.
* JNI for dynamic material properties.
* Add underscore prefix to internal material params.
* Remove un-needed mat info field.
- "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
In this first step, we just "blindly" move everything under src/driver
to a new library libbackend.a. And all headers are moved under
private/backend.
Note that "driver" is renamed "backend", but namespaces are unchanged for now.
Later we'll have to untangle the actual private headers from public
ones and ideally not have any private headers.
It's now possible to enable/disable tone-mapping, fxaa, msaa and
dynamic resolution independently.
A new set/getToneMapping() method is added to View.
It's still possible to disable *all* these post-processing effects
together using setPostProcessing(). This is currently needed when
rendering a transparent view (such as UI) on top of another view.
This limitation might be addressed in the future.
This fixes#621
This moves our existing VertexBuffer utility into a new "geometry"
library and adds new functionality for computing tangents based on UV's.
The UV-based method comes from Eric Lengyel.
We considered mikktspace (which thankfully has a zlib-style license) but
it would require re-indexing via meshoptimizer and is therefore a bit
heavyweight.
The new library has no dependencies and will add only 7 KB to Filament's
Android aar file.
Fixes#858 and preps for #528.
The bug was reproduced and the fix was verified by copying the following
code snippet into one of our Android samples:
val norm = floatArrayOf(1.0f, 0.0f, 0.0f)
val tang = floatArrayOf(0.0f, 1.0f, 0.0f, 1.0f)
val expected = floatArrayOf(0.5f, 0.5f, 0.5f, 0.5f)
val resultBuffer = FloatBuffer.allocate(4)
val qtc = VertexBuffer.QuatTangentContext()
qtc.quatCount = 1
qtc.quatType = VertexBuffer.QuatType.FLOAT4
qtc.outBuffer = resultBuffer
qtc.normals = FloatBuffer.wrap(norm)
qtc.tangents = FloatBuffer.wrap(tang)
VertexBuffer.populateTangentQuaternions(qtc)
Log.e("Filament", "${expected[0]} == ${resultBuffer[0]}")
Fixes#695.
Amazingly, the size field in PixelBufferDescriptor was often totally
incorrect for Java-based clients. The reason we did not notice: OpenGL
often consumes a pointer to image data without consuming a byte count
(e.g. glTexImage2D).
OpenGL infers size from dimensions + format, but Vulkan does not. This
caused texture corruption with Vulkan on Android.
This fix follows a pattern used in other places such as
FRenderer::readPixels.
We still do not compile the Vulkan backend for Android by default, this
simply makes it possible to use the samples on Vulkan with a one-line
change, which is useful for testing purposes.
This change also makes it so that the materials used for the samples
include SPIR-V. This makes them fatter but they are merely samples.
I still consider Vulkan on Android to be experimental, there are some
features that need to be implemented.
* Improve rendering to TextureView
UiHelper wasn't calling the resize callback at init time when attaching
to a TextureView, but it was for a SurfaceView. This makes both code
paths consistent and fixes the standard samples if they are modified to
render to a TextureView.
This change also adds a new sample app that shows how to render into
a TextureView.
* Suppress warning
* Suppress another warning
We simply don't emit unwind tables, which are not needed anyways since
we're compiling without exceptions. the combined saving for all four
targets we support is about 120K.
This seems to improve .aar's compression, for a total gain of 152 KiB.
We also disable stack-protector in the jni code, since it wasn't
enabled in libfilament.a anyways. However, we now compile all debug
builds with -fstack-protector
THIS CHANGE BREAKS MATERIALS.
This adds getUserTime() in shaders/materials, which returns the time
in second since Renderer::resetUserTime() was called.
Two values are provided, the time in second encoded as a float and
the difference between that and the double value, which together allows
to perform high precision time computation when needed.
This change allows longer running animations in materials. Using only
the float value, give millisecond resolution for more than 4h.
* Add View::setFrontFaceWindingInverted() API
This API can be used to flip all meshes in a render pass
inside out. This is useful for mirrored rendering.
This change also disables face culling on the default skybox
renderable. Since it is unlit, there is no downside to this
and the mesh being in the device vertex domain it can never
be backfacing unless front face winding is inverted.
* Track face winding state in Vulkan
View::setRenderQuality gives the ability to control the rendering quality
of a given view. In particular this allows the app to lower the quality
of the HDR color buffer by using R11G11B10F instead of RGB(A)16F.
* WIP Add helper to upload Android bitmaps to textures
* Add missing file
* Pass custom constants for bitmap formats
* Add sample app for texturing
* Update the README for samples
* Rename variable from callback to autoBitmap
This change will allow the skybox use a compressed texture format.
For now, the old internal format "RGBM" is still honored, but in a
forthcoming change we will replace the enum with UNUSED.
* Add support for save/replay of the current view.
* Add support for having distinct draw/read surfaces.
Adds support to egl & glx drivers for distring draw/read surfaces and
uses this support to implement mirrorFrame using a single blit.
* Use src/dst, Viewport, clean up apis.
* Add SwapChain READABLE Config.
* Commit & setPresentationTime optional on mirror.
* Fix flag check.
* Add documentation for READABLE swap chain config.
* Fix missed s/ExternalContext/Platform/ cases.
* Build break fix.