Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Easy Roads Mesh Gen FAQ by Kris Development

Discussion in 'Extensions & OnGUI' started by KrisDevelopment, May 5, 2017.

  1. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    Hello,
    My name is Hristo Ivanov and I'm writing this post as a general help/guide to using Easy Roads Mesh Gen v0.3.x and to refer to if needed. I get lots of frequently asked similar questions and I decided to make this thread to help new users get started with the tool.
    Before I continue any further let me mention that there's a Instructions.pdf file in the package which also explains some of the basics.
    There's also a Built-in tutorial which you can run when you first attach the MeshGen.js script to a new game object.
    With that out of the way let's begin with the first one:

    I don't understand how to add the sidewalk on the roads.
    One of the more important features of the tool is being able to add border meshes to better blend your road/river/etc. with the environment around it.
    This feature is toggled by the Border Mesh option.
    Once you switch Border Mesh on you'll see more options show-up such as Border Shape and Border UVs.
    Border Shape serves as a drawing board and controls the number of vertices and the shape of the borders.
    It reperesents a vertical cut of the right border (looking forward from the first NavPoint ) and you can right click to add new "Key" and then move that key to the desired position. If you have Update Mode set to Realtime you can see the changes being applied instantly.
    Border UVs option determines how the generated borders are unwrapped, or simply put, how the texture on them looks.

    What is Update Mode?
    When you're working with the tool you'll probably need to instantly visualise the changes you make, but once done you'd probably want to reduce the impact of the tool on the performance in the scene view.
    This is where Update Mode comes in.
    It controls how often the tool updates it's mesh and vertices.
    'Manual Update' has little to no impact on the performance since the tool is updated only when you hit 'Apply Changes'.
    'Vertices Only' visualises the position of the vertices but still requires to manually apply the changes.
    'Realtime' is constantly updating the generated Mesh which makes it easier to work with, but it's good to leave it off when you are done.
    EDIT (29.08.2017) As of version 0.5 there is an 'Automatic' Option which aims to optimize the scene performance by preventing non-selected roads from being updated. That ultimately leads to big performance boost and smoother user experience.

    Does Easy Roads Mesh Gen support terrain morphing?
    As of update v0.3.x the tool doesn't support terrain morphing, meaning it can't moddify the underlying terrain to fit the shape of the road.
    However, you can "Ground" the points with a given offset. Grounding snaps each point to the underlying collider which makes the road mesh follow roughly the curves of the terrain. Once grounded, the points might need some manual tweaking (for that make sure the Point Control option is set to "Full Manual").

    Converting from v0.2.x to v0.3.x
    When updating from an older version you may get complier errors.
    This could be due to a change in the script names which failed to update on import.
    What I recommend is deleting the scripts associated with the error and re-importing from the asset store.
    That way the scripts will be downloaded with their proper names.
    Most frequent error is:
    Assets/Add-ons/EasyRoadsMeshGen/MeshGen.js(126,37): BCE0005: Unknown identifier: 'NavPoint'.
    and you can either follow the aforementionend method (Delete NavPointGizmos.js and the Gizmos folder and re-importing)
    or renaming the NavPointGizmos script to NavPoint and moving it to the root folder - EasyRoadsMeshGen (However keep in mind that this method, although safer for any scene/prefab references, may be prone to errors).

    Converting to v2018 C#
    As of version v2018 the tool is completely ported to C#. The new C# scripts are put in a differently named folder “EasyRoadsMeshGen_CS” to avoid problems with the old package.

    There are two ways to convert from the old JavaScript tool to the C# version.

    The first way of converting is to completely remove the “EasyRoadsMeshGen” folder from your project, which will make all the objects that have previously had the MeshGen.JS script show up a “Missing” warning. After that you reimport the package from the Asset Store. Then you simply drag the ERMeshGen.CS script on top of the script slot of the message.


    The second way is to delete the old MeshGen.JS script on your GameObject and add the ERHelper.CS script to it alongside ERMeshGen.CS. Then you will need to setup the road’s width, subdivision, UV scale, etc. and after that go to the ERHelper.CS component and click “Fix Nav Points” which will assign all the existing child Nav Points to the navPoint array (as long as they haven’t been renamed manually). The downside of doing things this way is that you will have to manually set the road parameters, however unlike the first way, you won’t be forced update all of the Game Objects that use the old scripts, which allows you to gradually switch to the new package as you use it.

    Official video introduction to the tool



    For support:
    e-mail:
    hropenmail01@abv.bg
    Twitter: @KrisDevelopment
     
    Last edited: Jun 18, 2018
  2. alex445

    alex445

    Joined:
    May 21, 2017
    Posts:
    1
    Can I generate the road at runtime? In my app, user is allowed to touch the screen and draw a curve with finger, then a road is generated follow the curve. Can I get this function done by your plugin?
     
  3. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    Well, it's on the to-do list, but it's going to be a while before I get to implement run-time compatibility, which will also need a in-depth documentation of the different public functions.
    It's important to mention that the tool is currently being ported to C#.
    As of version 0.5.x I don't think you'll get what you need with the Easy Roads Mesh Gen package (real-time roads) unless you personally tweak the code to work in real time for your game (which I'd appreciate if you share your solution with the rest of the community).
     
  4. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    86
    Hi, Nice asset. Easy to use. I am having one issue with LOD. The road texture degrades very quickly with distance and I can't find a way to alter this.
    RoadGenLOD.JPG
     
  5. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    The problem is from the texture and here's how to fix it.
    There's an option in the texture importer called Aniso Level, turn that up above 1 until you're happy with the result (Like in the picture). Another option that might help in addition to that is the Filter Mode, set that to Trilinear.
    Cheers! :)
     

    Attached Files:

  6. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    86
    Awesome. That did the job. :)
     
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    934
    hi there, just checking this for the first time. I have a question about optimization. Does it automatically reduce vertices when not necessary?
    For instance, if I make a long road straight, no curves, will it generate thousands of triangles or realize that it's flat and just generate a small quantity and adjust the UV for the texture?
     
  8. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    The tool doesn't have an optimization algorithm as it doesn't really need one. If you make a road that is just a straight line, you'd generally use only 2-4 nav points, which makes for around 2-6 triangles top.
     
  9. unity_cwjdyNWLKcKTAg

    unity_cwjdyNWLKcKTAg

    Joined:
    Dec 18, 2017
    Posts:
    4
    Hi Hristo,

    The problem is as follows: we want to have crossings which can all be updated as the project goes along but all the 100s of previously placed ones need to update as well and dynamic crossing doesn't seem to do this. (?)

    I created a dynamic crossing and placed a few but it won't update across the scene after I edit the prefab by adding a model to it, does this only work for custom crossings?
    I figured it was b/c it's a dynamic crossing so I tried turning it into a custom one through the custom prefab editor window. But that also doesn't work (custom crossings only work with mesh input?)
    Do I create a dynamic intersection (T junction between 2 road types) and then export as a mesh and turn that into a custom one?

    Is that a limitation of dynamic crossings then?

    Which also leads me to a workflow question:

    If I decide I want my roads to be 6m wide and that works for dynamic crossings and associated roads but I have to make custom crossings to get proper updating prefabs and later it's decided the roads have to be 6.2m wide and you made all the custom crossings b/c dynamic won't update etc. so you'll have to pretty much decide all of that in advance?


    Thanks!

    -edit- In the tutorial video too, where you edit the railroad, you delete the original and then place a new one where the changes take effect, this is normal, there's no way to have it update on all previously placed instances?
     
    Last edited: Feb 7, 2018
  10. wagnerlee

    wagnerlee

    Joined:
    Oct 18, 2017
    Posts:
    45
    can someone point me to a tutorial as i bought this but the usage is very un clear i am getting a pink road also it is not seem to follow the terrain etc.
     
  11. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    Hi,
    On the topic of dynamic junctions, it has been in the development pipeline for a while now and I will be adding that in the next few updates, however for now you have to use only static meshes. Each mesh should have child objects with the SnapPoint script so the road recognizes it as an object to snap to.
    As for the road width/workflow problem, I hope that will be fixed with the dynamic junctions update in the future, but for now I will push an update this week that allows you to lock the width of the snapped points.
     
  12. Schefferbird

    Schefferbird

    Joined:
    Jun 19, 2018
    Posts:
    3
    Sorry Kris! Your introduction video is more like a selling video. Would love to see a tutorial video.
     
  13. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    Hello there,
    You are somewhat right about that. As making videos takes a lot of time from other important activities, such as developing new assets and improving old ones, I had to take out two birds with one stone - make a tutorial which at the same time also act as marketing material.
    If you describe what type of tutorial you want to see, I could definitely consider it, or at the very least help you solve a problem you're facing.
    PS: you can also write me an e-mail if you don't feel like your issue should be shared here: hropenmail01@abv.bg OR krisdevmail@gmail.com
     
    Last edited: Jul 17, 2018
  14. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    110
    Hello! Is there a way to close a loop once you've finished dragging the points close enough for the loop to be auto completed?

    P.S. Found a bug that happens when you turn Parent Points ON then OFF. It changes how the road looks and makes it irreversible.
     
  15. KrisDevelopment

    KrisDevelopment

    Joined:
    Jul 26, 2015
    Posts:
    10
    Yes, there is a way to close the loop by using the Snap Points (just snap the end point of the road to the starting one).
    About that parent points bug, you can choose not to save the scene and just reload it. It fixes it, however the parent points bug only happens if you have scaled the points. It's something I never really had time to fix as I didn't see it as a big enough issue. If, however, you need it fixed and presents an obstacle to your workflow I will take a deeper look into it.
     
  16. Emerald_Eel_Entertainment

    Emerald_Eel_Entertainment

    Joined:
    Mar 30, 2016
    Posts:
    110
    Thank you for replying. It's not that urgent for me fortunately though it's still worth checking, for future versions. :)