How to create roadside guardrails on world editor?

Discussion in 'Content Creation' started by Ft5fTL, Jan 12, 2022.

  1. Ft5fTL

    Ft5fTL
    Expand Collapse

    Joined:
    Jan 12, 2022
    Messages:
    3
    Hello there, I'm trying to learn the world editor and i couldnt find anything about doing fences-walls-guardrails. All i found is that i can spawn them randomly with forrest brush. Any practical way to make it follow the road?
     
  2. Sithhy™

    Sithhy™
    Expand Collapse

    Joined:
    Apr 5, 2017
    Messages:
    3,343
    I know that you used Blender to do such a guardrail "snake" but I'm not exactly sure if something changed since the last time this method was still being actively used. I suppose that @B25Mitch could help you?
     
  3. Ft5fTL

    Ft5fTL
    Expand Collapse

    Joined:
    Jan 12, 2022
    Messages:
    3
    So basically i need to export the meshroads as collada and open it on blender or 3d studio max for making stuff like that, right?
     
    • Agree Agree x 1
  4. B25Mitch

    B25Mitch
    Expand Collapse
    Vehicle Designer
    BeamNG Team

    Joined:
    Aug 27, 2013
    Messages:
    274
    If this is one of your first map projects I'd recommend using textured meshroads for guardrails, like this high quality mod uses: https://www.beamng.com/threads/pjs-drift-rally-map-pbr.83524/

    A more advanced technique which requires a solid grasp of Blender is as follows:

    1.) Import the level's heightmap into Blender and apply it as a displacement texture to a subdivided plane, to get an accurate representation of the level terrain in Blender. Make sure the scale and positioning match your level's terrain scale and world position, and that the displacement strength is equal to the BeamNG terrain height. Also make sure to use linear color space for the displacement texture instead of sRGB.

    2.) In Blender, add Bezier curves using the terrain as a reference, and instance arrays of guardrail segments along them.

    3.) Select the instanced objects and export them to a forest file in the level/forest folder, using the Blender forest exporter plugin: https://github.com/BeamNG/blender-forest-exporter . Forest items are an efficient way to render many instanced identical objects such as guardrail segments. You define the name and mesh path of each forest item in level/art/forest/managedItemData.cs.
     
    • Like Like x 3
  5. Ft5fTL

    Ft5fTL
    Expand Collapse

    Joined:
    Jan 12, 2022
    Messages:
    3
    Thanks for your suggestions.
     
  6. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    332
    I have imported the heightmap to blender and it works as expected. But I can't match the position of the terrain in blender with the position in Beamng. If I add a cube in blender, export it as collada, import it to beam, set position to 0,0,0 it is at a different place and I don't get it right. It makes me crazy because I want to use the forest exporter.

    I have a 4096x, 4096Y, 250 height terrain with a scale of 1.2 (which results to 4915, 4915, 249 in Blender ) and a terrain position of -2048, -2048, 10 in Beamng. I go crazy :)

    Can sombody help here?
     
  7. el_ferrito

    el_ferrito
    Expand Collapse

    Joined:
    Sep 30, 2020
    Messages:
    414

    I have a similar issue, so can't help I'm afraid. I can do all the fancy arrays and whatnot in blender, and create what I want, but when I import it m, the position is always off. The height seems right (I think), but the position is always off by a bit (like a fair bit, not just a few metres).

    I haven't fixed it yet, but I bet I'm doing something daft.
     
  8. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    332
    Heureka! I got it somehow. I did a complete noob approach.
    - I placed a small rock asset at all four edges of the map to read out the coordinates easier (you can of course calculate the exact number: x location of your map + (x size * scale))
    - In Blender with the loaded terrain heightmap I check the position with the previous edge coordinates: select 3d cursor, go to the View tab and enter the coordinates of the edges in the 3D cursor location.
    - If your terrain is not exactly in between your cursor points, align it.
    - I changed the origin of my terrain on one of the edges to be able to enter a calculated number in the transform coordinates.
    How to change origin:
    - go to editmode
    - zoom to one edge and select it
    - Shift S -> cursor to selected
    - go to object mode
    - Object -> Set origin -> Origin to 3d cursor
    Then you change your Item location values in that way that your heightmap is exactly in between your four edge coordinates mentioned in the beginning.
    I did some heightmap testing in Blender and checked accuracy. Take a look at my thread and video:
    https://www.beamng.com/threads/how-...nd-scale-it-the-right-way.89186/#post-1522796
     
    • Like Like x 2
  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