Shaders

Currently, our engine supports only built-in shaders.
The provided shaders allow you to create PBR, sprite, transparent, and other types of materials.

You can set material properties via the code MaterialProperties API,
or by using our editor.

Built-in Shaders

standard_unlit_shader

Standard shader for unlit objects and sprites. No lighting is applied.

Properties:
  • transparencyMode : int = 0 – transparency mode. See TransparencyMode for details. To set the value, use the transparencyMode field in MaterialImport.

  • faceCullMode : int = 1 – face cull mode. See FaceCullMode for details. To set the value, use the faceCullMode field in MaterialImport.

  • renderOrder : int = 0 – global order in which meshes with this material should be rendered. Those with a lower renderOrder will be rendered first.

  • uvRect : float4 = float4(0, 0, 1, 1) – remapping for mesh UV coordinates: uvResult = uv * uvRect.zw + uvRect.xy.

  • atest : float = 0 – threshold for alpha test. Pixels with resulting opacity less than atest will be discarded.

  • color : float4 = float4(1, 1, 1, 1) – material color. If a diffuse texture is present, this works as a multiplier for it. The 4th component is the opacity (alpha) multiplier.

Note

Note that the uvRect and color properties can be overridden by the corresponding per-instance parameters. See Mesh.setPerInstanceData for more info.

standard_diffuse_shader

Default shader used when no shader name is provided. It’s suitable for simple graphics that don’t require advanced lighting. As the name suggests, only diffuse lighting is applied to the surface, without specular reflections.

Properties:
  • transparencyMode : int = 0 – transparency mode. See TransparencyMode for details. To set the value, use the transparencyMode field in MaterialImport.

  • faceCullMode : int = 1 – face cull mode. See FaceCullMode for details. To set the value, use the faceCullMode field in MaterialImport.

  • renderOrder : int = 0 – global order in which meshes with this material should be rendered. Those with a lower renderOrder will be rendered first.

  • uvRect : float4 = float4(0, 0, 1, 1) – remapping for mesh UV coordinates: uvResult = uv * uvRect.zw + uvRect.xy.

  • atest : float = 0 – threshold for alpha test. Pixels with resulting opacity less than atest will be discarded.

  • receiveShadows : int = 1 – whether the material should receive shadows. 0 – receive shadows, 1 – don’t receive shadows.

  • color : float4 = float4(1, 1, 1, 1) – material color. If a diffuse texture is present, this works as a multiplier for it. The 4th component is the opacity (alpha) multiplier.

  • emission : float4 = float4(0, 0, 0, 1) – material emission color. If an emission texture is present, this works as a multiplier for it. The 4th component is ignored.

Note

Note that the uvRect and color properties can be overridden by the corresponding per-instance parameters. See Mesh.setPerInstanceData for more info.

standard_specular_shader

Specular-workflow PBR shader. In addition to standard_diffuse_shader, it allows configuring specular reflection properties through specular and glossiness textures and the corresponding specularColor and glossiness parameters. Computing specular reflections adds a noticeable performance cost compared to standard_diffuse_shader.

Properties:
  • transparencyMode : int = 0 – transparency mode. See TransparencyMode for details. To set the value, use the transparencyMode field in MaterialImport.

  • faceCullMode : int = 1 – face cull mode. See FaceCullMode for details. To set the value, use the faceCullMode field in MaterialImport.

  • renderOrder : int = 0 – global order in which meshes with this material should be rendered. Those with a lower renderOrder will be rendered first.

  • uvRect : float4 = float4(0, 0, 1, 1) – remapping for mesh UV coordinates: uvResult = uv * uvRect.zw + uvRect.xy.

  • atest : float = 0 – threshold for alpha test. Pixels with resulting opacity less than atest will be discarded.

  • receiveShadows : int = 1 – whether the material should receive shadows. 0 – receive shadows, 1 – don’t receive shadows.

  • color : float4 = float4(1, 1, 1, 1) – material diffuse color. If a diffuse texture is present, this works as a multiplier for it. The 4th component is the opacity (alpha) multiplier.

  • specularColor : float4 = float4(0, 0, 0, 1) – material specular color. If a specular texture is present, this works as a multiplier for it. The 4th component is ignored.

  • emission : float4 = float4(0, 0, 0, 1) – material emission color. If an emission texture is present, this works as a multiplier for it. The 4th component is ignored.

  • glossiness : float = 1 – glossiness factor. Higher values make the surface appear smoother. If a glossiness texture is present, this works as a multiplier for it.

