Muokkaa

Jaa


Color materials

Color materials are one of the supported material types in Azure Remote Rendering. They're used for meshes that shouldn't receive any kind of lighting, but rather always appear at full brightness. This might be the case for 'glowing' materials, such as car dashboards, light bulbs, or for data that already incorporates static lighting, such as models obtained through photogrammetry.

Color materials are more efficient to render than PBR materials because of their simpler shading model. They also support different transparency modes.

Color material properties

The following material properties are exposed in the runtime API, for instance on the C# ColorMaterial class or the C++ ColorMaterial class, respectively.

  • ColorFlags: Miscellaneous feature flags can be combined in this bit mask to enable the following features:

    • UseVertexColor: If the mesh contains vertex colors and this option is enabled, the mesh's vertex color is multiplied into the AlbedoColor and AlbedoMap. By default UseVertexColor is disabled.
    • DoubleSided: If double-sidedness is set to true, triangles with this material are rendered even if the camera is looking at their back faces. By default this option is disabled. See also Single-sided rendering.
    • AlphaClipped: Enables hard cut-outs on a per-pixel basis, based on the alpha value being below the value of AlphaClipThreshold (see below). This works for opaque materials as well.
    • TransparencyWritesDepth: If the TransparencyWritesDepth flag is set on the material and the material is transparent, objects using this material will also contribute to the final depth buffer. See the color material property ColorTransparencyMode in the next section. Enabling this feature is recommended if your use case needs a more plausible late stage reprojection of fully transparent scenes. For mixed opaque/transparent scenes, this setting may introduce implausible reprojection behavior or reprojection artifacts. For this reason, the default and recommended setting for the general use case is to disable this flag. The written depth values are taken from the per-pixel depth layer of the object that is closest to the camera.
    • FresnelEffect: This material flag enables the additive fresnel effect on the respective material. The appearance of the effect is governed by the other fresnel parameters FresnelEffectColor and FresnelEffectExponent explained below.
  • AlbedoColor: This color is multiplied with other colors, such as the AlbedoMap or vertex colors. If transparency is enabled on a material, the alpha channel is used to adjust the opacity, with 1 meaning fully opaque and 0 meaning fully transparent. The default albedo color is opaque white.

    Note

    Since color materials don't reflect the environment, a fully transparent color material becomes invisible. This is different for PBR materials.

  • AlbedoMap: A 2D texture for per-pixel albedo values.

  • AlphaClipThreshold: If the AlphaClipped flag is set on the ColorFlags property, all pixels where the albedo alpha value is lower than the value of AlphaClipThreshold won't be drawn. Alpha clipping can be used even without enabling transparency and is much faster to render. Alpha clipped materials are still slower to render than fully opaque materials, though. By default alpha clipping is disabled.

  • TexCoordMode: Defines the mode that is used to produce texture coordinates for the albedo texture. This mode is ignored if this material doesn't use a texture. By default, the texture coordinates are fetched from the mesh's input vertex streams (mode TextureCoordinateGenerationMode.SourceUv0 or TextureCoordinateGenerationMode.SourceUv1) and then transformed through TexCoordScale and TexCoordOffset. When setting up a material through code, this mode can also be set to TextureCoordinateGenerationMode.PlanarObjectSpace or TextureCoordinateGenerationMode.PlanarWorldSpace to generate the coordinates as the vertex distance to two configurable 3D planes TexCoordPlaneU and TexCoordPlaneV. This is referred to as 'planar texture mapping'.

  • TexCoordScale and TexCoordOffset: For texture coordinates from source mesh, an extra linear transform can be applied. The scale is multiplied into the UV texture coordinates, the offset is added to it. Can be used to stretch and shift the textures. The default scale is (1, 1) and offset is (0, 0).

  • TexCoordPlaneU and TexCoordPlaneV: For planar mapping modes, these define the texture planes for the u-coordinate and v-coordinate respectively. Planes are defined in standard normal form (A,B,C,D), so a coordinate is calculated as t = Ax + By + C*z + D, where (x,y,z) is the vertex position in either world or object space.

  • FresnelEffectColor: The fresnel color used for this material. Only important when the fresnel effect flag has been set on this material (see above). This property controls the base color of the fresnel shine (see fresnel effect for a full explanation). Currently only the RGB-channel values are important and the alpha value will be ignored.

  • FresnelEffectExponent: The fresnel exponent used for this material. Only important when the fresnel effect flag has been set on this material (see above). This property controls the spread of the fresnel shine. The minimum value 0.01 causes a spread across the whole object. The maximum value 10.0 constricts the shine to only the most grazing edges visible.

  • VertexMix: This value between 0 and 1 specifies how strongly the vertex color in a mesh contributes to the final color. At the default value of 1, the vertex color is multiplied into the albedo color fully. With a value of 0, the vertex colors are ignored entirely.

  • ColorTransparencyMode: Contrary to PBR materials, color materials distinguish between different transparency modes:

    • Opaque: The default mode disables transparency. Alpha clipping is still possible, though, and should be preferred, if sufficient.
    • AlphaBlended: This mode is similar to the transparency mode for PBR materials. It should be used for see-through materials like glass.
    • Additive: This mode is the simplest and most efficient transparency mode. The contribution of the material is added to the rendered image. This mode can be used to simulate glowing (but still transparent) objects, such as markers used for highlighting important objects.

Note

While AlbedoColor and FresnelEffectColor have the same accepted value range as for PBR materials, their channels will be effectively clamped to [0;1] for Color materials.

Color material overrides during conversion

A subset of color material properties can be overridden during model conversion through the material override file. The following table shows the mapping between runtime properties documented above and the corresponding property name in the override file:

Material property name Property name in override file
ColorFlags.AlphaClipped alphaClipEnabled
ColorFlags.UseVertexColor useVertexColor
ColorFlags.DoubleSided isDoubleSided
ColorFlags.TransparencyWritesDepth transparencyWritesDepth
AlbedoColor albedoColor
TexCoordScale textureCoordinateScale
TexCoordOffset textureCoordinateOffset
ColorTransparencyMode transparent
AlphaClipThreshold alphaClipThreshold

API documentation

Next steps