API Reference · Materials and textures
DetailLayer
public sealed class DetailLayerThe lights in a scene. As many as you like, and every one costs about what the last one did.
There is no free allowance and no cliff. One pass over the geometry draws all of them: the shader loops the lights it was given and stops when it runs out, so a scene with two lights pays for two. Each light adds a roughly constant amount of shading to every lit pixel, which on a desktop card at three megapixels measures around a tenth of a millisecond a frame — sixteen lamps in a room is a real choice an application can make, not a limit it has to design around.
Every kind counts the same. A DirectionalLight and a PointLight are one entry each, and a lamp that lights nothing still costs its distance test. The EnvironmentLight is not one of them — it is evaluated per pixel from the surface normal and costs the same whether or not there is a light in the scene at all.
One renderer has a ceiling, and it is not a fixed one. The shading language a browser compiles will not take a loop whose length is unknown when the shader is built, so OpenGL's light loop has to be written to some length — but the shader is built at run time, on a context that has already been asked how large a uniform block it allows, so the length is that context's rather than a number chosen for the weakest device anywhere. In practice that is LightCollection.Capacity at worst and sixty-four at best. Metal and the software renderer have no limit at all. A renderer says what it will do through RenderInfo.Features rather than leaving it to be discovered as a lamp that went out on one platform.
It used to throw on the fifth, on the reasoning that a light silently missing is a bug that gets diagnosed as a shader problem. That is still true of a light that is dropped — which is why the only renderer that drops one says so — but it was the wrong answer to the question. Refusing to draw what somebody asked for is not a kinder failure than drawing it.
Four was never a lighting decision either. The lights were fields in a uniform struct, a struct has to have a size, and four was where the size had been set.
Properties
| Member | Description |
|---|---|
| How many times the field repeats per metre, for materials that name no density of their own. Two hundred is a fifth of a millimetre per repeat at a 1024-pixel field, which is the scale this is for: below what any base map can carry and above what a repeat can be seen at. |
| The field. Null switches the layer off for every material, whatever their weights say. The channel layout is |