Note

Note that the uvRect and color properties can be overridden by the corresponding per-instance parameters. See Mesh.setPerInstanceData for more info.

standard_metallic_shader

Metallic-workflow PBR shader. In addition to standard_diffuse_shader, it allows configuring specular reflection properties through metalness and roughness textures and the corresponding metalness and roughness parameters. Instead of diffuse, an albedo texture is provided. It controls the specular reflection color for metallic surfaces and the diffuse color for non-metallic (dielectric) ones. Computing specular reflections adds a noticeable performance cost compared to standard_diffuse_shader.

Properties:
  • transparencyMode : int = 0 – transparency mode. See TransparencyMode for details. To set the value, use the transparencyMode field in MaterialImport.

  • faceCullMode : int = 1 – face cull mode. See FaceCullMode for details. To set the value, use the faceCullMode field in MaterialImport.

  • renderOrder : int = 0 – global order in which meshes with this material should be rendered. Those with a lower renderOrder will be rendered first.

  • uvRect : float4 = float4(0, 0, 1, 1) – remapping for mesh UV coordinates: uvResult = uv * uvRect.zw + uvRect.xy.

  • atest : float = 0 – threshold for alpha test. Pixels with resulting opacity less than atest will be discarded.

  • receiveShadows : int = 1 – whether the material should receive shadows. 0 – receive shadows, 1 – don’t receive shadows.

  • color : float4 = float4(1, 1, 1, 1) – material albedo color. If an albedo texture is present, this works as a multiplier for it. The 4th component is the opacity (alpha) multiplier.

  • emission : float4 = float4(0, 0, 0, 1) – material emission color. If an emission texture is present, this works as a multiplier for it. The 4th component is ignored.

  • metalness : float = 0 – metalness factor. Controls how metallic the surface will appear. If a metalness texture is present, this works as a multiplier for it.

  • roughness : float = 1 – roughness factor. Higher values make the surface appear rougher. If a roughness texture is present, this works as a multiplier for it.

Note

Note that the uvRect and color properties can be overridden by the corresponding per-instance parameters. See Mesh.setPerInstanceData for more info.

mobile_shader

Simplified version of standard_diffuse_shader without lighting from point lights and extra features like normal mapping, ambient occlusion, or light emission.

Properties:
  • transparencyMode : int = 0 – transparency mode. See TransparencyMode for details. To set the value, use the transparencyMode field in MaterialImport.

  • faceCullMode : int = 1 – face cull mode. See FaceCullMode for details. To set the value, use the faceCullMode field in MaterialImport.

  • renderOrder : int = 0 – global order in which meshes with this material should be rendered. Those with a lower renderOrder will be rendered first.

  • uvRect : float4 = float4(0, 0, 1, 1) – remapping for mesh UV coordinates: uvResult = uv * uvRect.zw + uvRect.xy.

  • atest : float = 0 – threshold for alpha test. Pixels with resulting opacity less than atest will be discarded.

  • receiveShadows : int = 1 – whether the material should receive shadows. 0 – receive shadows, 1 – don’t receive shadows.

  • color : float4 = float4(1, 1, 1, 1) – material color. If a diffuse texture is present, this works as a multiplier for it. The 4th component is the opacity (alpha) multiplier.

Note

Note that the uvRect and color properties can be overridden by the corresponding per-instance parameters. See Mesh.setPerInstanceData for more info.

panorama

Creates a skybox around the viewer from a user-provided panorama texture. Materials using this shader can only be used as a parameter to the Sky component.

sky_box

Creates a skybox around the viewer from a user-provided cube texture. Materials using this shader can only be used as a parameter to the Sky component.

sky_box_procedural

Creates a procedural skybox around the viewer. Materials using this shader can only be used as a parameter to the Sky component.

water_shader

Simulates a water surface.

Properties:
  • color : float4 = float4(1, 1, 1, 1) – water color. The 4th component is ignored.

  • specular_strength : float = 282.743

  • general_tiling : float = 5

  • time_speed : float = 0.5

  • flow_strength : float = 0.03

  • normal_flow_scale : float = 20

  • water_tiling : float = 3