Materials

BBMOD has a powerful material system. Setting up a completely custom material is an advanced topic, outside of the scope of this quickstart guide. For the starters, you can create a clone of one of these materials:

  1. BBMOD_MATERIAL_DEFAULT for static models,
  2. BBMOD_MATERIAL_DEFAULT_ANIMATED for animated models with bones,

and change its base texture:

matSwordHilt = BBMOD_MATERIAL_DEFAULT.clone();
matSwordHilt.BaseOpacity = sprite_get_texture(SprSwordHilt, 0);

matSwordBlade = BBMOD_MATERIAL_DEFAULT.clone();
matSwordBlade.BaseOpacity = sprite_get_texture(SprSwordBlade, 0);

You can use method set_material to assign materials to models:

modSword.set_material("Hilt", matSwordHilt)
    .set_material("Blade", matSwordBlade);

Make sure to always use a shader that is compatible with your model (i.e. you cannot use BBMOD_MATERIAL_DEFAULT_ANIMATED for a model that does not have bones). For more info on materials, see the documentation of BBMOD_BaseMaterial.

Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on November 16, 2022 using GMDoc.