Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

Discussion in 'Tools In Progress' started by raoul, Feb 19, 2014.

  1. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Hi raoul,

    I want to create roads using data supplied from map providers like Mapzen. Players will be setting the start and end point, so everything has to be runtime and not from the editor. I have no need for endless generation as for now.

    Do you have any public documentation on the API? I also have been eyeing other asset like Map-ity for the map provider integration, and reading the store description they seem to have Easyroads integration as well.
     
  2. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi ikazrima,

    An overview of the scripting API can be found here:

    http://unityterraintools.com/EasyRoads3D/v3/html/scriptingAPI.html

    Creating a simple road takes two lines:
    Code (csharp):
    1. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    2. ERRoad road = roadNetwork.CreateRoad("road name", markers); // markers is a Vector3 array
    I haven't been in touch for a while with the map-ity developer. I belief they had v2 integration.

    V3 also includes OSM import inside the Unity editor, it is not yet part of the API. This is pure road data import, no crossings auto generated yet.

    Thanks,
    Raoul
     
  3. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Thanks for the input raoul. I've easyroads in my wish list for years, just waiting for the time to pull the purchase trigger. ;)
     
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Good luck pulling the trigger ;)

    As mentioned on the previous page releasing v3.0 has priority at the moment. After that the API will be further expanded. If you see anything you like to see added here or if you have further questions, let me know!

    Thanks,
    Raoul
     
  5. CDUnityDev

    CDUnityDev

    Joined:
    Jan 31, 2017
    Posts:
    25
    Quick question: if you want to insert a control point in between two existing control points, how do you do that?
     
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Beta 8.6 is now also available on the asset store.

    For those who use their own crossing models in the system, one thing that has changed is that it is not necessary anymore to click "Add Connection" for the first connection after importing the mesh in the custom prefab editor. If you still click "Add Connection" because you are used to that, an error will be thrown since that first connection has not been set yet. Please be aware of that. This has been fixed for the next update (hopefully final v3.0 release). It will not be possible to add connections when te previous connection is still empty.

    Here is a repost of some screenshots of the new upcoming demo project because the previous page was so quickly full with posts :)

    rockOverlay_.jpg

    mountainWall.jpg

    iConnectorPrimaryDirt_.jpg

    transparencyShader_.jpg

    Thanks,
    Raoul
     
  8. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hi.

    In the previous version:

    - 5.000 mts long road
    - In a mark, I pressed the INSERT I CONNECT button
    - The road was in 2 parts and perfectly united.
    This way I could go shorter stretches and introduce side objects, change textures, etc. quick and with very low CPU.

    With the current version.

    The same process generates two roads NOT UNITED. Create strange areas that have nothing to do with the road. It also generates red dots which, I imagine, indicate road mistakes. Attached image.

    The previous version was doing very well because I could "split" the road according to different conditions. Now I can not use that tool.

    End of report.

    Thank you.

    CONFIRMED

    With version 8.5.1 works fine. Same project, same Unity version, same marked.

    FYI.
     

    Attached Files:

    Last edited: Sep 9, 2017
  9. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Barritico,

    Some things indeed have changed for the I Connector in 8.6.

    I just did a test using the I Connector directly on a single short road. All looked good. Then I tried a longer 5000m road. Indeed I got similar results as in your screenshot. This will be fixed.

    However this happens on the default settings. For now you could add a value of 1 or so for either the first or second road Connector Distance on the I Connector object. That fixed the issue on my end.

    Thank you for reporting this!

    Raoul

    [Edit] this is fixed, please send me a PM with your email address if you like to try this update.
     
    Last edited: Sep 9, 2017
    Barritico likes this.
  10. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Thanks to you for your fantastic job and support.
     
    raoul likes this.
  11. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    331
    Hello,
    I'm really a newbie with EasyRoads so maybe my question is quite stupid.
    I'd like my terrain to decrease gradually from the edge of the road. With the default settings it drop very heavily (I get about 1 meter of totally flat terrain and next it drop like a "step"), so I tried to change the "Min Indent" and "Min sorrounding" parameters, but
    1) I can't see any visual feedback in editor when I change these parameters (the white transparent areas around the road do not change).
    2) When I build the terrain the result is always the same, despite different "Min Indent" and "Min sorrounding" parameters.
    Maybe I'm missing something?
    Many thanks!
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi danielesuppo,

    The indent values represent the terrain area that will be leveled at the same height as the road,
    so that will indeed not have an effect.

    The Surrounding values is actually what you need. It seems you changed the Min Surrounding value in General Settings > Scene Settings. This will have an effect on new roads not on existing roads.

    But I think you want to keep these values the same as the default value, or do you want this Surrounding value always larger, are you roads always on a steep terrain?

    You can change these Indent and Surrounding values per marker.

    These white surfaces surrounding the roads should update after changing marker Indent / Surrounding values. You can change the settings for all markers by selecting one marker and then hit the S key, this will select all markers.

    Thanks,
    Raoul
     
  13. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    331
    Thank-you raoul for your kind reply.
    Indeed I was using the general settings, now everything work fine.
    Many thanks and congratulations for your great job!
     
    raoul likes this.
  14. vankor

    vankor

    Joined:
    Apr 6, 2017
    Posts:
    3
    can i change profile, width between the rails? i tried change width with slider "road width" but just can get odd plane mapped with rails texture :(
    http://prntscr.com/gklrmh
     
  15. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi vankor,

    The railroad track is an example of other ways how you can use the custom prefab system in v3.

    This custom prefab system is based on mesh models imported in the system.



    So in order to change the width, the source prefab (/Assets/EasyRoads3D models/RailRoad/Train Crossing Single Lane.obj) must be adapted. This could be done by scaling it up in the import settings and afterwards update the generated prefab in the Custom Editor Window. This is done by dragging the the prefab from /Assets/EasyRoads3D/Resources/custom prefabs/ in the same window as in the above video.

    Scaling up the mesh itself will also scale up the rails. If that is not what you want then the rail road crossing model can be adjusted in a modelling app. Simply increase the distance between the rails.

    Note that the railroad ties / sleepers also need to be scaled up.

    Regarding your screenshot, changing the width in the road settings will reset the road shape and indeed result in a "standard" flat road shape.

    Let me know if you need more help with this.

    Thanks,
    Raoul
     
    Last edited: Sep 13, 2017
  16. Artomiano

    Artomiano

    Joined:
    Dec 1, 2014
    Posts:
    200
    Hi raoul,

    is it possible, that you make a tutorial video that shows how to modify any aspect of a railroad, such as track, sleepers in type (mesh) and texture. Maybe a change from stone sleepers to wooden sleepers or modifying of the step width of the sleepers.

    And: Did you ever try to place a train on the railroad? Is there any subsystem that controls the train to drive correctly on a railroad sideobject? And what about switches? As you know, I plan to create much railroads... ;)
     
  17. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Tom,

    In my post above, related to the same :), I mentioned the basics of how the railroad example works.

    This custom prefab system is more intended for artists who make their own project specific models in the right scale/shape. But more examples will be part of the demo project.

    Additional to what I wrote in my post above, in V3.x the road type section in General Settings will be expanded with a "road" shape editor. This will make it possible to change shapes derived from custom meshes. For the rail road itself it will make it easier to make it wider etc. This shape editor is currently not available because first the dynamic crossing system must be expanded to support this as well. At the moment only the width can be changed which is not what you want for this type of tracks.

    The sleepers are generated using a Mesh Type of side object:

    Side Object Manager Tab > Misc Tab > Train Rail Concrete

    The Source Object points to the used model in the assets folder. You can change the texture on the used material, change the model or drop your own sleeper model in that slot.

    General Settings > Road Types > Train Rail (selected from the road types dropdown)

    You will see that the "Train Rail Concrete" side object is auto activated. Meaning, for new railroad instances this side object will be auto generated.

    So this is how the all this is put together. It is not that Railroads in general is built-in, it is simply created using the tools that v3 provides. Switches etc. can be added as separate connectors just like the current example. Whether this will be added depends on demand :). I have never looked into actual train physics. I know some people have done this, it looks cool. The idea is to put this sort of extras in the new demo project.

    Thanks,
    Raoul
     
  18. Noss1325

    Noss1325

    Joined:
    Mar 5, 2015
    Posts:
    12
    Hi,

    I have a question please :
    I have a car following an EasyRoad3D road, each frame I save distance and position given by GetPosition().
    What is the best way to find out if a world space point (position Vector3 of a point near the road) is AFTER or BEFORE my car ?

    We can also imagine the same problem here :
    In a racing game with 2 cars, how can we know which car has the first place on the road ?

    Finally, and more urgent, is there a way to get the pitch of the car ?

    Wow, can't wait for the last version.
    I am going to try to do the same with the new sided objects on those screenshot + the rock type wall.

    Thank you Raoul !
    Please keep up the nice work.
     
    Last edited: Sep 14, 2017
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Noss1325,

    The nearest point on the road is required. You could use the spline points data, ERRoad.GetSplinePointsCenter(), for this. Find the spline point that is nearest.

    GetPosition(float value, ref int currentElement): currentElement refers to the nearest splinepoint for the current car position. So if you compare currentElement with the above nearest spline point you know whether that point is before or after the car.

    Are you using GetPosition() on all cars? In that case you can simply compare currentElement or the passed distance. For other cars the nearest points needs to be calculated just like in the first question.

    Do you mean the slope of the road at the car positon? That can be calculated with the same spline points array using indexes currentElement and currentElement + 1. The slope can be calculated from these two Vector3's.

    Thank you :)
    Raoul
     
  20. Noss1325

    Noss1325

    Joined:
    Mar 5, 2015
    Posts:
    12
    Hi again Raoul,

    Thank you so much ! You just made my day !!

    Well, I think I've definitely missed the spline points data... And I've found more about it in the docs.

    About my question concerning pitch, well I was thinking about Roll, too. But now I also know how to get this thanks to : GetSplinePointsRightSide() and GetSplinePointsLeftSide(). I think those corresponds to the exact horizontal border limits of the road, so I can easily make my car navigate between those without any problem :)

    Perfect... perfect !!

    My best,
    Noss1325
     
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Noss1325,

    Glad to hear you got that working :)

    Indeed GetSplinePointsRightSide() and GetSplinePointsLeftSide() these are the points on the right and left side of the road (sidewalks included) and can be used to calculate the Roll on tilted road segments.

    Thanks,
    Raoul
     
  22. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I have a question regarding procedural generation at runtime. I am working procedurally generating landscapes at runtime but I'd like to add paths, roads (between towns) and rivers. This is possible with this asset? I feel that would add a great element to the landscapes.
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
  24. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    Thanks for the reply. Sounds like it might work. One question though, when you say "roads" this works the same for paths or rivers (i.e. no distinction)?
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    V3 doesn't have a dedicated river object. But it can be simulated using side objects. The provisional demo scene includes an example.

    If you create a river "road type" you can pass this road type for creating rivers through the scripting API. So the idea is the same. Rivers are more complex then roads though, they require a river surface and the riverbed must be shaped in the terrain. EasyRoads3D can do all that but the results do depend on your terrain settings and the terrain shape.

    The way this works in v3 does actually give more control over the riverbed shape then v2 but I will need to know more about what you want to do in order to say if it will work well instantly or not. On relatively flat gently rolling terrains I do not see any problems.

    Than ks,
    Raoul
     
  26. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I could limit the river to flatter terrains. That's no problem. The first issue for me would be roads and paths then I'd wrestle with the rivers.

    Thanks for your answers!
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Just to esxpand on that, it can work in more irregular hilly terrains as well but it is more tricky when doing this through the scripting API. It will require a safe setup of the river side objects.

    The river surface should be at a safe level regarding the river bank and the riverbed object which creates the shape in the terrain must cover an area large enough to accurately deal with your specific terrain settings (size and heightmap resolution). This will require some trial and error inside the editor itself.

    If this is not balanced there could be gaps between the river surface and the river bank or the river surface may break through the river bank on the other side.

    After the v3 release there are some optimizations planned that will be useful for river creation as well. I will add a note to test streams in more hilly areas as well.

    Thanks,
    Raoul
     
    StevenPicard likes this.
  28. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    Thanks for the additional information. I really appreciate it.
     
    raoul likes this.
  29. localhost

    localhost

    Joined:
    Dec 9, 2012
    Posts:
    43
    Hi!,

    how would i resize the connection prefab example "custom roundabout prefab", the roundabout is too small for my game.
     
  30. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi,

    I think I just answered your same question by email, this is what I wrote:

    The "custom roundabout prefab" is an example of how you can create customized road networks based on your own meshes.

    So this particular prefab is a mesh model, it is not that you can change for example road widths and keep other elements at the same scale. But you could scale the full mesh in the import settings and afterwards rebuild the source prefab in the custom prefab editor window.

    1) Select the source mesh in /Assets/EasyRoads3D models/custom roundabout 2
    2) General Settings > Crossing / Connection Prefabs > Custom Prefab Editor Window
    3) Drag /Assets/EasyRoads3D/custom prefabs/custom roundabout prefab on the stage of the editor window
    4) Click “Update Connection Prefab” in the left top section

    Note that in step 1 we selected the original .obj, not the prefab used as the source prefab because that is a unity prefab based on the custom roundabout 2.obj mesh.

    But the custom roundabout prefab is an older prefab. The above steps may not fully work. In that case you can always rebuild the full roundabout by dragging the also scaled source prefab (/Assets/EasyRoads3D models/custom roundabout prefab) on the stage and by reassigning the 3 connections.

    Let me know if you have further questions.

    Thanks,
    Raoul
     
  31. Sailing

    Sailing

    Joined:
    Sep 6, 2015
    Posts:
    12
    hi reoul,
    can easy roads generate road texture like playerunknown's battlegrounds does. on both side there are no sharp edge.
     
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Sailing,

    Do you mean something like the last image further above, the dirt path blended with the terrain or even the dirt path blended with the asphalt in the 3rd image? https://forum.unity.com/threads/easyroads3d-v3-the-upcoming-new-road-system.229327/page-74#post-3211925 .

    These materials use shaders part of the new upcoming demo project.

    Thanks,
    Raoul
     
  33. Sailing

    Sailing

    Joined:
    Sep 6, 2015
    Posts:
    12

    Attached Files:

  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Yes, the idea is the same. To achieve that you will need to use the new transparency shader, which does receive shadows, and add the desired alpha channel to your road texture. The shader will blend the road with the terrain based on the alpha channel just like how this works with the unity Standard shader transparency setup.

    Thanks,
    Raoul
     
    Last edited: Sep 19, 2017
  35. Autonoma

    Autonoma

    Joined:
    Jul 21, 2013
    Posts:
    92
    Raoul, is there a way to get a dirt road on a terrain, with directional tire marks, that doesn't use a mesh? In a previous post you mentioned an old experimental shader and I wasn't sure if you were saying that shader had a custom mesh to work on, or if that road was painted directly onto the terrain.

    Thanks!
     
  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Autonoma,

    That is unfortunately not possible. The shader you are referring at is used on a custom mesh. Examples of that will also be part of the new demo project. But the one used on this page is far more efficient.

    Thanks,
    Raoul
     
  37. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Is v3 actually going to be released? It's been in "beta" for ... I don't know long ... a year+?

    EDIT: Didn't mean for that to sound rude! A lot of us think your asset is great and I was just wondering where it stands in terms of coming out of beta and stabilizing from there, for planning purposes. Thanks!
     
    Last edited: Sep 19, 2017
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    Ha! It's been in development since November of 2013, IIRC. But the beta has been mostly usable for the last two years, I think. And to be honest, more development will come after it exits beta. So it's kind of an artificial marker.
     
    raoul and Claytonious like this.
  39. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Are crossings fundamentally broken in the v3 beta package? If not, then I must not know how they're supposed to work. Reading the manual, it says that while I have the last node in my road selected (green), I should simply click on a crossing object in the inspector and one should appear automatically at that point on the road, right? Here is a video of me trying to do that, and clicking it does nothing:



    You can see in the video that when it did nothing, I then shift-clicked on the green node and finally a crossing was created there, but oriented strangely like it knew nothing about the road. Then when I try to drag from the yellow control point - which is supposed to attach and start a new road from the connection, right? - it just rotates the crossing.

    What am I doing wrong here? I have *never* been able to get crossings to work, and this is the 3rd version of Unity I've tried it. This time, it's 2017.2. But I've tried in a couple of 5.6 patch releases as well as 5.5 and it is always this way.

    Is this just because they don't work in v3, or am I doing it wrong?
     
  40. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    username checks out. ;-)
     
  41. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    So then I tried creating one manually on its own and connecting it to the road afterward... but it won't snap to the road's node...

     
  42. IsDon

    IsDon

    Joined:
    Feb 27, 2015
    Posts:
    35
    Hi,

    Just purchased Pro for proving some concepts in Unity at work. I was trying to use the v3 beta asset, but when I work on my extremely large multi-terrain model, I find the road network points (shift-click) are almost always inserted at a max distance from the camera in scene view, so end up quite a ways above the terrain, and not even aligned correctly for shifting down. I think the previous road (lower right) in this session I created zoomed way in to the terrain in ISO top down view,but I'm wondering if this is a known issue, or if you can advise a way around it?

    (v2 doesn't like my multi-terrain at all)

    Cheers,
    Don
    have a great day
     

    Attached Files:

  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Claytonious,

    Crossings are definitely not fundamentally broken.

    In v3 there are two ways to add crossings:

    1) by adding them directly to the scene like in your video
    2) by selecting the first or last marker of a road, then scroll downwards in the Inspector, you will see which crossings match the selected road. You can pick one an it automatically aligns with and snaps to the road.

    In your video you are combining the two. That won't work well. If you add the crossing from the 3rd tab in the Inspector, then it is better to place it away from the road marker, rotate it if necessary, select the marker and drag it towards the connection handle you want to attach it. The marker will snap to the connection handle.

    Yes, it has been in beta for a long time. But please check the feature list at the beginning and now, many new features. Some people have written that it should be called v4.

    It will be released, keep an eye on this page :) Some screenshots of the last step were posted recently here further above.

    Apart from having difficulties with crossings, which I hope is clarified now, what would you like to see in the final release that isn't possible at the moment?

    Thanks,
    Raoul
     
    Last edited: Sep 20, 2017
    hopeful likes this.
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735

    Here you are trying to snap markers of roads. It is something on the list to add (for matching road types) but it doesn't work like that at the moment.

    If you want to connect two roads of the same type, please select the markers that should connect by holding the Shift key. In the Inspector you will see a button "Join Selected Roads", or you can do Shift + J. The two roads will merge in one road object.

    However, one road has sidewalks and the other road not. Is that what you want to do or should they both have sidewalks / no sidewalks? In the current situation the roads do not match, so you cannot simply connect them. One way of doing this is by inserting an I Connector ("Insert I Connector" button further below in the marker section of the selected road) and leveling the sidewalk with the ground by changing the road shape for that marker (let me know if you want more info on this specific part).

    http://unityterraintools.com/EasyRoads3D/v3/html/scene.html#IConnector

    Thanks,
    Raoul
     
    Last edited: Sep 20, 2017
    hopeful likes this.
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Don,

    At approximately what distance are you are adding markers? I just checked the currently used raycast distance is 5000 units. Could that indeed be the problem?

    This is a distance where usually it is hard to add markers accurately, often you end up having to zoom in and reposition the markers. But this max raycast distance can be changed or even made flexible in General Settings > Scene Settings, just like the max marker display distance.

    Thanks,
    Raoul
     
    IsDon likes this.
  46. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    I'm so sorry, but I must still be misunderstanding how to create a crossing. Following your tip above, I tried it again, but no crossing appears:

     
  47. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    And only one connector button seems to be available. I understand this is based on the type of road I've chosen, but I've chosen "Default Road".
     
  48. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Claytonious,

    Following the exact steps in your video, I see what you mean. There is a glitch here which seems related to newly created roads. In the development project I had the same result as in your video, but for the 8.6 beta package the available crossings did instantly display. I will have a look at this.

    In any case, if no crossings are displayed after creating a new road, please deselect > reselect the start or end marker. The crossing options will be visible.

    I see the two dynamic crossings and all the custom connection prefabs for the "Default Road". When a road is not yet connected to a crossing, all connection options will be displayed except Roundabouts. It is better to add roundabouts directly to the scene because the alignment works differently.

    Thanks,
    Raoul
     
  49. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Thanks, Raoul, I will give that a try.

    OK - are you also seeing them in my video? Am I looking in the right place? Or do you mean you see them on your local build but not in my video?
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    I mentioned that at first I had the same result as in your video. No crossings are displayed.

    But in both other occasions (when I tried this in the 8.6 beta or when doing deselect / reselect marker) I do see all available crossings, not only one connector like you wrote in the last post. Did you try the marker deselect > reselect meanwhile, does it indeed show all connectors?

    Thanks,
    Raoul