Search Unity

EasyRoads3D v3 - the upcoming new road system

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

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    I meant the most right tab of the toolbar in the Inspector, the tab with the I (Info) icon. The "Help" button links to the online manual.

    Thanks,
    Raoul
     
    Ben_Iyan likes this.
  2. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    177
    You thought of everything! Awesome, and thanks.
     
    raoul likes this.
  3. DenisFernandes

    DenisFernandes

    Joined:
    Apr 16, 2014
    Posts:
    12
    Unity 2017.4.3 i get this error when i click "Manage Project side objects"

    NullReferenceException: Object reference not set to an instance of an object
    ERSideObjectImporter.SetSideObjects (EasyRoads3Dv3.ERModularBase bscr, System.String path)
    EasyRoads3Dv3Editor.ERSideObjectsManager.OnGUI (EasyRoads3Dv3.ERModularBase scr, EasyRoads3Dv3Editor.ODCDOODOQO eScr)
    EasyRoads3Dv3Editor.ODCDOODOQO.OnInspectorGUI ()
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1253)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  4. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    894
    I see, it looks like it is throwing; although I don't get exactly why is it missing some elements. I am used to code that does not mark warnings as errors :) In Unity I get a wall of red messages when using Easyroads, which is why I did get concerned.

    Fundamentally what I am doing is to load a OSM file and trying to adapt it to the terrain. When I import it with lat and lon at 0, the whole terrain (2048x2048) is covered by the road network, and there is no way to scale it. If I set different coordinates. like 250-350 for lat and lon, the road network does not appear anywhere, and I just see the gizmo.

    Also, when the OSM file is used, the roads are disconnected, and even dragging the connection points has no effect, fundamentally I am not able to connect roads together, no matter what. I have the latest package, downloaded today (the text say beta1, not sure if it is still the old package or not), did import it multiple times and the result is always the same.

    This is the video that show my issues:

    1) if a road is selected and I try to attach a crossing, nothing happen; I can only create crossings with shift-click, and then try to connect them.
    2) I was successful only once in connecting the crossing with the existing road.
    3) connections issue when trying to connect roads and crossroads
    4) as you can see from the video, selecting a point on the road network at times show the point selected in green, so I can move it around with the gizmo, while other times show a yellow square, that allow me to move the road. I don't get how do you switch between the 2 modes, and at times, the road is not even selectable, unless I click on something else and then back to the road network object in the scene.

    https://www.dropbox.com/s/g0p8ndv5bp08kor/Screen Recording (5-13-2018 10-40-08 PM).wmv?dl=0
     
    Last edited: May 14, 2018
  5. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Yes, I see what you mean, both "Manage Project Side Objects" and "Export Side Objects" read data from the side object log file. The path to this file is indeed hard coded which explains the error after moving the EasyRoads3D folders.

    Thank you for reporting that! A new v3.1 beta update will be available later today. This will be fixed.

    Thanks,
    Raoul
     
    DenisFernandes likes this.
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi darshie1976,

    The alternative is too use Debug.LogWarning() and have the message appear in yellow. But this is more warning related, not necessarily causing issues. In this case the alert message does point to something that needs attention, the circular controller type being used on the last marker section. That is why was chosen for the red display.

    I belief lon lat values are always between -180 and +180. when using 250-350, all data in the osm will be outside the defined bounds so indeed no roads will be extracted.

    If you would do this with the v3.1 betas with only that last marker selected your steps will work. The connections tab will list the available prefabs matching the selected road. If no marker is selected all prefabs will be listed like in the current v3.02. This is what happens in your video. Shift + click in the scene will instantiate the crossing, afterwards you can attach the road.

    To achieve what you wanted to do, attach the crossing directly to the selected marker, in v3.02 move downwards in the Inspector of the selected road, you will see this same list of available connections. When you select one of these prefabs it will auto snap to the selected marker.

    So, this has changed in v3.1, this will all be done from the connections tab like in your video.

    Then you instantiated the crossing in the scene and tried to connect it to the road. Indeed, to attach a road to a connection, move the road marker to the connection center instead of moving the connection center to the road. The grey handle you were trying to drag, controls prefab alignment. When switched on, the prefab will always align exactly in the direction of the attached road.

    At 3.15 you want to attach a road with sidewalks to a crossing without sidewalks. That is not possible, crossing handles are there for displayed in red instead of green. This will be better optimized by auto switching on the sidewalks at that part of the crossing. For now this is a manual process. Select the crossing and press the two white outer handles, sidewalks will be added at that side and the road can be connected.

    Then you drag out a new road from that crossing, indeed no sidewalks are on that road. snapping this road without sidewalks to the road with sidewalks will not work either. Joining two roads with different shapes can be done through the I Connector.

    Is this visible in the video? I don't think I have seen this. Is this perhaps related to pressing the M key? The M key activates the yellow free move rectangle handle. The W key (standard Unity key command) switches it back to the default position handle.

    Regarding OSM import, in the current version roads are cut at cross points, this makes it easier to insert intersections and connect the roads. However, with the new v3.1 snapping system this is not necessary anymore. The data extraction in v3.1 does there fore no longer cut roads in pieces at cross points. There can indeed be problems when moving markers after importing data. That too should be resolved in the v3.1 betas.

    Hope this answers your questions.

    Thanks,
    Raoul
     
    Last edited: May 14, 2018
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    V3.1 Beta 5 is now available on our website

    The S key shortcut for selecting all road markers has changed to Shift + S

    Furthermore this update includes various small v3.1 related bug fixes and fixes for other recently reported issues.

    As it looks now this will be the last v3.1 beta update. Please let us know if there are still issues.

    And, as always, please backup first before importing the update.

    Thanks,
    Raoul
     
    sharkapps likes this.
  8. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    135
    Hi @raoul,

    I am trying to test the v3.1 beta with VegetationStudio, but I am not sure what I need to do to get it to work. Right now, VS just plants trees all over the road. The ERVegetationStudio script seems to be a ScriptableObject, and I am not sure if I need to plug it in somewhere.

    Best regards,
    Tony
     
  9. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi Tony,

    Can you try this:

    General Setting > Terrain Management > Vegetation Studio

    The Vegetation Studio section will be displayed when this package is available in the project. Here you can set global perimeter values, also make sure tho check “active”.

    General Settings > Road Types > Vegetation Studio

    Here you can set road type specific perimeter values. Make sure to press “Update Scene Instances” if you already have roads of that type in the scene.

    Does this work?

    Thanks,
    Raoul
     
  10. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    135
    I found this checkbox shortly after sending my question, but it didn't seem to change anything.

    I did not see these before -- this is really great, I was hoping there would be a way to configure this differently for each road.

    Here is some video:
     
  11. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi sharkapps,

    Vegetation Studio is active with the road network in Edit Mode, so it is not necessary to switch to Build mode to see the results. You probably want to hide the white surfaces in this case: General Settings > Scene Settings > Hide White Surfaces

    The video does not show the road type settings, I assume this is all setup and you did press “Update Scene Instances” for that road type?

    Other then that, what hasn't been tested is a multi terrain setup like in your video. Looking in the Inspector, the vegetation mask line component which is used here, doesn't seem to be VegetationSystem specific though. I will double check that with the publisher.

    Thanks,
    Raoul
     
  12. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    18
    Hi Raoul,

    I can access the road spline points in the editor using the techniques used in the ERWaypoints script. However, my preference would be to get the road spline points at runtime.

    I am currently doing a raycast to get the road under my player and referencing the ERModularRoad component. Then using the splinePoints property. However, because this is a list and lists aren't sorted, I am concerned that this may return spline points out of sequence. I am also concerned this is not using the API (the way you designed the system to be used).

    Can the API be used at runtime? If so, how do I get a reference to ERRoadNetwork?

    Thx.
     
  13. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi Zaddo,

    That indeed can be done at runtime using the scripting API.

    ERRoadNetwork roadNetwork = new ERRoadNetwork();

    This will reference the already existing road network in the scene created in the Unity editor.

    ERRoad road = roadNetwork.GetRoadByName("your road");
    Vector3[] splinePoints = road.GetSplinePointsCenter();

    Thanks,
    Raoul
     
    40detectives, twobob and Zaddo like this.
  14. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    135
    Sorry I did not include that information in the video. The road in this example was a Motorway 2x2 road type. I did not change any of the default Road Type settings or press "Update Scene Instances." The only place I have seen that button is in the Side Object Manager. Is there another one somewhere else?

    Best regards,
    Tony
     
  15. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi Tony,

    Was this road created after you activated Vegetation Studio like in the video?

    Further above, https://forum.unity.com/threads/eas...-new-road-system.229327/page-100#post-3497042, I mentioned the two steps.

    Could you try that?

    Thanks,
    Raoul
     
    twobob likes this.
  16. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    135
    Hi @raoul,

    I think the road was created before I activated Vegetation Studio. I just a minute ago found out that it works after I added some segments to the road and deleted them. So I think the mask line didn't get added when I checked the Vegetation Studio "Active" checkbox, but only when I added a segment to the road.

    Best regards,
    Tony
     
  17. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Yes, that is also what “Update Scene Instances” in my previous posts does. That way you don't have to manually update all roads in the scene.

    Glad to hear you got this working!

    Thanks,
    Raoul
     
  18. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    135
    Okay, thanks for the clarification. I probably didn't try clicking that before I added/removed segments. I will do that when I attempt to convert my main scene with the large road network. Thank you so much for the help.

    Best regards,
    Tony
     
    raoul likes this.
  19. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    18
    Thanks Raoul. Worked perfectly.

    I have written a simple steering manager that calculates the steering direction for a vehicle to travel down the middle of the road. This is based on your ERWaypoints script.

    This might save someone else a couple hours trying to setup an NPC, so I thought I would share.

    Edit: fixed bug in find FindClosestWayPoint
     

    Attached Files:

    Last edited: May 18, 2018
    twobob, hopeful and raoul like this.
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Thank you very much for sharing this!

    Raoul
     
  21. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,855
    @raoul - It would be great if these user contributions could be archived for general use, or re-written and added to the core.
     
    twobob and Zaddo like this.
  22. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi hopeful,

    I will do that. There are more scripts sent to us that we can share, like a simple AI solution.

    Thanks,
    Raoul
     
    hopeful likes this.
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi gozdagb,

    Is this related to the custom prefab system, crossroads based on your own imported meshes? In that case, the crossroad prefab itself can be setup in any way you like. Based on the materials, the final prefab will be a single mesh asset with submeshes. The attached roads will need a single material including both the road and pavements unless the entire shape (road and pavements) match existing roads with pavements based on built-in dynamic crossroads and pavements. If that shape matches, the road will snap to your custom prefab.

    If this is dynamic, built-in, crossroads related, then you can add this later. For both dynamic crossroads and attached roads, pavements use their own material. The only thing to take into account is the complexity of your road network. If this involves only one road type and pavement type, then all is good. Otherwise crossroad prefabs will have to be replaced because in v3.0 pavements are part of crossroad prefabs. A specific crossroad type can only have one pavement attached. This could be changed manually for each instance in the scene but that is not recommended. It is time consuming and inefficient. Keeping all instances the same will make it easier to apply global changes to all of them in a later stage.

    In v3.2 pavements will get an upgrade. More options and it will be a new section no longer directly associated with crossroads. Any pavement style can be assigned to any crossroad type / section with flexible positioning relative to the road edges. So, if you need this later, then this may already be available.

    Thanks,
    Raoul
     
  24. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    51
    Thank you
     
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,763
    A very simple piece of code demonstrating the following would be helpful in the docs
    The API examples are sorely lacking
    Code (CSharp):
    1.  if (roadNetwork == null)
    2.         {
    3. roadNetwork = GetComponentOfType  ????
    4.         }
    I read 5 pages back and there no code appears to be actively discussed on here, Any clues to where one might actively discuss such things?
     
  26. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hello twobob,

    roadNetwork = New ERRoadNetwork();

    This will either create a new road network object at runtime, or it will create a reference to an already existing road network created in the Unity editor.

    Something similar is mentioned a few post above, https://forum.unity.com/threads/eas...-new-road-system.229327/page-100#post-3497819

    Working hard on getting v3.1 out, this includes new scene view workflow options which completes the core functionaility of v3. A new video tutorial will be created which is also asked for. The runtime scripting API will also be worked out with more examples.

    Thanks,
    Raoul
     
    twobob likes this.
  27. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,763
    "or it will create a reference to an already existing road network created in the Unity editor."

    Can there "Be only one" then? Like a singleton pattern?

    Based on what you have said: The constructor then (for ERRoadNetwork) contain this code? I'll go look. Thanks. It is a little non-immediately apparent that that will happen.
     
    Last edited: May 19, 2018
  28. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,763
    @Zaddo "This might save someone else a couple hours trying to setup an NPC, so I thought I would share" Certainly did thanks
     
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Yes that is right. Initially it was possible to have multiple individual road network objects in the scene. It created confusion, roads between road networks not connecting etc. so at the moment only one road network object can exist in the scene.

    Thanks,
    Raoul
     
    twobob likes this.
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,763
    Makes total sense. Large note on API page would be helpful
     
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Yes, the API page in the manual does mention this but I will put extra attention to this in the tutorial / new API demo scene. Thank you very much for the feedback!

    Thank,
    Raoul
     
    twobob likes this.
  32. Alex-3D

    Alex-3D

    Joined:
    May 21, 2013
    Posts:
    78
    Hello Raoul,
    I got error while building:

    Error building Player: Shader error in 'EasyRoads3D/Terrain/ER Terrain Mesh Tesselation': maximum ps_5_0 sampler register index (16) exceeded at line 147 (on d3d11)

    Compiling Fragment program with POINT_COOKIE SHADOWS_CUBE
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

    Unity 2017.4.1f1
    Target Platform Windows x86
    EasyRoads 3.1.b2 (installed from package included in Asset Store's package v.3.0.2)

    Thank
    Alex
     
  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hello Alex,

    This is a shader part of the demo package. There are two more complex shaders in this package that can cause issues depending on your build target and settings:

    /Assets/EasyRoads3D/shaders/Misc/ER Terrain Mesh Tesselation
    /Assets/EasyRoads3D/shaders/Misc/ER Road Splat UV4

    Both shaders blend objects with the terrain. They can be optimized by using less terrain textures in the shader.

    Are you using these shaders? Otherwise you could simply remove them.

    Thanks,
    Raoul
     
  34. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    51
    Hello,
    what is the reason for such a broken indent?
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      49.1 KB
      Views:
      246
  35. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi gozdagb,

    That is a custom prefab based on your own mesh. It is hard to tell without seeing the mesh itself and the setup in the custom prefab editor.

    The mesh doesn't seem to be too complicated, first thoughts would be that the connections are perhaps not added in clockwise direction?

    Otherwise, would it be possible to send us the mesh so we can test it?

    Thanks,
    Raoul
     
  36. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    51
    The problem was i set it in wrong order

    Thanks again
     
    raoul and hopeful like this.
  37. Noa3

    Noa3

    Joined:
    May 29, 2012
    Posts:
    70
    hi i have the problem with vegetation studio, look picture.
    on my crossings i get grass and cant remove it in the most times with a mask. how i can fix the problem for the whole road network?
     

    Attached Files:

  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi Noa3,

    Which beta version do you use?

    The current beta 5 includes optimizations for Vegetation Studio on crossings.

    https://forum.unity.com/threads/eas...g-new-road-system.229327/page-97#post-3476441

    Or is that what you are already using?

    Thanks,
    Raoul
     
  39. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    177
    Is it possible to remove a section of road? I have a road going over a river but I want to use my own prefab now for the crossing. Thanks.
     
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi Ben,

    What exactly will this look like?

    Bridges can either be part of the road as side objects.

    Or a prefab can be used as a bridge in which case road A connects to this prefab at one end and road B connects to it on the other end.

    Or a custom bridge / road section shape can be created as one object based on your prefab shape. This same prefab can be used to connect Road A and B to one end of that prefab (used on both sides of the river) and the full bridge / road segment in between.

    Thanks,
    Raoul
     
  41. Noa3

    Noa3

    Joined:
    May 29, 2012
    Posts:
    70

    i use unity 2018.1.1.f1 and can only load from asset store v3.0.2 & v3.1 beta 2 (current) released Mar 29, 2018

    maybe need to wait for the realese :/
    but thx for the fast awnser!
     
  42. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    177
    Hi Raoul,

    I have a custom prefab, so I wanted to remove the section of road that crosses the river. If it isn't possible, I'll just adjust its height so that the road is hidden by the prefab. Thanks.

    Ben
     
  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539

    If you need this urgently, the latest betas are available on our website. You can register your asset store copy

    http://unityterraintools.com/download.php

    Thanks,
    Raoul
     
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    You can do that, but for smooth connections, snapping roads I would recommend to use one of the three options in my previous post.

    Thanks,
    Raoul
     
  45. JoJa15

    JoJa15

    Joined:
    Feb 11, 2017
    Posts:
    15
    Is there a way to edit or control the side skirts that provide an interface between the terrain mesh and the road mesh?

    I am not using a Unity terrain, I am using a mesh that was created in Maya for my terrain. I understand that EasyRoad3D cannot deform that terrain. I was hoping though that it could create a skirt on the sides of the road that would go down into the terrain mesh so that the road would not be floating. Does anyone know if it is possible to do that? Thanks in advance for any help provided!
    roads.png
     
    Last edited: May 22, 2018
  46. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    177
    Thanks, Raoul,

    No, it's not urgent.

    Ben
     
    raoul likes this.
  47. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    60
    It' is working in the crossings, but the street meshes is not working. Any idea how i can workaround this?

    upload_2018-5-21_22-29-20.png
     
    Last edited: May 22, 2018
  48. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Hi JoJa15,

    I just replied to an email with a very similar question, was that from you?

    This will be possible for built-in road types in v3.2. Do you need crossings? Because it is actually already possible through code, but the built-in crossings system cannot handle that yet.

    However all this is possible in the current version when using the custom prefab system for connections. You can import your own connection models with the desired road shape. A new road type can be derived from that. And roads pulled out from these connections will inherit that same shape anyway.

    Looking at the image there might be another solution. You could use side objects for this with a different material, the shape type of side object. One node at (0,0) this node will match the edge of the road. And another node, or more nodes, outwards. The last node should have a snap weight of 1, it will snap to the terrain. If crossings are placed on flat areas this may work as well. The bike track in the demo package was done this way.

    Thanks,
    Raoul
     
  49. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539

    Hi Weendie-Games,

    Is this a built-in crossing type?

    I still do not know what mesh data is required for the Uber shader? Is this vertex color related? Have you tried the vertex color option for markers in the marker section?

    Thanks,
    Raoul
     
  50. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    60
    Yes it is the built-in crossing type. After a research in the UBER docs i found:
    Where is this "Vertex color option for markers" ?

    Thank you