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>

BeautyType

Description

Value

VLINE

0

Sharpening Jaw

(V-Line)

Float ( 0 ~ 100 )

Default 0.

100 to the sharpest jaw

FACE_SLIM

1

Reducing Face Width

(Slimmer)

Float ( 0 ~ 100 )

Default 0.

100 to the slimmest face width

JAW

2

Decreasing Face Height

(Shorter Face)

Float ( 0 ~ 100 )

Default 0.

100 to the shortest face height

CHIN

3

Increasing or Decreasing Chin Length

(Chin Length)

Float ( 0 ~ 100 )

Default 50.

0 to the shortest

100 to the longest

EYE

4

Increasing Eye Size

(Eye Height)

Float ( 0 ~ 100 )

Default 0.

100 to the biggest

EYE_GAP

5

Increasing or Decreasing the Gap Between Eyes

(Gap between Eyes)

Float ( 0 ~ 100 )

Default 50.

0 to the shortest

100 to the highest

NOSE_LINE

6

Sharpening Nose Width

(Nose Width)

Float ( 0 ~ 100 )

Default 0.

100 to the slimmest

NOSE_SIDE

7

Shortening Width of Nostrils

(Nostrils Width)

Float ( 0 ~ 100 )

Default 0.

100 to the smallest

NOSE_LENGTH

8

Increasing or Decreasing Nose Length

(Nose Length)

Float ( 0 ~ 100 )

Default 50.

0 to the shortest

100 to the longest

MOUTH_SIZE

9

Increasing or Decreasing Mouth Width

(Mouth Width)

Float ( 0 ~ 100 )

Default 50.

0 to the smallest

100 to the largest

EYE_BACK

10

Increasing Back Side of Eyes

(Width of Back Side of Eyes)

Float ( 0 ~ 100 )

Default 0.

100 to the longest

EYE_CORNER

11

Increasing or Decreasing Degree of Eyes

(Degree of Eyes)

Float ( 0 ~ 100 )

Default 50.

0 to the lowest

100 to the highest

LIP_SIZE

12

Increasing or Decreasing Height Thickness of Lips

(Thickness of Lips)

Float ( 0 ~ 100 )

Default 50.

0 to the thinnest

100 to the thickest

SKIN_FACE

13

Hiding Facial Blemish

(Facial Blemish Removal)

Float ( 0 ~ 100 )

Default 0.

100 to the cleanest

SKIN_DARK_CIRCLE 14

Hiding Dark Circles

(Dark Circles Removal)

Float ( 0 ~ 1 00)

Default 0.

100 to the cleanest

SKIN_MOUTH_WRINKLE

15

Hiding Mouth Wrinkles

(Mouth Wrinkles Removal)

Float ( 0 ~ 100 )

Default 0.

100 to the cleanest

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