config.json
#
LayersThe rendering engine processes the image in 6 steps. Their drawing order is as follows:
serial number | rendering target | config.json property name |
---|---|---|
1. | Camera image | camera |
2. | Effect background | background |
3. | Background separation | backgroundSeparation |
4. | Effects based on face recognition data | frx |
5. | Effect foreground | foreground |
6. | Final processing | final |
Do not configure the background effect if you need the background separation feature. There is no need to enable both of these layers simultaneously.
The 3D effect is drawn on the layer with face recognition data. The Filter Editor models are imported into this layer.
note
You can apply different blending modes to combine layers.
#
File StructureFeatures that are configured by config.json along with rendering layers.
Option | Description |
---|---|
name | Effect name. Should correspond to the effect folder name. |
display_name | User friendly effect name (optional). |
version | Configuration version. Defaulted to 1 if skipped. |
camera | Effect applied to the camera texture. |
background | Effect applied to the background layer. |
backgroundSeparation | Background effect applied around the user's silhouette. |
frx | 3D effect |
foreground | Foreground effect |
rotation_vector | Enables device rotation for the effect. |
final | Final result on the effect. |
sounds | Sound files for the effect. |
voiceChanger | Audio effect applied after the recording. |
recognizer | Recognizer features to enable. |
#
File structure example#
FRXcamera, background, backgroundSeparation, frx and foreground layers have the same option possible: media. With this option you can set image, video or gif texture, which will render on this layer. You can also choose the layer blending mode, opacity, etc. The FRX layer doesn't provide rendering, but it can provide video texture to glfx_VIDEO uniform sampler, which you can use to apply to some materials. These layers have 2 options: type and media.
Option | Type | Variants | Description |
---|---|---|---|
type | REQUIRED | 3D_ANIM, MEDIA | describes the effect type applied to the layer |
media | OPTIONAL | media option described in the detail later |
#
FRX and camera layers example#
FinalThe layer "final" describes effects applied to the final rendered frame. The layer "final" provides the next options:
Option | Type | Variants | Description |
---|---|---|---|
type | REQUIRED | FILTER | Additional shader processing |
filter | REQUIRED | Option that describes the filter |
The option "filter" provides the next options:
Option | Type | Variants | Description |
---|---|---|---|
fragmentCode | REQUIRED | fragment shader file to process the final image | |
textures | OPTIONAL | textures for the fragment shader |
The option "textures" is a list of objects where you need to set 2 required properties and 2 optional ones:
Property | type | Variants | Description |
---|---|---|---|
file | REQUIRED | texture file attached to the shader and provided by fragmentCode option | |
sampler | REQUIRED | The name of the texture declared in the shader code which is transmitted via "fragmentCode" | |
magFilter | OPTIONAL | LINEAR, NEAREST, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR | sets magnification filter |
minFilter | OPTIONAL | LINEAR, NEAREST, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR | sets minification filter |
#
Layer "final" example#
MediaOption "media" describes textures data added to a layer. "Media" can be added only as an option in camera, background, backgroundSeparation , frx and foreground layers.
Option | Type | Variants | Description |
---|---|---|---|
type | REQUIRED | PICTURE,VIDEO | describes texture type (GIF files should have VIDEO typegst) |
file | REQUIRED | "image.png", "animation.gif", "video.mp4" | texture file name |
mode | OPTIONAL | RGB | Default image only with rgb channels |
OPTIONAL | RGBA | Applied commonly to video textures. The width of the textures should be twice bigger than RGB image. RGB data is on the left part of the image and alpha on the right | |
blend | OPTIONAL | normal, alpha, multiply, darken, screen, lighten, hardlight, hard_light, overlay, pinlight, pin_light, add, colordodge, color_dodge, softlight, soft_light | blending mode |
opacity | OPTIONAL | [0;1] | Layer opaqueness |
videoSpeed | OPTIONAL | any float | Video file frame rate multiplier (applied only to type "VIDEO") |
link | OPTIONAL | Applicable to the Background, Foreground and Camera layers. Describes Video/Picture UV point with coordinates in range (0..1) binding with model vertex by its index. |
"link" option provides the next options:
Option | Type | Variants | Description |
---|---|---|---|
index | OPTIONAL | any int | index of vertex |
scaleX | OPTIONAL | any float | scale uv on X axis |
scaleY | OPTIONAL | any float | scale uv on Y axis |
u | OPTIONAL | [0;1] | u coordinate |
v | OPTIONAL | [0;1] | v coordinate |
#
"media" option example#
SoundsThe option "sounds" is a list with audio files data objects. These objects should contain the next properties:
Property | Type | Variants | Description |
---|---|---|---|
trackName | REQUIRED | audio file name | |
type | OPTIONAL | background | applied without audio filters (e.g.: voice changer) |
volume | OPTIONAL | [0;1] | sound volume |
#
"sounds" option example#
Voice changerThe option "voiceChanger" applies audio filter to the recorded audio track in video. The option "voiceChanger" has the next options:
Option | Type | Variants | Description |
---|---|---|---|
audioFilters | REQUIRED | list of audio filter objects. |
Audio filter objects should have the next properties:
Property | Type | Variants | Description |
---|---|---|---|
pitch | REQUIRED | pitch audio filter, has property "pitchShift", sets pitch shift value [-2400;2400] |
#
"voiceChanger" option example#
RecognizerThe option "recognizer" is a list of features and neural networks enabled for this effect.
#
"recognizer" option example#
Rotation vectorThe option "rotation_vector" turn's on/off updates of Gravity vector had been set in config.js Api.dynGravity() after device rotation.