1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

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

Materials not saving

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by HighDef, Sep 6, 2018.

  1. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
    #1 HighDef, Sep 6, 2018
    Last edited: Sep 6, 2018
  2. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    That editor might not work too well, I never use it, but instead I edit materials.cs file manually.

    It could be that your change gets saved on some other level directory, but it is bit uncertain, way editor works I guess.

    Maybe take material entry from WCUSA and put it to materials.cs that is in folder where your object is, then edit mapTo to name of material on your object and name of the material to something unique to avoid conflicts, then it should work.

    Name of material like this:
    singleton Material(barriersegment)

    You can rename that to highdef_barriersegment_toban for example to keep it unique, it just shows in editor that name, not anywhere else.

    Then mapTo like mapTo = "barriersegment"; you need to open .dae of your object in Blender or something and look what is name of the material on that object and set that name to replace barriersegment, especially with vehicles it is good to have those material names also unique, I try usually to add fufsgfen to material names, just lessen chances of conflicts.

    Then paths and names of textures need to be set, but if you use WCUSA rumble strip, those should work unless they are without paths, then you need to add path /levels/west_coast_usa/pathoftexturefile to make it work, luckily textures don't need copying.

    Also materials.cs always in folder where .dae is, won't work other places.
     
  3. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
    Thanks for your reply.

    I added this to the materials.cs of the folder with the textures in.
    upload_2018-9-6_15-47-18.png

    It still doesn't load though.
     
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Your curb object, does it have UV mapping and also is material name in object really like that (unmapped_mat) in 3D editor?

    This is west coast curbs, afaik:
    singleton Material(trackedge)
    {
    mapTo = "trackedge";
    vertColor[0] = "1";
    groundType = "RUMBLE_STRIP";
    reflectivityMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_r.dds";
    diffuseMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_d.dds";
    specularMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_s.dds";
    normalMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_n.dds";
    specularPower[0] = "32";
    pixelSpecular[0] = "1";
    diffuseColor[0] = "1 1 1 1";
    useAnisotropic[0] = "1";
    castShadows = "1";
    translucent = "1";
    translucentBlendOp = "None";
    alphaTest = "1";
    alphaRef = "64";
    materialTag0 = "beamng"; materialTag1 = "vehicle";
    //detailMap[1] = "levels/west_coast_usa/art/shapes/roads/street_asphalt_detail_1x1.dds";
    cubemap = "global_cubemap_metalblurred";
    detailScale[0] = "4 0.5";
    annotation = "SOLID_LINE";
    };

    For your case, I would do it like
    singleton Material(highdef_curbs_toban)
    {
    mapTo = "unmapped_mat";
    vertColor[0] = "1";
    groundType = "RUMBLE_STRIP";
    reflectivityMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_r.dds";
    diffuseMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_d.dds";
    specularMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_s.dds";
    normalMap[0] = "levels/west_coast_usa/art/shapes/roads/trackedge_n.dds";
    specularPower[0] = "32";
    pixelSpecular[0] = "1";
    diffuseColor[0] = "1 1 1 1";
    useAnisotropic[0] = "1";
    castShadows = "1";
    translucent = "1";
    translucentBlendOp = "None";
    alphaTest = "1";
    alphaRef = "64";
    materialTag0 = "beamng"; materialTag1 = "vehicle";
    //detailMap[1] = "levels/west_coast_usa/art/shapes/roads/street_asphalt_detail_1x1.dds";
    cubemap = "global_cubemap_metalblurred";
    detailScale[0] = "4 0.5";
    annotation = "SOLID_LINE";
    };

    Also you need to have that materials.cs in folder where your .dae file of the curbs is located at, textures don't need to be same location, but it is .dae file that has to be same place as materials.cs

    If that changes anything, then you can change texture paths and names.

    However I would think that your object could use renaming of material in 3D editor, Blender or Max, so that name of material would be something that is less likely to cause problems, if there is 2nd object which also has umapped_mat as a material name set in 3D editor, then both get same texture.
     
    • Informative Informative x 1
  5. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
    I found this and ammended it to the proper textures and it still didn't work. All are in the 'exportparts' folder.
    Code:
    singleton material(PCRB_CURBSA_WET_mat)
    {
       mapTo = "PCRB_CURBSA_WET";
       colorMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa.dds";
       normalMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa_norm.dds";
    };
    
     
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Can you attach .dae that has your curb mesh?
     
    • Like Like x 1
  7. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
  8. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I'm not familiar with colorMap, but that is something I just probably don't know, I would think diffuseMap would be needed, but maybe colormap just replaces that instead of adding something? I know it is related to skin system, but don't know enough to know if it needs diffusemap as base.

    Don't know how that skinning would work with track objects, but presume it would work with colormap, then if you have texture on that path, something should certainly happen, unless there is something in material editor that overwrites your definition for that object.



    Then I had once issue when I exported from Blender, it refused to use texture, everything was at correct paths, names were correct, but no, it refused to work.

    I fixed that by renaming object and material, exporting, then renaming back to what I wanted them to be and exporting, surprise it started to work fine.

    So things I would try, would be to get basic solid material showing up:
    singleton material(PCRB_CURBSA_WET_mat)
    {
    mapTo = "PCRB_CURBSA_WET";
    diffuseColor[0] = "1 1 1 1";
    };

    That should show it as white, if even that does not work, then it would be some issue with either object exporting wrong, renaming thing should fix that, or then it could be conflicting material, some materials.cs might contain that exact mapTo and is loaded later so your definition is not applying.

    If solid color works fine, then I would do this:
    singleton material(PCRB_CURBSA_WET_mat)
    {
    mapTo = "PCRB_CURBSA_WET";
    diffuseColor[0] = "1 1 1 1";
    diffuseColor[0] = "trackedge_curbsa.dds";
    };

    As texture is in same folder with the .dae and materials.cs that should load it and should have least amount of variables so we can verify it is not the texture itself causing the issue.
     
  9. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
    If anyone can shed light on why these are not saving I would be most grateful.
     
    #9 HighDef, Sep 7, 2018
    Last edited: Sep 9, 2018
  10. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Ha, that was fun to hack: Also read bottom update first....
    upload_2018-9-7_19-46-1.png

    Nothing did work, but then I did save texture as png, converted to DDS with Nvidia DDS converter and saved with trackedge_curbsa2.dds name, then used this setup:
    singleton material(racetrack_with_curb)
    {
    mapTo = "curb_curbsa_wet-material";
    diffuseMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa2.dds";
    normalMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa_norm.dds";
    diffuseColor[0] = "1 1 1 1";

    };

    Also I did re-export mesh with only one UV map, renamed first of three materials to curb_curbsa_wet but probably only issue is that DDS file game can't read from some reason, so try that first, other changes are perhaps not needed.

    Update: Also about the name of material "curb_curbsa_wet-material"
    When looking inside the dae, that is what I saw on one line, seems works with that, but I had to do dds file work too until it started to work, so can be multiple issues there.

    However as I did copy original DDS file back, NOW it works, it did not work before, so I'm not quite sure what it really could be.

    Might also be this material name I changed singleton material(racetrack_with_curb) and singleton material(racetrackb_with_curb)

    Or maybe even some invisible character in materials.cs file.

    Or then it just needed new texture filename for short time to clear up some hiccup?


    Another update: I redid all, put original files back in and found out all that I need to do now is to move this piece of code to top of the materials.cs file:

    singleton material(PCRB_CURBSA_WET_mat)
    {
    mapTo = "PCRB_CURBSA_WET";
    colorMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa.dds";
    normalMap[0] = "levels/toban/art/shapes/exportparts/trackedge_curbsa_norm.dds";
    };

    It works:
    upload_2018-9-7_20-13-0.png

    I know one case of this, missing ; or something else wrong in one of the lines in materials.cs which makes rest of the file unreadable for the game.

    It can also be invisible character.

    So one by one, each of those definitions need to be copied to new file or then move this curbsa material definition to higher position one by one from bottom to up and see where it starts working to find out where the problem lies.

    It is interesting though that converting texture was which after it started to load fine, but not before, but knowing me I might of messed up something there...
     
    #10 fufsgfen, Sep 7, 2018
    Last edited: Sep 7, 2018
    • Like Like x 1
  11. HighDef

    HighDef
    Expand Collapse
    Game Design, QA and burnouts.
    BeamNG Team

    Joined:
    Aug 4, 2013
    Messages:
    682
    Thanks for your help man. I will mess with it today.
     
  12. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268
    Yeah, bump, but this is the exact issue I'm dealing with.

    I've been having issues with my map, and with a starting gate losing it's textures every time I play on a different map than load my map. When I clear the cache, the textures work normally, and will work if the next map I load is the same map, even through game closes. Nor can I find a thing about missing textures in the Console.

    Because I can't find any file that is mapped to the posts itself, I'm guessing this has something to do with a 3D software...
    screenshot_2019-02-25_22-37-35.jpg screenshot_2019-02-25_22-40-23.png
     
  13. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    I've noticed I keep losing textures AND they keep defaulting to original unedited versions. For some reason they are doubling up in my materials.cs files. Not sure why but I keep finding multiples in there, for instance:

    Code:
    singleton Material(wca_objects_construction)
    {
        mapTo = "wca_objects_construction";
        diffuseMap[0] = "levels/myLevel/texture.dds";
    and then either underneath it or later on in the file:

    Code:
    singleton Material(wca_objects_construction)
    {
        mapTo = "wca_objects_construction";
        diffuseMap[0] = "unmapped";
    So it reads both and then leaves it as unmapped. Just double check that you don't have multiples in there =)
     
    • Informative Informative x 1
  14. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268
    Code:
    singleton Material(douglas_rally_start_finish)
    {
       mapTo = "race_rally_start_finish";
       diffuseMap[0] = "race_rally_start_finish_d.dds";
       normalMap[0] = "race_rally_start_finish_n.dds";
       specularPower[0] = "1";
       pixelSpecular[0] = "1";
       diffuseColor[0] = "0.992157 0.992157 0.992157 1";
       specularStrength[0] = "0.588235";
       materialTag0 = "beamng";
       materialTag1 = "Race";
       materialTag1 = "rally";
    };
    Apparently, this is the only thing that's mapping to the object. (I changed the name like it said above, it was originally "race_rally_start_finish"

    The closest thing is "race_rally_start_finish_checkered" but that's still different.

    I also found out right now, that after I shut down my pc yesterday, without clearing Beam's cache. Opened it up, without clearing Beam's cache. And now the textures are fine. There has to be something missing in the code...

    screenshot_2019-02-26_11-54-04.jpg
     
  15. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    That could happen if your .cs file is invalid. The game can read it, until the part that contains the formatting issue. Anything past that won't be read.
    The console should be showing some message if that's the case.
     
    • Informative Informative x 1
  16. Danny Werewolf

    Danny Werewolf
    Expand Collapse

    Joined:
    Mar 31, 2017
    Messages:
    2,268
    I've been playing my map for a bit, though not devving or anything, and this is all I got when pressing CTRL+L. Everything else above is fine.
    screenshot_2019-02-26_13-43-44.png
    I don't remember seeing anything about unreadable textures, just normal stuff other mods do.
     
  17. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    But why are you pressing CTRL+L?
    That's to load the Main LUA.
    Does not do anything to textures/materials (no hotkey exists for that)
     
  18. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    Speaking of which, is there any way to do that? Does reloading the level differ from closing the game and reloading the level? I'm always doing both and always wondering, "what the heck is the proper way to do this anyway!?"
     
  19. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    For materials not really.
    Reloading the level may work for some changes, but the true proper way is restarting the game.


    For textures and models, there's the hotloading feature. Means if you modify a texture, it gets updated automatically as soon you get back in-game (only enabled for the Documents/BeamNG.drive folder)
     
  20. krallopian

    krallopian
    Expand Collapse
    NC114-85EKLS
    BeamNG Team

    Joined:
    Dec 5, 2013
    Messages:
    789
    Yeah I'm a MASSIVE fan of the hot-loading textures/models.
     
  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