Interface Material
- All Known Implementing Classes:
Material.Pbr,Material.Raw,Material.SimpleLit,Material.Surface,Material.Unlit
Material.Unlit, Material.SimpleLit and
physically-based Material.Pbr models, generated from the neutral shader IR, plus
two ways for an application to shade something the built-ins cannot express.
The two are not interchangeable and the choice is usually easy.
Material.Surface supplies the four surface expressions in the same neutral IR the
built-ins are written in: it is lit by the engine (every light on the
pass, the shadow map, the environment), and it compiles to every
TargetProfile the toolkit supports. Material.Raw is
hand-written GLSL that replaces the whole program: it sees no lights and no
textures, and it is, by definition, non-portable.
Reach for Surface for a material; reach for Raw for something
that is not one.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA tangent-space normal map and how far to lean on it.static final recordMetallic-roughness PBR (Cook-Torrance GGX), lit by everyLighton the pass plus a flat ambient term.static final recordCustom GLSL.static final recordLambert diffuse from the pass's single directional light, over a base color.static final recordA surface the application builds itself, out of the same neutral shader IR the built-in materials are generated from, and lit by the same core.static final recordA flat/vertex color, unaffected by lights. -
Method Summary
-
Method Details
-
blend
How this surface composites with what is already in the target, ornull(the default) for an opaque one.Opaque draws are issued first, in submission order; they write depth and cast shadows. Blended draws follow, also in submission order, and they test depth but do not write it, so overlapping transparent surfaces all show instead of the nearest one hiding the rest. Nothing sorts them: a pass places every mesh exactly where the caller put it, and back-to-front order (where it matters, which is
BlendMode.NORMALand notBlendMode.ADDITIVE) is the caller's to arrange, inside its own geometry as much as between draws.The modes and their equations are the 2D canvas's (
BlendMode): an additive 3D surface and an additive 2D sprite composite identically, because both pipelines are premultiplied.There is deliberately no alpha-test mode. Cutout foliage stays opaque (depth-writing and shadow-casting) and discards in its surface function.
-
isOpaque
default boolean isOpaque()Whether this surface writes depth and casts shadows, i.e.blend()is unset.
-