tencent cloud

Tencent Effect SDK

Material Features Specification

PDF
Focus Mode
Font Size
Last updated: 2026-03-30 18:03:43

Model Materials

Editing Model Materials

1. Drag the glb model into the Asset Panel. This automatically creates a resource folder.



2. Expand the folder and drag the prefab file into the Object Panel. The model will now appear in the scene.



3. There are two ways to modify the model's Material:
Method 1: Select the Mesh node for the model in the Object Panel. Then, edit the Material in the Component Panel on the right.



Method 2: In the Asset Panel, navigate to the xxx-gltf/materials directory, select the xxx.fmaterial file, and configure the Material in the panel on the right.




Switching Materials for a Model

Select the Mesh node in the Object Panel. In the Mesh component of the Component Panel on the right, choose the Material you want to apply.




Materials and Shaders

Overview

A Shader determines how the Mesh is rendered. A Material stores configurable parameters for the rendering method.
The dependency chain is Mesh → Material → Shader. Each Material can reference a Shader, and a single Shader can be shared across multiple Materials (using the same rendering method but with different parameter values).
For example: a Shader that implements Gaussian blur allows each Material to specify its own blur intensity.
Shaders are typically provided by developers or TE.

Switching the Shader for a Material

Switching Shaders lets you test different rendering methods using the same parameters. When you switch the Shader, the Material editing panel displays all parameters defined in the new Shader.
The Shader list includes both built-in Shaders and custom Shaders available in the Asset Panel.




Material Textures

Supported Resource Types

File Type
Texture Type
Notes
jpg/png
2D
-
ktx
2D / Cubemap
When an hdr file is dragged into TE, a ktx file is generated automatically and can be used in the material's texture field.
rdt
2D
RenderTarget.
pag
2D
-

Configuring Resource Textures

After selecting a resource, configure its texture in the right panel. See the screenshot below:




Built-in Shaders

The screenshot below shows the available built-in Shaders:
lit_xxx refers to a standard PBR Shader, with xxx indicating the blend mode.
unlit_xxx refers to a Shader without lighting, with xxx indicating the blend mode.
Because of engine limitations, separate unlit and PBR Shaders are provided for each blend mode.




Custom Shaders

Adding Custom Shaders

Shader files are mat files compatible with the Filament engine. Tencent Effect extends mat files with default values and UI configurations for each field.
To learn how to write mat files, see the Filament Material Authoring Guide.
After creating your Shader, rename its file extension to .fshader and drag it into the Tencent Effect Asset Panel.
Once added, select a Material file and switch its Shader to the custom Shader.

Shader Specification

Tencent Effect’s extended field configurations are defined in the ls_editor node, as shown below:




Fields Supported in the ls_editor Node

Field
Type
Required
Description
defaultValue
Depends on the type.
Yes
-
uiType
string
No
Specifies the UI type for editing this field.
By default, the UI type is recommended based on the field type.
uiHidden
bool
No
Controls whether the editing UI for this field is shown.<br>Default is true.
showIfKey
string
No
Controls whether this field is displayed based on the value of another field.
numberStep/numberRangeFrom/numberRangeTo
int/uint/float
No
Applies when uiType is int/uint/float.<br>Represents step size, start value, and end value.
enum
json array
Required when uiType is enum
Example:
[{
label:"UV0",
value: 0
},{
label:"UV1",
value: 1
}]

Default Values and Supported uiType for type

type indicates the data type of a uniform field supported by the engine.
type
defaultValue Example
Supported uiType
bool
true
bool, enum
bool2
[true, true]
bool2
bool3
[true, true, true]
bool3
bool4
[true, true, true, true]
bool4
int
1
int, enum
int2
[1, 2]
int2
int3
[1, 2, 3]
int3
int4
[1, 2, 3, 4]
int4
float
1.0
float, enum
float2
[1.0, 2.0]
float2
float3
[1.0, 2.0, 3.0]
float3
float4
[1.0, 2.0, 3.0, 4.0]
float4
uint
1
uint, enum
uint2
[1, 2]
uint2
uint3
[1, 2, 3]
uint3
uint4
[1, 2, 3, 4]
uint4
mat3
[1,0,0,0,1,0,0,0,1]
mat3
mat4
[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
mat4
sampler2d
""
file
samplerCubemap
""
file

uiType Options and UI Effects

uiType
UI Effect
bool



bool2



bool3



bool4



int/uint/float



int2/uint2/float2



int3/uint3/float3



int4/uint4/float4



file



int/float/uint with numberStep, numberRangeFrom, numberRangeTo



color



enum




Full Field Example Shader

Download and view: all_field_demo.fshader

Demo Videos and Resource Packs

Basic TE Workflow

View the basic workflow demonstration: Material_Demonstration.mp4

Feature Demos

Using RenderTarget as Material Input

This demo shows how to use the camera output as Material input.
Demo video: demo_renderTarget.MOV
Resource pack: demo_renderTarget.zip

Using Scripts to Switch Material Images

Using Scripts to Modify Material Base Color

Using Scripts to Control pag Playback Progress

This demo shows how to play pag in reverse using a script.

matcap Demo

Effect preview:



Resource pack: demo_matcap.zip

Frequently Asked Questions

Shader Error Notification

If a Shader contains errors and is applied to a Mesh, the Mesh will be rendered in magenta to indicate the issue. See the screenshot below:




Color Difference Issues

Scenarios and Causes of Color Differences

When creating effects and using the camera feed as a model texture, you may observe color differences between the camera feed on the model and the background image.
This happens because the 3D engine applies post-processing to the entire scene to enhance image quality after rendering. Tonemapping and gamma correction are performed during this stage.
Example:
In the demo below, the right half is rendered on a 3D mesh, and the left half shows the camera feed in the background. Color differences are clearly visible, and the desired effect matches the left side.



Solution: In the Object Panel, select the camera object. In the Component Panel on the right, uncheck the "Post Process" option under the Camera component. After disabling this option, the preview will match the background and no longer display color differences.





Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback