1. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    Solutions and more information may already be available.

Question about main.materials.json

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by V1rginie, Dec 9, 2019.

  1. V1rginie

    V1rginie
    Expand Collapse

    Joined:
    Sep 26, 2019
    Messages:
    29
    After reading Nadeox1's post on texture file formats, I understand that main.materials.json is the new standard while materials.cs is its predecessor. However, there is still something I don't get.

    Putting a materials.cs file in the mods folder will add to the native textures.
    But, doing the same with a main.materials.json file seems to replace native textures. (which is not what I want)

    So, instead of overwriting, can a main.materials.json file in a mirror folder append?
     
  2. Moooooo

    Moooooo
    Expand Collapse

    Joined:
    Aug 16, 2013
    Messages:
    77
    Someone correct me if I'm wrong, but I think the format is as follows:

    [anything here].materials.json

    Doesn't matter what you put inside the brackets as long as it does not conflict with anything else in the same folder.
     
    • Like Like x 1
  3. Nadeox1

    Nadeox1
    Expand Collapse
    BeamNG.Support
    Staff Member

    Joined:
    Aug 5, 2012
    Messages:
    13,787
    That's correct.

    The new format allows to have multiple materials files named differently.
    Whereas with the old format, you can only one of these files per folder.
     
    • Informative Informative x 1
  4. V1rginie

    V1rginie
    Expand Collapse

    Joined:
    Sep 26, 2019
    Messages:
    29
    Thanks for this clarification. But this means I'm doing something else wrong.
    If I add my texture directly to the native main.materials.json, it works. But putting it in a separate *.materials.json file doesn't. Maybe showing the file will help pinpointing my mistake:

    levels/east_coast_usa/art_v2/terrains/test.materials.json
    Code:
    {
      "Forest2-6e67126e-4790-4cc0-b164-a63ef8188206" : {
        "internalName" : "Forest2",
        "class" : "TerrainMaterial",
        "persistentId" : "6e67126e-4790-4cc0-b164-a63ef8188206",
        "detailDistance" : 1000,
        "detailMap" : "levels/east_coast_usa/art_v2/terrains/green_d",
        "detailSize" : 20,
        "detailStrength" : 0.300000011920929,
        "diffuseMap" : "levels/east_coast_usa/art_v2/terrains/green_d",
        "diffuseSize" : 50,
        "macroDistance" : 50,
        "macroMap" : "levels/east_coast_usa/art_v2/terrains/green_d",
        "macroSize" : 5,
        "macroStrength" : 0.800000011920929,
        "normalMap" : "levels/east_coast_usa/art_v2/terrains/texture_dirt_01_n"
      },
    }
     
  5. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    650
    the internalName and the material name (index) are different
     
  6. V1rginie

    V1rginie
    Expand Collapse

    Joined:
    Sep 26, 2019
    Messages:
    29
    I tried this with no luck:
    Code:
    {
      "Forest2" : {
        "internalName" : "Forest2",
    ...
     
  7. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    650
    oups sorry that was not necessary to change.
    the json parser there is super strict there so you need to remove the comma before last line
     
    • Informative Informative x 1
  8. Nadeox1

    Nadeox1
    Expand Collapse
    BeamNG.Support
    Staff Member

    Joined:
    Aug 5, 2012
    Messages:
    13,787
    You can check if your Json is valid using sites like this:
    https://jsonlint.com/

    Editors like VSCode have this built-in too
     
    • Informative Informative x 1
  9. V1rginie

    V1rginie
    Expand Collapse

    Joined:
    Sep 26, 2019
    Messages:
    29
    Excellent! Thanks for your time :D
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice