Ultimate tutorial on how to make realistic roads

Discussion in 'Content Creation' started by Barbent Servo GT, Mar 25, 2024.

  1. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Off-road connections, field and forest paths

    For paths where the surface can naturally be bumpy, there's a quick way to paint their topology directly into the landscape. First, I place a Decal Road to establish the path's course. Then, I use the Terrain Tool Average Height (old version). With Pressure at 100 and Softness at about 20-30, I slowly paint along the Decal Road multiple times. Inclines should be shaped in one go, pushing the terrain forward like dough. This method is much faster and more direct than the technique for creating smooth-surfaced roads shown above, and I find the result to be very effective.

    2024-05-2119_59_31-BeamNGdrive-0321016389-RELEASE-Direct3D11-background.jpg

    Enjoy your terrain crafting! :cool:
     
    #21 Barbent Servo GT, May 21, 2024
    Last edited: May 21, 2024
    • Like Like x 4
  2. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    403
    I never used this tool. I will try it.
     
  3. el_ferrito

    el_ferrito
    Expand Collapse

    Joined:
    Sep 30, 2020
    Messages:
    432
    I have a work-through for roads, that I find works well, but is hard to explain (at least for me).

    The basic concept is that I smooth the roads using the Heightmap with photo-editing software rather than in the World Editor.

    More detailed:
    I usually make real places, so I have a map of the roads, this makes it easy, but if it is not a real place, you can just paint a specific terrain type where you want roads (and only where you want roads) straight on to the bumpy/sloped floor.

    Then do an export of the terrain using the terrain export tool. This exports a heightmap, plus the alphas (black and white images) of each terrain type.

    Stick them both into GIMP (it is better for this method than photoshop for weird compression reasons).

    Use the alpha, to select all the white (where you painted the road terrain). Then with that area selection active, go to the heightmap and cut that section of the heightmap out.

    You then paste this back over the heightmap.

    In GIMP, it always pastes into a new layer, then you chose whether to anchor to the layer below or put it in as a new layer.

    It is really important* here that you don't do either, and before that step - i.e. immediately after you paste, you then go to the blur tools and smooth the road (as much as you want for the road type).

    I have found that applying 4 directions (i.e. up, down, left, right) of directional blur is best to give good roads.

    You then export the whole thing as a heightmap (not the alpha, just the old HM with the new smooth roads over the top), import it back into the level with the terrain import tool, and Bob's your uncle. Smooth roads across the whole map.

    *if you do either, when you apply the blur, it will use information from outside of the selection to work out the new values for each pixel, which messes up the whole point.


    Some additional notes:

    The above method will give smooth road, but with a jagged edge. i.e there is a cliff-like step up or down to the terrain outside of the road. There is another trick, where I use the selection grow function in GIMP to select the road plus a little more* (a few pixels) and then apply a slight smooth (gaussian blur). This helps a little, but have a play. It is easy enough with the smoothing tool.

    *I actually then cut the original road (minus a few pixels) out from the selection, so I can smooth only the edges, but that's too much for here.

    If you want bumpy roads, either don't smooth so much (although this will keep the slope on a mountain side for example), or smooth completely, then apply random noise and blurs to get the amount of bumps you want. I've had some decent success with this, where the overall road is flat compared to the hill, but the ground is bumpy.

    Final note on image type: BeamNG is a harsh mistress for image types. In GIMP, load the HM into GIMP, then change the mode to 16 bit (floating) grayscale. When exporting, use 16bit Gray with no compression (not gray+alpha, not RGB, not 8-bit, and no compression!). Otherwise you will be in step-city.

    I've no idea if anyone will try this, but it is a way to get a whole road network smashed out in a short time.

    See: https://www.beamng.com/threads/map-in-an-evening.91991/ for a bit more haphazard detail.



    Well... that escalated quickly. I only meant to write a short post.
     
    • Like Like x 3
  4. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Hey, that is impressive! Thank you for this great additional input. Using a Photoshop like software is a great way to extend the funktionality of the terrain tools in one blow but it is way more abstract so thanks for bringing some light into it :).
    It's certainly a matter of taste how much you want to distance yourself from the direct, detailed editing of the terrain. Personally, I prefer to stay as close as possible to the different scenes. Some WYSIWYG attempt :rolleyes:...
     
  5. el_ferrito

    el_ferrito
    Expand Collapse

    Joined:
    Sep 30, 2020
    Messages:
    432
    [QUOTE="It's certainly a matter of taste how much you want to distance yourself from the direct, detailed editing of the terrain. Personally, I prefer to stay as close as possible to the different scenes. Some WYSIWYG attempt :rolleyes:...[/QUOTE]

    For me it's more about having the tools for different jobs. I use this to lay the groundwork before going in for more detail in the world editor. It's useful for big maps with larger road networks where you'd never have time, especially large major roads (these are usually so much smoother that fine detail is less of an issue.

    With the right mix of blur and noise, you can get some really good results though, so often I don't find I need to do much more with the terrain tool, and that leaves me time to focus on other aspects (road markings/signs/etc).
     
    • Agree Agree x 2
  6. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Hi el_ferrito,
    Nice to have your aspects and techiques in addition. That is a good workflow, you show. On my big map project 'A Homerange', I even had and have no road network layout. Everything grows at the same time. Roads become longer when I have a plan of what will arise behind the next corner. It is for sure way more efficient to set a road layout fixed at the begining of the project but I simply couldn't imagine 70 km². So I decided to do most things a bit like a virus would spread :) or let the design flood through the landscape. This gives me more freedom. I even wanted to make mountains or canyons only then when a first pioneer trail meanders into that region, free to alter even that trail at any time.
    Making bridges and tunnels seamlessly in curved and banked roads is another thing to have in mind. In this case I have the Mesh-Roads as a fixed road topology specification where this should not be altered by any external task. The Mesh-Roads then come into Blender, are cutted and transformed into a beautiful exactly tailored bridge. So there are pros and cons for everything...

    Nice day & happy crafting :)
     
    #26 Barbent Servo GT, May 26, 2024
    Last edited: May 27, 2024
    • Like Like x 1
  7. el_ferrito

    el_ferrito
    Expand Collapse

    Joined:
    Sep 30, 2020
    Messages:
    432
    Yeah, that sounds like a relaxing approach to it to be fair. I'm definitely guilty of biting off more than I can chew with some map ideas. All good and well having 70 km² of road networks, but not much fun if there's no detail, and if you never finish it. As I say, for me, I largely use lidar data from real locations. In that instance you already have the road network, so it's a shortcut, but it sounds good fun the way your suggesting too.

    I never managed the mesh to blender back to beamng work through at all, everything always came back in slightly the wrong scale and location and I could never match it back up. If you fancy doing a tutorial on that I'd love it.. ;)
     
    #27 el_ferrito, May 26, 2024
    Last edited: May 27, 2024
    • Like Like x 1
  8. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    • Like Like x 1
  9. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Advanced road geometry Δ
    There are many other ways to build roads. Another scenario to mention here:

    You can guide geometries along paths with Blender. I have prepared a Blender file for you. If you are reasonably familiar with Blender, you might be able to start well with this file. It's important to be familiar with import/export too and to take the respective terrain into account. Of course, I can't explain all the Blender details here. It is a good idea to combine several techniques. Using the fps friendly one above for long overland roads and this one for complex city junctions that are even layered. Since they represent their own geometries, they are of course independent of the terrain and also suitable as bridges.

    2024-05-3003_57_03-.jpg

    Happy tinkering :cool:
     

    Attached Files:

    #29 Barbent Servo GT, May 30, 2024
    Last edited: May 30, 2024
    • Like Like x 1
  10. Murokmakto

    Murokmakto
    Expand Collapse

    Joined:
    Dec 24, 2023
    Messages:
    104
    I have seen this before but still I am not sure how to do it. Do you export the road or other object, guardrail, streetlights whatever, from Blender as an object (.dae file) to import to BeamNG or is there another way?
     
  11. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    DEA is the only exchange format I know . You can export all road elements as one object if you like. Level of detal is an advanced technique and I havent implemented it in the blend file (for now). It is not neccessary but to consider. Also the materials workflow is not described here. Maybe I will make a dedicated tutorial (some day).

    These are my default dae export settings in blender. They work for any combined object selection and write one dae file. Sometimes you have to play with the triangulate option if some faces are weird.

    Strip1.jpg
     
    • Like Like x 1
  12. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    I'm crafting another blender template for creating road objects. I will be placed in a own thread. It is a lot easier and more practical as the one above. Needs some time to be finished...
     
    #32 Barbent Servo GT, Jun 3, 2024
    Last edited: Jun 11, 2024 at 11:32 AM
    • Like Like x 2
  13. krayziepunk

    krayziepunk
    Expand Collapse

    Joined:
    Jun 21, 2015
    Messages:
    185
    I've been following this tutorial, but when it comes to the align to mesh tool, it never creates a smooth road. I always get and undulating pattern. See screenshot below. Every time I align the mesh then lower the 2 cm, I see this. I align with mesh again, it goes away, I lower the road and there it is again. No matter what I do the road is never flat.
    upload_2024-6-10_15-21-47.png
     
  14. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    I guess you did according to the tutorial set the Break Angle of the Mesh Road to zero and than used the Align With Mesh (up) first and the Align With Mesh (down) tools as two separate steps.
    So it could be your terrain resolution is problematic: On the one hand the x/y resolution of the height map is too low (check terrainname.terrain.json file) or on the other hand the z scaling of the height map object is too high (check scenetree).
    You can easily proof you technique by jumping into a vanilla map like Johnson Valley, start the World Editor with this map, place a MeshRoad and try everything. Simply don't save... If this works fine I think it can only be a resolution problem.
    Hope this helps :)
     
  15. krayziepunk

    krayziepunk
    Expand Collapse

    Joined:
    Jun 21, 2015
    Messages:
    185
    The height map I used was 4096x4096, but the terrain.json file says size is 1024. Could that be the problem? Do I adjust that in the file or in the game?
     
  16. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Yes. this could be the problem. Change it in the terrain.json file. In game you only can set the base texture size. Try to lift one terrain map pixel (like a small peak). It's base should be less than one meter in square size to have a smooth riding. Unfortunately I am not 100% shure of those settings.
    Edit: You can take a look into the Italy map files and copy&paste the settings since the map is 4096x4096, too.
     
    #36 Barbent Servo GT, Jun 11, 2024 at 2:49 AM
    Last edited: Jun 11, 2024 at 3:28 AM
    • Agree Agree x 1
  17. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    403
    • Agree Agree x 1
  18. krayziepunk

    krayziepunk
    Expand Collapse

    Joined:
    Jun 21, 2015
    Messages:
    185
    I will check that out.

    I tested on a couple different maps, vanilla and mods, and found that i could create a flat surface, even on a map where with the square size is set to 1, I can get a flat road.

    I tested on my map and even setting the square size as low as 0.50. It was still bumpy, just more smaller bumps.
     
  19. Barbent Servo GT

    Barbent Servo GT
    Expand Collapse

    Joined:
    Jun 4, 2023
    Messages:
    147
    Hey, could it be your terrain object is rotated :confused: This would cause a step like terrain forming because the terrain mesh will not be propperly edited in z-direction. You would encounter the paint circle cursor is (sometimes) not visible.
    OR: I could reproduce a very bumpy situation by increasing the max heigth of the terrain object of the automation map. Maybe that is the problem what I mentioned above with the too high z scale. Since the heigth map is a grayscale bitmap a single gray step would then lead to a big heigth difference,
    upload_2024-6-11_15-56-50.png
     
    #39 Barbent Servo GT, Jun 11, 2024 at 4:00 PM
    Last edited: Jun 11, 2024 at 4:14 PM
  20. krayziepunk

    krayziepunk
    Expand Collapse

    Joined:
    Jun 21, 2015
    Messages:
    185
    That might be be the issue. I made the maxHeight 8000 to get the height of the landscape for moutains where I wanted it. Is there anything I can do to get the proper height but keep the maxHeight lower? The highest point on the map is around 1100.
     
  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