question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AR face with texture not working

See original GitHub issue

Description

When I ran the sample code of Flutter-HMS-AR/example, inside ARFace Scene, if I apply texture to the face, I get the following error:


[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference, null, java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir' on a null object reference

and also:

[SurfaceTexture-0-23763-0]:391: dequeueBuffer: BufferQueue has been abandoned

Expected behavior

expect to see texture over face

Current behavior

errors Screenshots

it just shows a white screen…

Logs Post logs here or paste them to Ghostbin and insert the link here.

Environment

  • Platform: Flutter
  • Kit: ar
  • Kit Version: newest on flutter pub dev
  • OS Version: Harmony OS 2.0
  • Android Studio version (if applicable) [e.g. 4.1]
  • Platform version: flutter 2.12
  • Node Version (if applicable)
  • Your Location/Region (if applicable)

Other Add any other context about the problem here

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

3reactions
atavcicommented, Sep 28, 2021

Hello again,

Thank you for providing the logs, we have found out that the FlutterLoader class’ getInstance method that used for obtaining the texture image asset has been deprecated on the newer Flutter versions which causes this error.

To fix the issue navigate to ARSceneView.java file,

Add the following import to the top of the file:

import io.flutter.FlutterInjector;

Then you can change the line on ARSceneView.java:163 from:

String texturePath = sceneConfig.getString(TEXTURE_PATH).equals("null")
        ? "texture.png"
        : FlutterLoader.getInstance().getLookupKeyForAsset(sceneConfig.getString(TEXTURE_PATH));

to:

String texturePath = sceneConfig.getString(TEXTURE_PATH).equals("null")
        ? "texture.png"
        : FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(sceneConfig.getString(TEXTURE_PATH));

This change should fix the error and we will also update the package on the next release of this plugin.

Thank you for your contribution 👍 and have a good day.

2reactions
atavcicommented, Oct 7, 2021

The ARFaceScene would draw the 3D face and then will attach the texture, the image you are using is the texture for a 3D Object so it is not compatible for a face filter. Also If you want to customize the filter for your needs you can navigate to the FaceGeometryDisplay.java file and add your custom rendering code. The example shown here is just a showcase for the Face Tracking feature of the AR Engine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Materials from Face Mesh not showing up in preview
I have an issue with a material on a second facemesh not showing in app but they do show up in spark AR....
Read more >
Face Mesh Alpha Problems [solved] - Spark AR - PopulAR Lab
I am using the Face Extraction Render Pass for texture. Neither of these methods work: Material/Alpha Slot; Texture/Mix Patch. Any ideas?
Read more >
Using Textures - Spark AR - Facebook
You can make a variety of textures in Meta Spark Studio. For example, you can: Turn the video captured by the camera or...
Read more >
Material showing up in Spark AR but not when testing in IG
This works fine however I also wanted to try creating freckles. I added a new face mesh for that and added a material...
Read more >
How to get camera texture in ARFoundation? - Unity Forum
I finally got reflections on AR Foundation. The problem was that Real Time Reflections was disabled in the default settings for Android on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found