I'm porting a map from another game and I have it as a huge mesh with 1462 individual materials. I'm currently using the smallgrid map to test the model out. In \BeamNG.drive\0.30\levels\smallgrid I have shar.dae and then the 1462 material files which are stored as PNG images. What's the best way to map the materials to the mesh? I was looking at how n-labs did it and there's a .cs file that seems to map the material: Code: singleton Material( Floor ) { mapTo = "Floor"; diffuseMap[0] = "levels/NLabs/art/defaultnouvs.dds"; translucentBlendOp = "None"; materialTag0 = "TestMaterial"; }; From what I understand this maps each material to part of the model, I don't want to have to manually do this for over 1000 materials if I can avoid it. One way I was thinking of doing it would be baking the materials in blender so its a single file, though this may be a very complex material? I searched for possible solutions and found https://www.beamng.com/threads/map-with-3d-mesh.43987/ which links to https://www.beamng.com/threads/adding-static-mesh-racetrack-video-from-3dsmax.8185/ this post has a video that now appears to be private. This is what the map looks like in-game: Wondering what the best approach here is? Thank you.
The cs format for materials is old. You should use the actual materials.json format. The only way I can think of is do some scripting to generate the materials JSON file. Reading all the material names out of the dae and in a loop build the entries for the materials. The dae can be parsed because it’s just an xml format.
Thanks for your reply. Is there really no way to generate the materials.json automatically currently? I've been told the game will generate one automatically for vehicles. Would it be possible to create a vehicle using the map mesh and have the game create a materials.json for it? I could look at writing a program to parse the xml and then generate a materials.json file but it feels like its going to be a lot of work and I don't want to do it if there's some other way.
In Maps the json is generated automatically for the base color only if the material names and the basecolor texture file is defined in the dae file.
Watching through it appears when placing a model using the world editor, the game creates a main.materials.json file. This does not happen for me. I've started to take a look at the Nordschleife map to study how the materials are mapped to the model in the main.materials.json
If you import a .dae into a folder which already has a materials.json, it won't automatically create one for you, but if it doesn't, it will. It will still need populating with the relevant information, but it will create the blank materials for your object.