8. Set Contents

Downloaded contents, face beautification, and face fun bulge effects can be rendered on video frames. Types of Contents are defined in ARGEnum.cs as ContentsType.

ContentType enum
[Serializable]
public enum ContentsType
{
        ARGItem = 0,
        FilterItem = 1,
        Beauty = 2,
        Bulge = 3
}

8.1. Set ARGear Item

By calling the setItem method in ARGearManager script, an item can be set for rendering.

The sample code below shows an example of how to set an ARGItem.

set an ARG Item
/*
 type        ARGContent Type
 filePath    Contents downloaded path
 uuid        uuid of an item
 callback    callback result
 */
 
public void SetItem(ARGEnum.ContentsType type, string filePath, string uuid, ARGearContentsCallback callback = null)
{
#if UNITY_ANDROID
    argearNative.SetItem(type, filePath, uuid, null, new ARGearAndroidContentsCallback(
        success =>
        {
            if (callback != null) callback.OnSuccess();
        },
        error =>
        {
            if (callback != null) callback.OnError(error);
        }
    ));
#elif UNITY_IOS
    argearNative.SetItem(type, filePath, uuid, callback);
#endif
}

8.2. Apply Face Beautification Effect

There are 16 face beautification effects in ARGContents such as V-line, face slim, jaw, chin, eye, eye gap, nose line, nose side, nose length, mouth size, eye back, eye corner, lip size, face skin, dark circle, and lip wrinkle. By applying these effects, your customers can transform their faces easily.

Face beautification types are defined in the BeautyType type in ARGEnum.cs. For the details of each parameter type, please refer to the table below.

<Table. Types of BeautyType Description>

8.2.1. Set Beauty Values

By using SetBeauty method, the effect of face beautification can be manipulated.

The sample code below shows how to set face beautification values at once.

Set Beauty Values
// Set all Beauty values at once
float[] BeautyDataDefault = {
    10f,     //VLINE
    90f,     //ACE_SLIM
    55f,     //JAW
   -50f,     //CHIN
     5f,     //EYE
   -10f,     //EYE_GAP
     0f,     //NOSE_LINE
    35f,     //NOSE_SIDE
    30f,     //NOSE_LENGTH
   -35f,     //MOUTH_SIZE
     0f,     //EYE_BACK
     0f,     //EYE_CORNER
     0f,     //LIP_SIZE
    50f,     //SKIN
     0f,     //DARK_CIRCLE
     0f      //MOUTH_WRINKLE
};
 
ARGearManager.Instance.SetBeauty(BeautyDataDefalut);

8.3 Face Fun Bulge

The setBulge function in ARGearManager script allows you to set 6 types of face fun bulge effects. Face Fun Bulge types are defined in ARGEmun.cs as BulgeType.

BulgeType is defined as below.

BulgeType Enum
[Serializable]
public enum BulgeType
{
        NONE = -1,
        FUN1 = 1,
        FUN2 = 2,
        FUN3 = 3,
        FUN4 = 4,
        FUN5 = 5,
        FUN6 = 6
}

Sample code to set a face fun bulge effect is written below.

Set a Face Fun Bulge Effect
if (button.name.Equals("ClearButton"))
{
        ARGearManager.Instance.ClearContents(ARGEnum.ContentsType.Bulge);
}
else if (button.name.Equals("Fun1Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN1);
}
else if (button.name.Equals("Fun2Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN2);
}
else if (button.name.Equals("Fun3Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN3);
}
else if (button.name.Equals("Fun4Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN4);
}
else if (button.name.Equals("Fun5Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN5);
}
else if (button.name.Equals("Fun6Button"))
{
        ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN6);
}

8.4 Remove Contents

By using ClearContents with an ARGContent type parameter in the ARGearManager script, you can clear corresponding contents.

The sample code below shows how to clear contents.

Clear Contents
ARGearManager.Instance.ClearContents(ARGEnum.ContentsType.Beauty);

Last updated