tencent cloud

$0 14-Day TrialExperience EdgeOne for acceleration and security protection!

Feedback

Tencent Effect SDK

Using Animojis and Virtual Avatars

Last updated: 2024-05-08 16:34:16
The Tencent Effect SDK supports animojis and VR virtual avatars starting from v0.3.0.

Checking Support

Animojis and VR virtual avatars rely on a WebGL2 environment. The SDK offers a static method for you to check whether a browser supports the capability.
import {ArSdk} from 'tencentcloud-webar'
if (ArSdk.isAvatarSupported()) {
// Initialize the feature

} else {
alert('This browser does not support virtual avatars')
// Hide the feature
}

Animojis

Getting models

After initialization, you can get the built-in models. Currently, the SDK offers four built-in animoji models.
const avatarARList = await sdk.getAvatarList('AR')
Note:
Configuring animojis and virtual avatars will automatically remove other effects such as makeup and stickers, and vice versa.

Setting a model

After you get the list of built-in models, you can select one by specifying the EffectId parameter.
ar.setAvatar({
mode: 'AR', // Set the mode to `VR`
effectId: avatarARList[0].EffectId// Pass in the built-in ID
}, () => {
// success callback

});

Customizing a model

If you need to customize a model, feel free to contact us.

VR Virtual Avatars

Getting models

The list of built-in models can be obtained after the SDK is initialized. Currently, the SDK offers 10 virtual avatars.
const avatarVRList = await sdk.getAvatarList('VR')

Setting a scene


ar.setAvatar({
mode: 'VR', // Set `mode` to `VR`
effectId: avatarVRList[0].EffectId, // Pass in the built-in ID
backgroundUrl: 'https://webar-static.tencent-cloud.com/assets/background/1.jpg',
}, () => {
// success callback


});
Note:
To set a VR scene, you need to set the background image URL, or the black background will be used by default.

Customizing a model

You can quickly customize a virtual avatar in two ways and directly use it in the SDK.
Option 1. readyplayer.me
Option 2. Vroid
With either option, you need to upload the exported model to CDN and use the URL to set the SDK.
ar.setAvatar({
mode: 'VR', // Set `mode` to `VR`
url: 'https://xxxx.glb', // Pass in the built-in ID
backgroundUrl: 'https://webar-static.tencent-cloud.com/assets/background/1.jpg',
}, () => {
// success callback

});
Currently, a custom model can be either in GLB or VRM format.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon