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.
C#
ContentType enum
1
[Serializable]
2
public enum ContentsType
3
{
4
ARGItem = 0,
5
FilterItem = 1,
6
Beauty = 2,
7
Bulge = 3
8
}
Copied!

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.
C#
set an ARG Item
1
/*
2
type ARGContent Type
3
filePath Contents downloaded path
4
uuid uuid of an item
5
callback callback result
6
*/
7
8
public void SetItem(ARGEnum.ContentsType type, string filePath, string uuid, ARGearContentsCallback callback = null)
9
{
10
#if UNITY_ANDROID
11
argearNative.SetItem(type, filePath, uuid, null, new ARGearAndroidContentsCallback(
12
success =>
13
{
14
if (callback != null) callback.OnSuccess();
15
},
16
error =>
17
{
18
if (callback != null) callback.OnError(error);
19
}
20
));
21
#elif UNITY_IOS
22
argearNative.SetItem(type, filePath, uuid, callback);
23
#endif
24
}
25
Copied!

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.
C#
Set Beauty Values
1
// Set all Beauty values at once
2
float[] BeautyDataDefault = {
3
10f, //VLINE
4
90f, //ACE_SLIM
5
55f, //JAW
6
-50f, //CHIN
7
5f, //EYE
8
-10f, //EYE_GAP
9
0f, //NOSE_LINE
10
35f, //NOSE_SIDE
11
30f, //NOSE_LENGTH
12
-35f, //MOUTH_SIZE
13
0f, //EYE_BACK
14
0f, //EYE_CORNER
15
0f, //LIP_SIZE
16
50f, //SKIN
17
0f, //DARK_CIRCLE
18
0f //MOUTH_WRINKLE
19
};
20
21
ARGearManager.Instance.SetBeauty(BeautyDataDefalut);
Copied!

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.
C#
BulgeType Enum
1
[Serializable]
2
public enum BulgeType
3
{
4
NONE = -1,
5
FUN1 = 1,
6
FUN2 = 2,
7
FUN3 = 3,
8
FUN4 = 4,
9
FUN5 = 5,
10
FUN6 = 6
11
}
Copied!
Sample code to set a face fun bulge effect is written below.
C#
Set a Face Fun Bulge Effect
1
if (button.name.Equals("ClearButton"))
2
{
3
ARGearManager.Instance.ClearContents(ARGEnum.ContentsType.Bulge);
4
}
5
else if (button.name.Equals("Fun1Button"))
6
{
7
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN1);
8
}
9
else if (button.name.Equals("Fun2Button"))
10
{
11
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN2);
12
}
13
else if (button.name.Equals("Fun3Button"))
14
{
15
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN3);
16
}
17
else if (button.name.Equals("Fun4Button"))
18
{
19
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN4);
20
}
21
else if (button.name.Equals("Fun5Button"))
22
{
23
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN5);
24
}
25
else if (button.name.Equals("Fun6Button"))
26
{
27
ARGearManager.Instance.SetBulge(ARGEnum.BulgeType.FUN6);
28
}
Copied!

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.
C#
Clear Contents
1
ARGearManager.Instance.ClearContents(ARGEnum.ContentsType.Beauty);
Copied!
Last modified 1yr ago