API Reference · Materials and textures

VertexAlphaMode

Namespace: Ava3D

public enum VertexAlphaMode

What the alpha channel of Mesh.Colors means on a material that is not transparent.

A vertex colour's alpha has nowhere to go on an opaque surface — it is multiplied into the base colour and then discarded at the end of the shader, because the blend does not read it. That is four bytes a vertex already uploaded, already interpolated, and thrown away, which makes it the cheapest per-vertex channel the control has to offer.

What it is worth spending on is roughness, and the reason is that roughness is the one surface property with no per-vertex route at all. Base colour has Mesh.Colors; normals have the vertex normal; roughness has a scalar and a texture and nothing in between. A generated mesh — a head out of surface nets, a terrain patch out of noise — has no UV layout worth painting a map in, so varying roughness across it today means cutting it into several meshes with several materials, which is several draws and a seam at every boundary.

Values

ValueDescription
Opacity

Alpha is opacity, multiplied into the base colour's own. The default, and what every material did before this property existed.

Roughness

Alpha multiplies Material.Roughness, and does not touch opacity.

1 leaves the material's roughness alone, so a mesh whose colours are opaque — which is what Mesh.WithColors produces unless a caller says otherwise, and what a mesh carrying no colours at all is uploaded with — renders identically in either mode. Below 1 the surface gets smoother, down to a mirror at 0.

Downwards rather than upwards because the material's roughness stays the matte end of the range: a face authored at 0.8 has dry hide at alpha 1, damp lip at 0.5 and wet eye at 0.1, all on one mesh in one draw with no seam anywhere. There is no way to ask for rougher than the material, which is the same relationship the metallic-roughness map already has with its factor.

Opacity is left at the base colour's own alpha rather than forced to 1: a blended material can still fade as a whole, it simply stops being able to fade per vertex. A material in this mode with Material.Blend at BlendMode.Opaque — which is what this is for — has no opacity to lose.

See also