Commit Graph

196 Commits

Author SHA1 Message Date
Powei Feng
080f958da3 android: remove checked in asset (#9426)
For sample-gltf-viewer, an asset was checked into the source tree.
But other assets are generated or copied from asset directories.

We remove the checked in gltf and copy the asset over during
build (as with other existing files).
2025-11-13 06:29:45 +00:00
Doris Wu
84fdf36ed9 buffer update opt: New android sample for material instance stress test (#9396) 2025-11-05 03:24:56 +00:00
Powei Feng
edb17200d0 android: fix hello-cam sample appID
Make the application id and namespace consistent.
2025-09-23 16:10:39 -07:00
Powei Feng
c21f211a13 Update java for Texture::Usage (#9055)
Also update samples and utils to use proper usage when
generating mipmaps.
2025-08-11 19:47:26 +00:00
Powei Feng
3d0653604f android: add static, default model for gltf-viewer (#8898)
The default gltf for android's gltf-viewer is the buster drone,
which uses skinning.

We add an additional model (damaged helmet) as an alternative
default. This will be useful for debugging WebGPU, where skinnning is
not yet supported. This alternate path can only be invoke by starting
the app through adb:

  `adb shell am start -n com.google.android.filament.gltf/.MainActivity --ez "use-static-model" true`
2025-06-26 19:15:54 +00:00
Powei Feng
1b2ab09719 android: prevent leak of cubemap for IndirectLight/Skybox (#8470)
We break existing  API by returning both the IndirectLight and the
texture. Same thing with Skybox.

Fix one bug where the float array in getSphericalHarmonics wasn't
getting written out.

Fixes #6412
2025-02-27 20:14:22 +00:00
Mathias Agopian
61c4df9503 fix uninitialized variable on ES2 devices
On ES2 devices (or in forceES2 mode), we emulate the sRGB swapchain
in the shader if the h/w doesn't support it. In that case, the emulation
is controlled by a uniform that technically lives in the frameUniforms
block. However, the frameUniforms buffer is not updated, instead,
the uniform is manually set. Unfortunately, the UBO emulation
overrides it with the uninitialized variable.

BUGS=[377913730]
2024-11-11 16:30:24 -08:00
Mathias Agopian
a6b4c9fae1 fix gltf_viewer android sample build 2024-10-25 00:14:08 -07:00
Romain Guy
99308c98ba Update Android dependencies (#8224) 2024-10-23 15:49:01 -07:00
Mathias Agopian
83acf0f9de fix hello triangle build 2024-04-18 00:38:26 -07:00
Sungun Park
d83b3858b3 Add missing changes for NDK version update (#7591)
These are missing parts from the commit
111ad96134.

NDK 26.1.10909125 is used by default

Minimum API level on Android is now API 21 instead of API 19. This allows the use of OpenGL ES 3.1
2024-02-22 15:33:05 -08:00
Mathias Agopian
485ae1b324 add Material.compile and Engine.flush java bindings (#7348)
* Add Material.compile() Java binding.

* Add Engine.flush() java binding

* Add Scene.forEach java binding

update the Android gltf-viewer sample to precompile all variants of all
materials in the scene, similarly to the desktop sample.
2023-11-13 10:43:52 -08:00
Eliza Velasquez
56355231bd Allow explicitly initializing at feature level 0
This change does three main things. First, it adds an option to the Engine
Builder to pick the feature level at which to instantiate Filament. The only
real practical purpose of allowing this is to be able to instantiate at feature
level 0. Secondly, it allows feature level 0 to properly work on non-ES2
devices. Thirdly, it changes both Android and desktop hellotriangle samples to
explicitly opt-in to feature level 0.

Unfortunately, feature levels are used in two different, somewhat contradictory
ways presently in Filament, which can make reasoning about this change a bit
confusing. From a client perspective, feature levels refer to buckets of
capabilities which are guaranteed to be supported. Internally, there is a
separate "feature level" stored internally at the Driver subclass level which
generally corresponds to the maximum supported feature level, but is also
referenced when activating workarounds for limited devices. For example, Uniform
Buffer Objects are not supported in ES2, however, Filament supports emulating
them such that the client does not need to care at all; a supported feature is a
supported feature. But internally, Filament uses this "Driver" feature level to
determine whether or not a given workaround is needed. There were several cases
where the "active feature level" was being examined in order to activate these
workarounds rather than the "driver feature level", which was incorrect.

Why should non-ES2-only devices want to activate feature level 0? Allowing this
behavior 1. makes feature level 0 more consistent with the behavior of other
feature levels and 2. allows clients a layer of validation that their software
will work on all devices supported by Filament if they explicitly opt into it.

Consistency: Filament guarantees that any given device which supports a given
feature level will also support running on every feature level below, except for
feature level 0. This change removes that exception.

Validation: It's not perfect, and there will likely be bugs and unexpected
differences in behavior between ES2 and non-ES2 devices that crop up in the
future between two devices running on the same feature level. However, it's at
least a basic high level layer of validation that enables more rapid testing
workflows directly via desktop versions of Filament rather than having to fiddle
with something like ANGLE to get perfect GLES 2.0 compliance. Additionally, it
expands options for automated testing (with the same caveats).

This change has been tested on both the desktop and Android versions of
hellotriangle.
2023-10-26 22:20:57 +00:00
Mathias Agopian
39d555d115 get rid of filmat-lite, which was poorly maintained 2023-10-02 14:18:25 -07:00
Eliza Velasquez
9a6b8bf24e Remove now-redundant feature level 0 materials 2023-09-26 22:46:51 +00:00
Eliza Velasquez
58017a0e6a Tweak documentation
This is admittedly a very nitpicky change.

For most of the changes, I went through the various Markdown files and added
language names to the source blocks for better syntax highlighting on GitHub. It
also makes it easier to copy and paste commands without copying the leading `$`.
I avoided changing anything in `third_party`.

Additionally, I added some instructions for compiling the Android samples on the
command line and fixed some typos.
2023-09-12 20:28:46 +00:00
Mathias Agopian
c0db909c13 don't use eglMakeCurrent with EGL_NO_SURFACE unless we're allowed
EGL_KHR_surfaceless_context is needed to be able to use eglMakeCurrent
without an EGLSurface.
2023-08-16 21:35:29 -07:00
Mathias Agopian
51c65ccfdc add picking to gltf_viewer for debugging 2023-08-02 12:40:16 -07:00
Mathias Agopian
03b8dc8027 The "back" key will now terminate the gltf_viewer activity
This is useful for testing our shutdown code.
2023-07-27 09:57:14 -07:00
Romain Guy
0061883dbf Fix dynamic resolution with quality > low and translucency (#6940)
The scene graph was using the wrong boolean to decide whether to fallback
to low quality upscaling when the render target is translucent. It was
instead only looking at the view's blending mode. We need to check both,
as color grading does in the same function.
2023-07-10 12:48:54 -07:00
Romain Guy
4582ce8769 Fix texture upload callbacks in Java/Kotlin (#6939)
* Fix texture upload callbacks in Java/Kotlin

* Update release notes
2023-07-06 15:53:24 -07:00
Mathias Agopian
fdb0798f28 ES2 support: rec709 out colorspace emulation for ES2
This is only the first step where we:
- clean-up some code to prepare for 2nd step
- add support for the linear->srgb in the shaders

The linear->srgb conversion is protected by a
specification constant and will be enabled only
if the corresponding EGL extension in not present.

Then, if enabled, the actual conversion is
controlled by a uniform so that it can be
selectively enabled on swapchains that have it
turned on.

In this change, the emulation logic that sets
these gates is not implemented (that's step 2).
2023-05-02 21:23:47 -07:00
Mathias Agopian
b4d842c342 ES2 support: filament and filamat changes
This CL contains two parts:
- changes to matc/filamat
- changes to filament itself

Filamat can now generate ES2 compatible shaders. Only the unlit variant
is supported. Fog and picking are supported as well.
post-processing, skinning, instancing, all lighting and shadowing are not supported.

Filament is updated to not issue commands that are not supported in ES2.

Addtionnally, the hello-triangle sample is updated to work on an ES2 device.
2023-05-02 21:23:47 -07:00
Romain Guy
7f51f21512 Fix Android samples 2023-04-21 15:53:59 -07:00
Mathias Agopian
c24cc726e8 Fix Android samples so they handle surface resizes properly 2023-04-21 15:36:02 -07:00
Powei Feng
df78322bdc android: fix sample-material-builder app name (#6624)
fixes #6622
2023-03-08 11:11:56 -08:00
Mathias Agopian
94f121f37d Add a camera near/far setting in gltf_viewer 2023-02-17 11:16:42 -08:00
Mathias Agopian
d8c9391498 fix clear options
When more than one view was used, only the first view was cleared with
the ClearOption. This was actually intended when the views are rendering
into the swapchain (e.g. post process disabled), but that's incorrect 
when the views render into intermediate buffers.

The clear flags are now associated with the actual rendertarget.
2022-12-02 15:24:40 -08:00
Benjamin Doherty
2d43ad59ec Revert Android API_LEVEL change
glDispatchCompute requires Android API level 21, however bumping our
required minimum from 19 to 21 caused some clients' builds to fail.
Commenting-out that line for now to proceed with the 1.28.0 upgrade.
2022-10-18 13:34:50 -04:00
Philip Rideout
15ba54c4c5 Update README wrt Android Studio Version. 2022-09-29 16:28:50 -07:00
Philip Rideout
342138aecb gltfio: Update Java API. 2022-09-29 16:28:50 -07:00
Mathias Agopian
3d53ae583f switch our min sdk from 19 to 21
this is so that we can support OpenGL ES3.1
2022-09-28 22:08:27 -07:00
Romain Guy
8dae181c2f Upgrade AGP and dependencies including plugins (#6078)
This moves to a new, maintained Maven publishing plugin.
2022-09-15 16:05:18 -07:00
Mathias Agopian
ead5a97871 make AutomationEngine feature level aware
this basically just adds an Engine* parameter too all applySettings
methods
2022-09-07 15:32:58 -07:00
Philip Rideout
c910cab7a3 Fix bitrot in sample-page-curl (#5703) 2022-06-15 15:14:18 -07:00
Ben Doherty
62a234a8f9 Add package name back to AndroidManifest.xml to fix G3 (#5569) 2022-05-17 17:53:16 -07:00
Romain Guy
f229aaa7c4 Upgrade Android tools (#5533)
* Upgrade Android tools

NDK 24
AGP/Gradle 7.2
Kotlin 1.6.21
Coroutines 1.6.1

* Force Java 8 to run sdkmanager
2022-05-09 12:12:14 -07:00
Philip Rideout
9aeec3a759 Add Ktx2Reader and BasisEncoder and use them in samples.
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
2022-04-15 10:48:48 -07:00
Mathias Agopian
dab02e915e Remove deprecated Stream APIs 2022-04-14 12:51:03 -07:00
Philip Rideout
5c0e7d8211 sample-gltf-viewer: fix regression with zip files.
Path resolution was broken with #5285, which only worked when the glTF
happened to be at root level. This new fix has been tested against:

- My Sponza zip file that hass all files in a "sponza" folder.
- My Bistro zip file, which has resources in a child folder relative to
  the gltf file
- A self-created flat zip using IridescentDishWithOlives, with
  everything at root level.

Side note: Bistro still fails on a Pixel 6 Pro Mali but for an unrelated
reason: (null deref in backend::TimerQueryNative::queryResultAvailable)
2022-04-13 12:18:47 -07:00
Romain Guy
ebca955682 Clear warnings 2022-03-19 12:58:18 -07:00
Philip Rideout
daff8fea9f Android Viewer: fix URI bug when dropping some zips.
Dragging a zip file into the Remote Viewer page would fail if it
contained a glTF with `./` prefixes in the `images` section. The best
fix is to use Java's proper URI object rather than trying to parse the
string.
2022-03-04 09:15:37 -08:00
Mathias Agopian
c91f28b6be fix remote UI when dropping a new .hdr ibl file
- the ibl wasn't updated in internal structures
- the previous ibl was leaked
2021-12-08 00:17:29 -06:00
Romain Guy
332d5681e6 Update dependencies 2021-12-07 09:34:28 -08:00
Ben Doherty
dbe1386785 Fix live wallpaper sample with Android 12+ (#4917) 2021-12-01 12:29:11 -08:00
Romain Guy
c1713e7501 Export activities on Android 12+ 2021-11-22 09:25:13 -08:00
Romain Guy
d67210155b Skip task incompatible with configuration caching (#4831) 2021-11-09 15:01:02 -08:00
Romain Guy
095179eeb3 Enabled Gradle configuration caching and rename properties (#4769)
* Fix configurationg caching problems

* Enable Gradle configuration caching

* Update BUILDING.md

* Update RELEASE_NOTES.md

Co-authored-by: Mathias Agopian <mathias@google.com>

Co-authored-by: Benjamin Doherty <bendoherty@google.com>
2021-10-26 12:47:35 -07:00
clayly
9a3c9ccbf3 android-samples-gradle-plugin-id (#4740) 2021-10-24 11:12:15 -07:00
Romain Guy
481038152f Cleanup of Android projects (#4730) 2021-10-13 18:17:12 -07:00