I'm trying to create something like `Animoji` that...
# compose
u
I'm trying to create something like
Animoji
that Apple has. I know how to extract camera frames, then extract landmarks to drive the 3D object - but I don't know how to render the 3D object with Compose. Is it possible to render a 3D object in compose? Or maybe some 3D technology Compose can call into?
šŸ”– 1
r
It has support for Compose out of the box
u
great, thanks!
Just to be sure - this is specifically for both animating & rendering right? If I wanted to render a "statue", i.e. no animation - I'd not want this library and use Filament directly?
r
Filament can also do animations but at a low-level (support for morph shapes and skinning)
So yes, depending on your need you could use Filament directly (and render via AndroidExternalSurface or
SurfaceView
)
u
Yea sorry im a total 3d noob, I was wondering if I'd still use
SceneView
for say rendering a model of a car that's static, think maybe something like those car spec configurators
r
If you're new to 3D rendering it might make it easier for you
Filament has a companion library called gltfio that helps you load glTF files and manipulate them to some extent, but it's lower-level than what
SceneView
does
I do have an old demo that uses Compose + Filament directly, one sec
It's based on Compose 1.6.4
But it shows how to load glTF files and change their materials using Filament directly
u
implementation("com.google.android.filament:filament-android:$filamentVersion")
out of curiosity, how big is this in the APK (ballpark)? I have PTSD from opencv adding 100MB to my apk
r
It mostly depends on how many ABIs you want to target
It's 5.5 MiB for all 4 ABIs
u
oh that's surprisingly small
r
Targeting arm64 only it's 1.5 MiB
We tried very hard to keep it as small as possible
I actually find this waaaaay too big šŸ™‚
u
yea I was worried it's like tens of MBs
alright I'm gonna play with it, thank you!
šŸ‘ 1
j
Hi, I've been trying the libraries you mentioned (SceneView and Filamente only) and I'm having problems with SurfaceView in compose, but it works fine with TextureView. Have you experienced any similar errors?
r
What problems are you having? (Also you can use AndroidExternalSurface and AndroidEmbeddedExternalSurface instead)
j
When I use SurfaceView, it loads fine the first time I navigate to that Composable, but when I go back and navigate to load a different model, it doesn't display until I hover/tap a button. Apparently, activating the button ripple causes it to display correctly
We had similar problems with Exoplayer, SurfaceView and LazyLists, and the only solution we found was to use TextureView
I've tried using AndroidExternalSurface but I haven't found how to attach the Surface to UiHelper