arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

RearCameraWithFrontCameraFaceMesh

Open artistd36 opened this issue 7 years ago • 16 comments

When we use both cameras on in our app, the front camera works fine with blendshape (morphing) but with the back camera, if we enable AR face script on the 3D model, it does not augment. And if we disable AR Face script it augments ok, but blend shape does not work properly.

I used RearCameraWithFrontCameraFaceMesh sample but it's not working. Does any sample provide for this?

artistd36 avatar Jul 23 '19 11:07 artistd36

Me too. Have you solved it?

SmileSbear avatar Jul 26 '19 03:07 SmileSbear

I'm having the same issue, thread on the unity forums about it as well: https://forum.unity.com/threads/does-ar-foundation-support-arkit-3-simultaneous-front-and-back-camera.711383/

edwonedwon avatar Jul 28 '19 07:07 edwonedwon

@edwonia Any success with the new update?

artistd36 avatar Aug 08 '19 11:08 artistd36

@edwonia Any success with the new update?

which update are you referring to?

edwonedwon avatar Aug 08 '19 13:08 edwonedwon

Xcode beta 4 => beta 5 support update

artistd36 avatar Aug 09 '19 04:08 artistd36

I'm guessing this has more to do with the Unity plugin side of things, but I'll test Xcode beta 5 and see if it works

edwonedwon avatar Aug 09 '19 04:08 edwonedwon

Any update?

artistd36 avatar Aug 29 '19 04:08 artistd36

iOS 13.1 and Xcode 11 are out of beta and supported by ARFoundation 3.0.0-preview.3. Is this still an issue using those versions? Note that face tracking with the rear camera requires a device with an A12 bionic chip.

tdmowrer avatar Oct 07 '19 02:10 tdmowrer

@tdmowrer Please provide an example scene to avoid this issue. I have Ipad 2018

artistd36 avatar Oct 09 '19 05:10 artistd36

Use of the rear camera with face tracking enabled (i.e., the RearCameraWithFrontCameraFaceMesh sample scene) requires an A12 bionic chip and therefore only works on certain devices. For instance the iPhone XS supports this feature, but not the iPhone X.

Does your iPad have an A12 chip?

To confirm blend shapes work in this mode, I put this script on the FaceMeshPrefab and ran the sample app:

using System.Text;
using Unity.Collections;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARKit;

[RequireComponent(typeof(ARFace))]
public class PrintBlendShapes : MonoBehaviour
{
    void Update()
    {
#if UNITY_IOS
        if (FindObjectOfType<ARFaceManager>() is ARFaceManager manager)
        {
            if (manager.subsystem is ARKitFaceSubsystem subsystem)
            {
                using (var blendShapeCoefficients = subsystem.GetBlendShapeCoefficients(GetComponent<ARFace>().trackableId, Allocator.Temp))
                {
                    var sb = new StringBuilder();
                    foreach (var coefficient in blendShapeCoefficients)
                    {
                        sb.Append($"\t{coefficient.blendShapeLocation}: {coefficient.coefficient}\n");
                    }
                    Debug.Log($"Blend shape coefficients:\n{sb.ToString()}");
                }
            }
        }
#endif
    }
}

Looking at the log in Xcode, the values appear reasonable. Others on this forum have also reported blendshapes are working correctly in this mode.

tdmowrer avatar Oct 09 '19 20:10 tdmowrer

Thanks for answering, Its working without augmenting ARface. When using both cameras on in-app, the front camera works fine with blendshape (morphing) but with the back camera, if we enable AR face script on the 3D model, it does not augment. And if we disable AR Face script it augments ok, but blend shape does not work properly.

artistd36 avatar Oct 10 '19 05:10 artistd36

Does your device have an A12 bionic chip?

tdmowrer avatar Oct 10 '19 14:10 tdmowrer

Yes, I am using iPad 2018

artistd36 avatar Oct 11 '19 06:10 artistd36

What is the model number?

tdmowrer avatar Oct 11 '19 15:10 tdmowrer

A1934 is model number of My iPad

artistd36 avatar Oct 12 '19 04:10 artistd36

A1934 is model number of My iPad

Okay, that device should be supported.

if we enable AR face script on the 3D model, it does not augment.

What does that mean exactly? I am able to get an ARFace with blend shapes using the script I posted above.

tdmowrer avatar Oct 14 '19 18:10 tdmowrer