Boycotting the Material Editor

Discussion in 'Content Creation' started by B25Mitch, Sep 12, 2014.

  1. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    EDIT: Pretty much everything below can be fixed by clearing the My Documents/BeamNG.drive/Cache folder.



    Hi everyone,

    Is there any way to assign materials to new objects without using the T3D material editor? I've got a rather nice JBeam, mesh and texture here, but the material editor just won't cooperate. Here's what happens:

    I export my model to Collada from Blender, having created two material slots called "Dumpster_main" and "Steel_rusty" (below, right).


    (imported from here)

    I've also created a material definition file inside the vehicle folder, which defines materials with corresponding names, to be mapped to the respective material slots (above, left).

    Now, I open up BeamNG and select the Dumpster 'vehicle':


    (imported from here)

    And straight away everything's gone completely wrong. As you can see above, the editor has autogenerated a material ("myMaterial 1") and assigned it to the Dumpster_main slot, even though I've already defined a material for that slot. This happens every time I load the vehicle and I'm sick of it.

    It's getting to the stage where I spend more time wrestling with the materials editor than actually creating content.
     
    #1 B25Mitch, Sep 12, 2014
    Last edited: Sep 16, 2014
  2. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    Notepad, that's what we use currently :\
     
  3. jammin2222

    jammin2222
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    386
    In the material editor where it put "myMaterial 1" overwrite it with "Dumpster_main" and hit enter. Then save it and delete the cashed.dts file for the model and reload the map.

    Thats how I fix it when it messes up for no reason. I don't know why it does that now and then, its annoying.
     
  4. Aboroath

    Aboroath
    Expand Collapse

    Joined:
    Aug 25, 2013
    Messages:
    3,804
    I'm tired of materials migrating and applying to other maps when they have nothing to do with the level I'm working on. Rockydirt seems to be the main culprit
    on this and that's after renaming and verifying paths, tags, instances etc. for hours. Nice that a skilled modder is bringing this up!
     
  5. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    So you don't use the material editor at all? That sounds great!

    I wish notepad would work for me. Let me demonstrate my problem:

    As a 'control group' in this little experiment, I load one of your meshes (barrels) into the editor and the textures appear on it just fine:


    (imported from here)

    Now I load my mesh in, with corresponding material slots and definitions in exactly the same format:


    (imported from here)

    And there's no texture. Any attempt to use the materials editor to fix this (including jammin2222's suggestion) results in an orange NO TEXTURE material when I reload the object, and, like I said, I'd really prefer to never touch the T3D Material Editor again.

    So what's gone wrong here?

    Object with material slot + materials.cs singleton mapped to material slot + valid image file as diffuse map = NO TEXTURE!?
     
  6. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    [0] is layer 0
    [1] is layer 1

    etc

    take care that you replicate them as well, otherwise its completely random what you are creating ;)
     
  7. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    The issue doesn't have to do with material layers - it's about the material itself disappearing. Example:

    I export to Collada from Blender with two materials already assigned - orange and blue. I load the vehicle in BeamNG.drive and everything looks as it should.


    (imported from here)

    Now, I close BeamNG.drive and restart it:


    (imported from here)

    The materials have disappeared!

    A couple questions:

    1.) When I export from Blender, Blender generates materials for the object (hence the orange and blue in the first image). Where is the data for these materials stored?
    2.) Why on earth should the materials be gone the second time I open up BeamNG.drive? This is just infuriating.
     
  8. ben8nz

    ben8nz
    Expand Collapse

    Joined:
    Nov 24, 2013
    Messages:
    22
    First answer .dae files save things like defuse color and UV maps. But when you open and close the game. The game makes a cached.dts file that will override the ".dae materials" and not find a material saved in the games files. Making it texture-less when you restart the game.. deleting the cached.dts file in the objects folder will fix your materials for the next time you open the game loading the .dae's colors again. But materials.cs file is needed for the game to load textures ever time.

    Secondly.. Its a annoying issue but hopefully my suggestions will fix it.
    Open your blend file and make sure you can see your image texture on your mesh with "Textured viewport shading" enabled in Edit mode. Blender can be funny with exporting sometimes.
    Also check these options at export.
    Blender_Export_Settings_5.JPG

    If it's still acting up I'll be glad to try a troubleshoot it on my computer also. Maybe we can both learn something from it.
     
  9. jammin2222

    jammin2222
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    386
    It must be a blender problem like ben8nz said. My original suggestion works 99% of the time for me when random materials vanish. Only difference with your problem is that its not working on initial setup where mine happens after editing another material causing another to randomly vanish.

    The worst case of this was after importing a bridge. I set up the normal/spec maps for all the bridge materials. I reloaded the map and every model in that folder was orange apart from the last two materials I edited on the bridge. I looked in the materials.cs and it had deleted every entry apart from the last two edits! I pooped my pants and face palmed for several days setting up the hundreds of materials again.

    I am not an expert with torque3d, but I know enough to know that it should not delete other entries in the materials.cs just by editing another unrelated material in the material editor. There is definitely a buggy aspect to materials in the editor, and the way it manages entries in the .cs

    I hope you figure out what the problem is and let us know how you fixed it. I need as much info as possible with regards to materials as all these bugs / unexpected behaviour makes it hard to know if its me being dumb or the editor at fault.

    Good luck!

    EDIT:

    I'm not using the experimental build, I have enough issues with the stable build and don't want to complicate things further. I would love to try it at some point because of groovy Mc Swaggington, but reading the issues with that build so far I think I will wait for bug buggington to bugger off.
     
    #9 jammin2222, Sep 13, 2014
    Last edited: Sep 13, 2014
  10. DrowsySam

    DrowsySam
    Expand Collapse

    Joined:
    Jul 30, 2013
    Messages:
    996
    Are you running experimental? If so, your updated files might be in Documents\BeamNG.drive\cache, it's kinda broken at the moment and will make duplicates of your materials.cs sometimes, try the stable build.
     
  11. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    Thanks everyone for helping out. I have been running the experimental build (the collision improvements are what prompted me to start this project), but I think I'll switch back over to the previous version while I set up the materials. I just checked Documents\BeamNG.drive\cache and found several of the missing materials there, so hopefully I'll have better luck in the pre-race build.
     
  12. Aboroath

    Aboroath
    Expand Collapse

    Joined:
    Aug 25, 2013
    Messages:
    3,804
    I advise folks to always remember when going to the experimental version it's easy to forget that work in progress maps will not migrate to the stable version if you
    opt back out of the experimental. I learned this last night when going back to the stable build while chasing down a material issue. Hours of work lost.
     
  13. WacKEDmaN

    WacKEDmaN
    Expand Collapse

    Joined:
    Aug 15, 2013
    Messages:
    58
    heres a tip...
    edit the DAE file with notepad after you save It from blender...remove any paths pointing to textures, keeping the texture name...and then make sure your textures are in the same folder as the DAE file before you load it into beamNG..
    I found this saves a lot of trouble with the material editor either not finding the texture, or using textures from outside the game in another folder somewhere...

    but yeah after editing all the textures I have in a level, I find the material editor is doubling up on some of the definitions in the materials.cs..then when you change it in the editor, it will change the first one that shows in the cs, but the settings wont apply because they are over written by the definition down lower in the file.... so I have to go though manually and remove any duplicates (not fun when working with 500 odd textures!)


    id really like to see a standalone materials.cs editor/duplicate finder..
     
  14. pleclair

    pleclair
    Expand Collapse

    Joined:
    Jun 11, 2014
    Messages:
    24
    Sorry for necro'ing an old thread, but I see the issue is still very present, and I'm currently having a real headache getting my mats to work.

    Since I started playing with BeamNG editor, I have been getting this problem where when I edit stuff with the mat editor, upon quitting and reloading the game, I often ended up with orange textures here and there, to various extent. Is there a limit on the number of materials torque3d can handle? Cause I sure have a whole lot going on with this track. Lots of different mats.

    After inspecting the material.cs with notepad, I noticed some duplicates. It happens that some of my .dae have the same mat defined, and I thought it was because I imported everything using no prefix. So I started over, from a blank scene, re-imported my .dae, using prefixes, and this is where I am now.

    Yesterday, I edited most of my mats for the Nordschleife using the mat editor. All was fine, took a few screenshots and posted them. I had this fear when I quit the game, that I would be having some orange texture, but having the prefix made me feel safer. I was too tired to fire the game again and check it out, so I went to sleep.

    Woke up this morning, and my fear materialzed, I had a bunch of orange textures. After finding two threads which you mentioned this issue, I followed the advice to edit out my .dae and remove the path, leaving only the filenames. Now it's worse. I have edited the diffuse texture of a few materials in the editor.

    For example, my grass in Max is the checkered version of my grass texture, when I did the uvs. So I changed it in the editor, and never had issue changing diffuse, and keeping them. Unless they just went completely bogus and disappear and turn orange.

    Now, all my edits to diffuse textures are gone. In the material.cs, I see the diffuse should be the right one, yet in game, I end up with the one from the .dae.

    Another example, two of the concrete extensions to the curbs, the X and tiles models was orange too. I looked in the material.cs file, and the entries were completely missing, even tho I did them yesterday.

    I just re-edited those in the mat editor, saving my changes, quit the level, and reload it, and the diffuse is still present, but the normal and spec are lost.

    This is getting realllllllly annoying. It sort of remind me the days of 1x cd writers... when you failed more cds than you would write (at least with ide writers)... I had this same feeling each time I was trying to burn one.

    So, what is the trick in getting this to work properly?

    I forgot to mention I tried clearing the cache folder, and I searched on my whole drive for a cached.dts and didn't found one, so I guess things have changed since.

    EDIT: I'm going effing nuts with this. I partly fixed my problem by re-exporting my .dae with Max, so now the diffuse textures are now back to those edited in the material editor. Kinda odd that just removing the path from the .dae screw things up like this. Anyway.

    I have fixed some more mats, re-editing them for the X time, and every goddam time I quit the game and reload, something is amiss. From a completely blank and orange material, to normal/spec maps disappearing, or the alpha blending mode going away like in this example.

    goingnuts.jpg

    As you can see, highlighted in the material.cs file, the blending should be lerp. In the game, as you can see, it's none, and if you look at the road side, they aren't blended either.

    Before starting the game, I deleted the cache folder, as it fixed some material problem earlier today, and restored some orange material back to the edited values.

    My material.cs file is a little over 6000 lines...

    At the moment, I could finish up editing the materials and package a first version of the track, and been trying to do so all day yesterday, after I finished my forest on friday. Wasted two frigging days trying to get those mats to work... I'm about to go nuts.

    I worked with AC for long enough, and the editor works in a similar way to assign AC materials to the standard mats assigned by 3dsmax, and I never had this sort of issue, there is no duplication happening either. It seems to manage the file by itself.

    Another example of how things can screw up in an instant. Instead of exporting a particular .dae with export selected, I exported all the scene by mistake in one dae... the material.cs got to 11000+ lines... Chances I had notepad ++ opened up.. I was able to not reload the file, copy the file before the mistake in memory, reload the file, paste and save... but I was just lucky, otherwise... what the heck would have been able to do to clean this up?

    If you somehow detect an angry tone in my post, it's quite possible as I'm beyond pissed right now. Spent over 20 hours working on trying to get those mats working. Searching the forums, screwing my stuff a little more... going from an earlier material.cs, changing this, fixing that... blah blah blah.. it shouldn't be this complicated.

    If I'm doing something wrong, then a whole lot of people seems to be doing something wrong, cause the topic doesn't lack posts about it, but no real fix seems to be found in those abandoned threads like this one. I tend to find a lot of unanswered topic when I search for something here.
     
    #14 pleclair, Mar 8, 2015
    Last edited: Mar 8, 2015
  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