depthLayer property
Which surface wins where this material's geometry and another's lie in the same plane. A surface with a higher layer draws over coplanar surfaces with a lower one, at any distance and on every backend.
Use it for overlays that sit on a surface (a sign or screen on a wall, a road marking, a decal quad, a rug): place the overlay at the surface or slightly in front of it and give it layer 1, an overlay on that overlay layer 2, and so on. Negative layers let a ground yield to everything placed on it. Two different materials at the same layer that overlap in one plane flicker (z-fighting), so give them different layers or keep them apart.
Each layer moves the surface toward the camera in the vertex stage by a
quarter of a pixel's worth of its own depth slope plus a few
depth-buffer steps (more far from the world origin, where float rounding
is coarser). That beats the rasterizer's rounding on a surface seen at a
grazing angle, costs nothing per fragment, and never moves anything on
screen by more than a fraction of a pixel. Curved layered meshes get a
larger offset near their silhouettes. Clamped to -8..8. Shadow maps
ignore it. Defaults to 0.
Implementation
int get depthLayer => _depthLayer;
Implementation
set depthLayer(int value) {
_depthLayer = value.clamp(-kMaxDepthLayer, kMaxDepthLayer);
}