API Reference · Materials and textures

ShadingModel

Namespace: Ava3D

public enum ShadingModel

How a surface turns light into colour.

Four whole models rather than an open-ended shader, which is the deliberate trade — see docs/effects-and-shaders.md. Each one is implemented on all four renderers or reported absent on the ones that cannot manage it, and none of them can draw the wrong picture on a renderer that has no shader stage at all.

Values

ValueDescription
Standard

Physically based: GGX specular, a diffuse lobe, the environment and every light.

Unlit

The base colour exactly, with no lighting at all — no key light, no environment, no emissive, occlusion or normal-map term. Alpha included.

Material.EmissiveColor is the obvious substitute and is not equivalent: emissive is added to a lighting result that is not zero, so an "unlit" surface still picks up the key light and the environment on top of its colour. On something meant to read as a flat disc — a sun, a lit panel, a screen — that shows up as a terminator across a shape that should have none.

Toon

Cel shading: the light response is quantised into Material.ToonBands steps, so a surface reads as flat areas divided by hard edges rather than as a gradient.

The specular and environment terms are untouched, so a toon surface still has a highlight and still sits in its scene; it is the direct light that steps. On the CPU renderer the bands come out soft rather than hard, because that renderer lights per vertex and the quantised corners are then interpolated across the triangle — see RenderInfo.Features, which says so.

Matcap

The surface is coloured by looking up Material.MatcapTexture with its own normal in view space — no lights, no environment, no shading maths at all.

A matcap is a photograph of a lit sphere, so a mesh wearing one inherits that sphere's material and lighting for nothing. It is what product viewers, CAD previews and model browsers reach for, which is most of what an Avalonia 3D control will spend its life being, and it is the cheapest way to make an untextured mesh look like something.

The one thing it is not is lit by the scene: a matcap surface looks the same whatever the lights do, because the lighting is baked into the image. Rotating the camera changes it; moving a lamp does not.

See also