Boe6's vehicles: Textures & Materials
Last updated
Last updated
Published: Nov 5, 2023 by Meta Pixel Last documented edit: Oct 15 2024 by
This guide is part of Boe6's Guide: new car from A to Z and covers the material part of it.
By default, cars use the multilayered shader. You can find guides about editing multilayered material linked at the top of the documenation page.
To learn more about materials, you can browse Cheat sheet: Materials and its sub-pages.
.mlmask
, .mlmaskset
& .masklist
To fix the odd textures that appear after importing your custom models, we have to edit the .mlmask
layers.
Find the .mlmask
corresponding file by opening a .mesh
in wkit to edit. Go to the path:
RDTDataViewModel > localMaterialBuffer > materials > 0 (...maskset) > values > 0 > value
Add the .mlmask
to the project.
Rename and move the .mlmask
file into your project filepath.
Example:
“boe6\mini_cooper\meshes\textures\boe6_mini_cooper_exterior_maskset.mlmask”
Export the .mlmask
file. It should result in a .masklist
file and a folder with .png
files inside:
Notice the first white image, and the remaining black images with white cutouts.
These textures don’t map onto the new vehicle’s mesh correctly. These can be edited to add more detail to your model.
As a temporary solution, we can edit the first image to be pure white, and the rest to be pure black. Example:
Import the .masklist
file
Update your .mesh
file with the new .mlmask
name/path file:
RDTDataViewModel > localMaterialBuffer > materials > 0 (...maskset) > values > 0 > value
Your vehicle should now be much smoother.
Note that you will need every .mesh file to have a corrected .mlmask path.
.mlsetup
& MLsetupBuilderTo change paint color, we need to edit the .mlsetup
file.
You will need the MLsetupBuilder plugin for editing these files. Install it in wkit:
HOME button (top left) > Plugins (left list) > MLsetupBuilder, right side, install.
Once installed, hit open. It will open a folder with a “MlsetupBuilder.exe” executable. Run it to open the program.
The .mlsetup
file we need is linked in the .mesh
file, similar to the .mlmask
:
RDTDataViewModel > localMaterialBuffer > materials > 0 / masksset > values > MultilayerSetup > Value
Add this .mlsetup
file to the project. Rename and move it.
Example:
“boe6\mini_cooper\meshes\textures\boe6_mini_cooper_exterior.mlsetup
”
Convert the .mlsetup
file into .json
by right clicking:
Open MlsetupBuilder.
Import the .mlsetup.json
file by hitting the arrow in the top left:
You can also right-click on the .mlsetup.json file and choose "Open in MlSetupbuilder". The file will be automatically loaded when it opens.
Once you open the file, a window will appear on the left with a list of materials. These are the texture layers of your mesh.
Note that layers 0,1,2,etc are linked the .mlmask layers.
At the top is a large orange button titled “Import the Multilayer Setup >>”. Click it to load the .mlsetup
file into the editor. It should populate the Layers list:
Now, assuming you created a .mlmask
file similar to our previous steps, with all but 1 black image (see below), we know only the first layer, Layer 0, is the only one that will currently render on our .mesh
Since Layer 0 is the visible layer, select it and it will load in the Material view:
This is where we edit the layer. If you only want to change the color to a common one, choose one from the lower color palette. Here I have chosen blue:
You can also change to another material texture here by clicking the preview ball:
This can be used to create different paint finishes, cloth texture, etc.
Once you have finished editing a layer, you can save it by clicking “Apply edits” at the top of the Layers panel:
Then you can select another layer and edit the next one if needed. If you select a new layer without applying the edits, the changes will be lost.
Once finished, you can Export to save it to your file explorer, and then load it in wkit by right clicking the .json
and selecting “convert from JSON”.
Example:
Save and Test in game
Working color:
Custom RGB value colors can be set with a custom .mltemplate
file. Here we will only set RGB values, but this file can control other material settings/textures as well.
Find the material you want to have a custom RGB value for in MlsetupBuilder, and click on the material name to show it’s file path. Example:
Add that file to the project, rename, and move it. Once it’s in place, you can copy it’s relative path and paste it into MlsetupBuilder for that layer:
Open the .mltemplate
file in wkit and navigate to the colorScale
array:
RDTDataViewModel > overrides > colorScale
This array contains all colors in the material. Open one of the Multilayers
and it’s “v
” values, which control the RGB values:
First, you can verify the color in . Copy the “n
” value here, and paste it into MlsetupBuilder in the Color filter:
Select the color, and it’s rgb values should match the values in the “v
” colorScale
in the .mltemplate
:
Edit the 0,1,2 (R,G,B) values to the color values needed and save. Make sure to save the .mlsetup as well with the layer set to the same color code as before.(“n” value, [00cf56_69039f])
Save and test.
To have multiple materials in a single .mesh file, the .glb export requires separate submeshes all selected in blender. Separate your blender .mesh into parts, and group them based on material.
First separate/split your meshes into small components, and then join them into groups:
For example, mine are grouped by body paint, silver trim, reflective black, matte black, and grey fabric. Take note, the order in your blender selection will be the order each submesh is called by the .mesh
file settings. This order is important.
With all the objects selected in blender, export it to .glb
and import it as you normally would.
You can save and test. If it worked properly, only the first object included in the blender export will render properly at the moment.
Example of a finished body mesh in blender:
Currently the other submeshes will not render properly. This is due to submesh materials being controlled by the chunkMaterials in your appearance settings (.app
file).
To correct this, start by duplicating an item in the chunkMaterials
list. Path:
.mesh > RDTDataViewModel > appearances > 0 > chunkMaterials
Make sure to edit the name to a unique name, as we are creating new materialEntries
. Repeat as needed. In my case I needed 6 extra layers:
Next, navigate to RDTDataViewModel > materialEntries
This list controls the names and index of each item in the localMaterialBuffer
, which we’ll edit soon. You’ll want to duplicate an item with similar qualities. If you are adding a plastic material, duplicate another plastic or solid material in the list. If you are adding glass, duplicate from a vehicle_lights
material, then edit as needed. Duplicate one for each new material.
Make sure to update the index values of each item in the materialEntries array. They must all be the same as their index in their current array. 4 to 4, and so on:
ALL items in the list update the index of both new items, and old ones that moved down the list
Next we’ll update the materialBuffer
with new .mlsetup
and .mlmask
files. Keep in mind the .mlmask
files can be edited to match the model to a texture. However we’ll be working around that by using the same method used previously, to have a .mlmask
file with one additional white layer.
Note the 0 layer will always be white.
Example:
Notice how I have a .mlmask
file dedicated to the 4th layer, so all other layers are muted. I have 20 (0 through 19) unique .mlmask
files, each selecting a different layer from a .mlsetup
file.
Speaking of .mlsetup
, I have created a .mlsetup
file with MlsetupBuilder. Layers 0 through 7 are used for the new materials:
Now to finish the materials setup, open the following .mesh
path:
.mesh > RDTDataViewModel > localMaterialBuffer > materials
This array contains every CMaterialInstance
for the .mesh
file. This array has it’s items named via the materialEntries
list we just edited. Since we added items to that list, those names now show in this localMaterialBuffer > materials
list. However the data in each item is still it’s original.
For example, in this picture, the array hasn’t been updated yet, however the names are updated. This means the index 1 item, …”masksset_texture
” has the properties of “reflector
”, which would normally be the 2nd item.
To fix this, duplicate the appropriate items, similar to before, once for each new material. Once done, the previous index 1 item will now be higher, but matched correctly. In my files, I duplicated “ml_v_sport2_porsche_911turbo_exterior_masksset
” 6 times, and they each pasted directly below the 1st.
You can tell if the materials are correct by opening them, and looking into the “values
” array. Each will have similar keyValuePairs
related to the material type. Glass
mentions GlassSpecular
, normal paint has many map layers, stickers dont have much, etc:
For each new material layer, update the paths:
CMaterialInstance > values > MultilayerMask > value
CMaterialInstance > values > MultilayerSetup > value
For mlsetup
, I use the previously mentioned file, with layers setup for individual materials.
For the mlmask
, use the “masksset_00
” for the layer you want to enable.
Submeshes should now load in order with matched materials.
Editing UV maps may be necessary for some meshes if they do not display correctly, or for custom editing. Broken & Fixed UV map example:
To edit UV maps in blender, select your object to modify and enter the UV Editing workspace:
The current UV map should display on the left:
In the right window in Edit Mode, select all vertices (“a” key in blender), and hit “U” for the UV mapping dialog. Select “Smart UV Project”, and hit OK:
This should update the UV mapping to an even spread map:
Save and test. Your meshes should have even material mapping now.
Some objects are better with different UV projection options. For example, a tire can be cleanly mapped by using the orthographic view and selecting Sphere Projection. Try some of these options to see what fits best for your use case.