new BasicMaterial(options)
Parameters:
| Name | Type | Description |
|---|---|---|
options |
An object with key/value pairs describing the initial values of the material.
|
BasicMaterial#SPECULAR_MAP_ROUGHNESS_ONLYBasicMaterial#SPECULAR_MAP_ALLBasicMaterial#SPECULAR_MAP_SHARE_NORMAL_MAPBasicMaterial#SPECULAR_MAP_METALLIC_ROUGHNESS
Properties:
| Name | Type | Description |
|---|---|---|
doubleSided |
boolean | Defines whether the material is double sided (no back-face culling) or not. An easier-to-read alternative to |
alpha |
number | The overall transparency of the object. Has no effect without a matching blendState value. |
useVertexColors |
boolean | Defines whether the material should use the hx_vertexColor attribute. Only available for meshes that have this attribute. |
billboardMode |
number | Defines whether or not the material renders the geometry aligned to the camera. |
color |
Color | The base color of the material. Multiplied with the colorMap if provided. |
emissiveColor |
Color | The emission color of the material. Multiplied with the emissionMap if provided. |
colorMap |
Texture2D | A |
normalMap |
Texture2D | A |
occlusionMap |
Texture2D | A |
emissionMap |
Texture2D | A |
specularMap |
Texture2D | A texture containing specular reflection data. The contents of the map depend on |
translucencyMap |
Texture2D | A texture containing translucency data |
maskMap |
Texture2D | A |
colorMapScale |
Float2 | A |
colorMapOffset |
Float2 | A |
normalMapScale |
Float2 | A |
normalMapOffset |
Float2 | A |
specularMapScale |
Float2 | A |
specularMapOffset |
Float2 | A |
emissionMapScale |
Float2 | A |
emissionMapOffset |
Float2 | A |
translucencyMapScale |
Float2 | A |
translucencyMapOffset |
Float2 | A |
maskMapScale |
Float2 | A |
maskMapOffset |
Float2 | A |
specularMapMode |
number | Defines the contents of the specular map. One of the following: |
metallicness |
number | A value describing the overall "metallicness" of an object. Normally 0 or 1, but it can be used for some hybrid materials. |
normalSpecularReflectance |
number | The amount of light reflecting off a surface at 90 degrees (ie: the minimum reflectance in the Fresnel equation according to Schlick's approximation). This is generally 0.027 for most materials. |
roughness |
number | The microfacet roughness of the material. Higher values will result in dimmer but larger highlights. |
roughnessRange |
number | Represents the range at which the roughness map operates. When using a roughness texture, roughness represents the middle roughness, range the deviation from there. So textured roughness ranges from [roughness - roughnessRange, roughness + roughnessRange] |
alphaThreshold |
number | The alpha threshold that prevents pixels with opacity below this from being rendered. This is not recommended on certain mobile platforms due to depth buffer hierarchy performance. |
translucency |
Color | The translucency color for the material. This causes lighting from the back to come through. |
Extends
Members
-
<static> BILLBOARD
-
Used for billboardMode to specify the geometry should be aligned to the camera, but the Z axis still aligns to the world up axis.
-
<static> MESH
-
Used for billboardMode to specify the material should render as a default Mesh.
-
<static> SPECULAR_MAP_ALL
-
Used for specularMapMode to specify the specular map has rgb channels containing roughness, normal reflectance and metallicness, respectively
-
<static> SPECULAR_MAP_METALLIC_ROUGHNESS
-
Used for specularMapMode to specify the specular map has gb channels containing metallicness and roughness. This is the glTF standard.
-
<static> SPECULAR_MAP_ROUGHNESS_ONLY
-
Used for specularMapMode to specify the specular map only uses roughness data
-
<static> SPECULAR_MAP_SHARE_NORMAL_MAP
-
Used for specularMapMode to specify there is no explicit specular map, but roughness data is present in the alpha channel of the normal map.
-
<static> SPRITE
-
Used for billboardMode to specify the geometry should be aligned to the camera completely.
-
blendState
-
The blend state used for this material.
- Inherited From:
- See:
-
cullMode
-
Defines how back-face culling is applied. One of
CullMode.- Inherited From:
-
debugMode
-
Allows setting the output to something different than the lit material, such as normals.
- Inherited From:
-
fixedLights
-
Allows setting a specific set of lights to this material, avoiding having to figure out lighting dynamically. This will cause all lighting to happen in a single pass, which is generally much faster than any other option.
- Inherited From:
-
lightingModel
-
The {@options LightingModel} used to light this material.
- Inherited From:
- Overrides:
-
writeColor
-
Defines whether or not this material should write color information. This should only be used for some special cases.
- Inherited From:
-
writeDepth
-
Defines whether or not this material should write depth information.
- Inherited From:
Methods
-
<static> roughnessFromShininess(specularPower)
-
Converts to roughness from a "shininess" or "gloss" property, traditionally used in Phong lighting.
Parameters:
Name Type Description specularPowerThe specular power used as the gloss parameter.
-
setTexture(slotName, texture)
-
Assigns a texture to the shaders with a given name.
Parameters:
Name Type Description slotNamestring The name of the texture as it appears in the shader code.
textureTexture2D The texture to assign
- Inherited From:
-
setTextureArray(slotName, texture)
-
Assigns a texture array to the shaders with a given name.
Parameters:
Name Type Description slotNamestring The name of the texture array as it appears in the shader code.
textureArray An Array of
Texture2Dobjects- Inherited From:
-
setUniform(name, value [, overwrite])
-
Sets a uniform value to the shaders.
Parameters:
Name Type Argument Description nameThe uniform name as it appears in the shader code.
valueThe uniform value. For vectors, this can be a
Float2,Float4, or an Arrayoverwrite<optional>
If the value was already set, ignore the new value. Defaults to true.
- Inherited From:
-
setUniformArray(name, value, overwrite)
-
Sets the value for a uniform array to the shaders.
Parameters:
Name Type Description nameThe uniform array name as it appears in the shader code.
valueAn array of values.
overwrite(Optional) If the value was already set, ignore the new value.
- Inherited From: