Skip to content
nasafrasa edited this page Apr 21, 2024 · 4 revisions

Making multiple materials using Blender

⚠️ Before you start this, make sure you have already have:

If you have all of these done, you can continue!

Assigning materials to objects in Blender

Lets say for example I want to make this specific cube have a material that makes it red without changing the rest of the cubes.

What we have to is, while selecting that cube, click the material tab on the sidebar and make a new material.

Lets name this material RedCube, this will be what we refer to in our code to get this object. We also don't need to worry about the color in Blender, we will give it color with our code.

We then can export this model, and now we can move on to implementing it into our code.

Implementing materials in Code

The first thing use do in our code, is make a material for our cube to have. You can put this anywhere in your script.

map.geoMaterials["RedMaterial"] = { // Makes a material called "RedMaterial"
    shader: "Standard", // Gives the standard shader to this material
    color: [1, 0, 0] // Gives color to this material, in this case its red!
}

Next to actually implement the material into the model, we can do this:

//! This code goes in between where defined our scene (const scene) and where we make it (scene.static()), like this:

const scene = new rm.ModelScene(new rm.Geometry("Cube"));

scene.addPrimaryGroups(
    "RedCube", // This is where the material name from Blender goes!
    new rm.Geometry("Cube", "RedMaterial") // Makes that cube in blender, a new geometry object that is a cube, with the material we made above in our code, "RedMaterial"
)

scene.static("skrunkle");

After we run our code now and refresh out map in Beat Saber, we should see that the one cube has changed!

Extra stuffs

Material options

There are many different materials you can make using chroma, here's a list of what you can do with materials:

Material Shaders

  • BTSPillar
  • BaseWater
  • BillieWater
  • InterscopeCar
  • InterscopeConcrete
  • Obstacle - Broken
  • OpaqueLight
  • Standard
  • TransparentLight
  • WaterfallMirror

Clone this wiki locally