OptionalalphaBase opacity; alphaMode: 'opaque' ignores it
OptionalalphaAlpha below which fragments are discarded when alphaMode is 'mask'
OptionalalphaHow alpha is treated; see AlphaMode
OptionalbaseBase colour tint; the source's alpha is ignored, BaseMaterial3DOptions#alpha sets opacity
OptionalbaseBase colour (albedo) texture
Optional AdvanceddescriptorShader bits for the material's main pass, for a custom material
The material's textures and data are laid out from bitsGpu, so bitsGl must declare the same
texture names in the same order, or the constructor throws. A material whose bits change with
its settings overrides BaseMaterial3D#getPrimaryDescriptor instead.
OptionaldoubleWhen true, back faces are drawn too and lit with their normal flipped
Fixed at construction.
Optional AdvancedextraExtra shader bits composed into the material's shader, fixed for its lifetime
Material3D, PhongMaterial and FlatMaterial each document where they sit
in their bit list; on a material built from a raw descriptor, as ToonMaterial and
PortalMaterial are, they follow its bits. A bit may declare material fields and textures;
fill its textures through the textures option, or later through
BaseMaterial3D#textures. A bit that uses PI or INV_PI lists
mathConstantsBit in its ShaderBit#requires rather than declaring them, and one that
calls screenUVFromWorld or sampleScreenCopy lists screenSpaceFuncsBit. To add bits to a
material that exists, such as one the glTF loader built, material.clone({ extraBits }) makes a
copy with them and everything else the material has. For billboarding, set
Mesh3D#billboardMode instead.
OptionalflatWhen true, each triangle is shaded with its face normal instead of the smooth vertex normal
Gives a faceted, low-poly look with no duplicated vertices, so one geometry can draw smooth or faceted depending on its material. A normal map still applies on top. No visible effect on an unlit material such as FlatMaterial. Fixed at construction.
OptionalfogWhether the view's distance fog may reach this material
Turn it off for skyboxes, water and anything else with its own distance falloff; a sky dome past the fog's far distance would turn flat fog colour. Fixed at construction.
OptionallabelName for debugging and for finding the material; the glTF loader sets it to the name in the file
OptionalpassesExtra render passes this material draws in, keyed by the pass's name
true: draw in the pass with the pass's own shader and state.false, or left out: don't draw in it. Useful for opting out of a pass that spread options
or a subclass default turned on.A material can name a pass before the pass exists. A page has room for 24 custom pass names,
'outline' included, each taken the first time anything names it; a name past that joins
nothing, and a pass with it draws no meshes, without a warning.
OptionaltextureThe feed the portal shows, a render texture the size of the view
Another aspect ratio stretches the far side, and matching the view's pixel size keeps it sharp.
In a view with a 'beforeToneMapping' effect, give it an rgba16float format; see
PortalPass. The feed's alpha is ignored. Left out, the portal shows plain baseColor
until you set material.textures.portal.
Optional AdvancedtexturesTextures by slot name, for the slots a descriptor or extraBits declares
The bits' textures arrays decide which slots exist; this map only fills them. A slot left out
gets Texture.WHITE. A baseColor entry here wins over
BaseMaterial3DOptions#baseColorTexture.
OptionaltopologyPrimitive topology for every pass that doesn't set its own; left out, the geometry's is used
'line-list' joins the indices in pairs, so a triangle index buffer drawn that way isn't a
wireframe: it draws some edges and misses others. Use a geometry with line indices for that.
OptionaluvUV transform for every texture of the material; see BaseMaterial3D#uvTransform
Leave it out to let a framed (spritesheet) base colour texture set the transform.
OptionalvertexWhether a geometry's vertex colours (its colors) tint this material; see
BaseMaterial3D#vertexColors
Constructor options for PortalMaterial
baseColortints the feed.Example