WIP Beta released Decal Road Exporter for Blender

Discussion in 'Utilities and programming' started by Average Person, Dec 15, 2022.

  1. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    587
    https://github.com/WireframeArt/BNGDecalRoadExport
    Screenshot_20221231_010949.png
    Here's another tool for exporting things from Blender into BeamNG. I'll do a more thorough explanation of this tool in the future, for now though here's the basics on how to use it:

    First install the addon to Blender. Now setup a copy of your map in Blender that's scaled correctly if you haven't already, this can just be a simple displaced plane using your maps heightmap but the main thing is to make sure it matches your maps scale in BeamNG.

    Next create a Object with a single edge, add an array modifier and make sure to enable merging add a curve modifier. I recommend looking up a tutorial for this if you're not sure what I'm talking about, likely if you've been making your map in Blender you should already have all the curves for your roads setup.

    Just use the curve for whichever road you want to add a decal to. Basically we want a long line of connected edges that line up where we want our decal road to be. Each Vert will act as a node so make sure you're happy with the density. We can always adjust this later and we don't need to apply the modifiers for the exporter to work.
    Now make sure to select the object and in File > Export select Decal Road Export. Here we'll find all the values we'd usually have with a decal road plus a few more specifically for exporting. Parent name will be the simgroup we want our decal roads to be placed in. This is just the name of the folder in the editor we want to place our decal road in. We can set it to MissionGroup if we don't want it in a folder.
    We'll also need to set a material in decal road options. We can get this by going to beamNG and setting up a decal road then selecting a material. Copy and paste that material name into the material field in the exporter and that should work.

    Flip road will flip the direction of the decal, if we had a road edge decal and the grass was on the wrong side we could enable this to flip it around.
    Split road will split the road up after a certain amount of nodes. This is handy on long decal roads but will take a bit of adjustment to get right, Nodes per road segment is how many nodes are allowed before it splits into a new decal road. If split road is enabled overlap ends will add an extra node that overlaps the previous road to allow for blending as well as helping to match the curve of both roads.
    To actually figure out the split value we'll probably need export a few times and turn it down until we stop seeing the decal road graphical glitch when a decal road is too long.

    Once we've configured all of our values we can finally navigate to where we want to export and export the road, I recommend just dropping this in a temporary folder. This will create a .json file formatted like the level files in the Main folder. What we'll do now is navigate to our levels folder and in main > MissionGroup open up the items.level.json and at the bottom we can paste in everything from the json file that we just made.
    Now when we open BeamNG and open our level we should have the decal road in the level hierarchy.
    If we would rather drop our decal road into a folder we can create on in the level editor, copy its name, and paste it into the parent field in the exporter.

    We can then export again and just paste the new values over the old ones, reload our level, and the changes will actually go through instead of crashing like what usually happens when we change something and reload.

    If you have any questions or issues drop them in the thread and I will see if I can help out. Note there are probably a few bugs here, one I'm aware of is that the first node in the road might be in the wrong positon and you'll likely need to manually move it, also its very important to setup the array like I've describe here or else the order of the nodes may be incorrect. I'll probably write a better guide at some point but for now hopefully this helps you figure out how to use the tool.
     
    #1 Average Person, Dec 15, 2022
    Last edited: Dec 31, 2022
    • Like Like x 6
  2. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    506
    Wow! Great work! I will test it this weekend and report you how it’s going. Thanks for that tool.
     
  3. Kolas

    Kolas
    Expand Collapse

    Joined:
    Jul 29, 2018
    Messages:
    177
    great job :) , it works and my issues/suggestions are:
    -the node order is not linear, using "sort elements" function on the blender somewhat helps but it is not a solution.
    -the exporter works for only one mesh/road, if it can export multiple lines from more than one mesh/road it could be a good improvement. Thanks again :)
     
  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