BBMOD_DefaultMaterial

A constructor defined in BBMOD_DefaultMaterial.gml

Extends BBMOD_BaseMaterial

new BBMOD_DefaultMaterial([_shader])

Description

A material that can be used when rendering models.

Arguments

Name Type Description
_shader Struct.BBMOD_DefaultShader A shader that the material uses in the BBMOD_ERenderPass.Forward pass. Leave undefined if you would like to use BBMOD_Material.set_shader to specify shaders used in specific render passes.

Properties

Name Description
Emissive RGBM encoded emissive texture.
MetallicAO A texture with metallic in the red channel and ambient occlusion in the green channel or undefined.
NormalRoughness A texture with tangent-space normals in the RGB channels and roughness in the alpha channel or undefined.
NormalSmoothness A texture with tangent-space normals in the RGB channels and smoothness in the alpha channel or undefined.
SpecularColor A texture with specular color in the RGB channels or undefined.
Subsurface A texture with subsurface color in the RGB channels and subsurface effect intensity in the alpha channel.

Inherited properties

Name Description
AlphaBlend Use true to enable alpha blending. This can have negative effect on performance, therefore it should be used only when necessary. Default value is false.
AlphaTest Discard pixels with alpha less than this value. Use values in range 0..1.
Anisotropy The maximum level of anisotropy when BBMOD_Material.MipFilter is set to tf_anisotropic. Must be in range 1..16. Default value is 16.
BaseOpacity A texture with a base color in the RGB channels and opacity in the alpha channel.
BaseOpacityMultiplier Multiplier for BBMOD_Material.BaseOpacity. Default value is BBMOD_C_WHITE.
BlendMode A blend mode. Default value is bm_normal.
Culling A culling mode. Default value is cull_counterclockwise.
Filtering Use false to disable linear texture filtering for this material. Default value is true.
IsLoaded If false then the resource has not been loaded yet.
MipBias Defines a bias for which mip level is used. Can be also negative values to select lower mip levels. E.g. if mip level 2 would be normally selected and bias was -1, then level 1 would be selected instead and if it was 1, then level 3 would be selected instead. Default value is 0.
MipFilter The mip filter mode used for the material. Use one of the tf_ constants. Default value is tf_anisotropic.
MipMax The maximum mip level used, where 0 is the highest resolution, 1 is the first mipmap, 2 is the second etc. Default value is 16.
MipMin The minimum mip level used, where 0 is the highest resolution, 1 is the first mipmap, 2 is the second etc. Default value is 0.
Mipmapping Use one of the mip_ constants. Default value is mip_markedonly.
OnApply A function that is executed when the shader is applied. Must take the material as the first argument. Use undefined if you do not want to execute any function. Defaults to undefined.
Path The path to the file from which was the resource loaded, or undefined if the resource does not come from a file.
Persistent If true then the resource is persistent and it is not destroyed when method free is used. Default value is false.
RenderPass Render passes in which is the material rendered. Defaults to 0 (no passes).
RenderQueue The render queue used by this material. Defaults to the default BBMOD render queue.
Repeat Use true to enable texture repeat for this material. Default value is false.
ShadowmapBias Controls range over which the mesh smoothly transitions into shadow. This can be useful for example for billboarded particles, where harsh transition does not look good. Default value is 0, which means no smooth transition.
TextureOffset An offset of texture UV coordinates. Defaults to (0, 0). Using this you can control texture's position within texture page.
TextureScale A scale of texture UV coordinates. Defaults to (1, 1). Using this you can control texture's size within texture page.
ZFunc The function used for depth testing when BBMOD_Material.ZTest is enabled. Default value is cmpfunc_lessequal.
ZTest If true then models using this material should be tested against the depth buffer. Defaults value is true.
ZWrite If true then models using this material should write to the depth buffer. Default value is true.

Methods

Name Description
set_emissive Changes the emissive color to a uniform value for the entire material.
set_metallic_ao Changes the metalness and ambient occlusion to a uniform value for the entire material.
set_normal_roughness Changes the normal vector and roughness to a uniform value for the entire material.
set_normal_smoothness Changes the normal vector and smoothness to a uniform value for the entire material.
set_specular_color Changes the specular color to a uniform value for the entire material.
set_subsurface Changes the subsurface color to a uniform value for the entire material.

Inherited methods

Name Description
apply Makes this material the current one.
clone Creates a clone of the material.
copy Copies properties of this material into another material.
destroy Frees memory used by the struct.
free Releases a reference to the resource.
from_buffer Loads the resource from a buffer.
from_file Loads the resource from a file.
from_file_async Asynchronnously loads the resource from a file.
from_json Loads material properties from a JSON object.
get_shader Retrieves a shader used in a specific render pass.
has_shader Checks whether the material has a shader for the render pass.
ref Retrieves a reference to the resource.
remove_shader Removes a shader used in a specific render pass.
reset Resets the current material to undefined.
set_base_opacity Changes the base color and opacity to a uniform value for the entire material.
set_shader Defines a shader used in a specific render pass.
to_buffer Writes the resource to a buffer.
to_file Writes a resource to a file.
to_json Saves material properties to a JSON object.

Child structs

BBMOD_DefaultLightmapMaterial, BBMOD_ParticleMaterial

See also

BBMOD_DefaultShader

Do you find this page helpful?

Copyright © 2024, BlueBurn. Built on April 26, 2024 using GMDoc.