Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Ah yes, you mentioned that! Indeed adding "raceway" in the custom field does extract the track itself as well.

    Thanks,
    Raoul
     
  2. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I'll see if I can find exact repo steps. The road type was created in 3.2, 3.1 wasn't installed at all.
     
    raoul likes this.
  3. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    I want to add line markings / stop markings to a road every X distance. I've been messing with the decals in the Road Type settings (Start/End Decals) but probably is not what I want as it seems to work in the first and last marker of the road only.
    Start-End Decals UI.png
    Also I'm not sure what steps should someone do to use them since here only the Start End decal is shown.
     
    Last edited: May 30, 2019
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi 40detectives,

    In v3.1 only Start End decals are supported that is why the tutorial link only shows examples for this decal type.

    The options in the image in your post are from the v3.2 beta and it actually includes decal options that are not available yet in the current v3.2 beta. These decal options are for very specific situations.

    The Mesh Object type of side object can be used to add markings every X distance. The important settings are "Path Normal" for the Alignment and "Distance Between Objects". Have you tried that?

    Thanks,
    Raoul
     
  5. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Thanks raoul!
    To be honest I'm using v3.1.7.1 (installed from the asset store)
    Anyway, in the following video the method you told me is used around 2:00 right?


    Also when you want to put just one decal on a specific point you do like in 3:25 right?:

    I'm really curious how these prefabs you drop in the scene at 3:25 are fabricated, it seems like the BUS letters are a mesh on its own plus a white texture, am I right?
     
  6. lynx89_

    lynx89_

    Joined:
    Mar 1, 2018
    Posts:
    27
    Hi @raoul , I use your asset a lot and it works great except for one single issue that happens quite often.
    This picture speaks for itself:

    How can i get rid of those terrain glitches, other than increasing the whole road height after building it?
    Thanks
     
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Yes, these decal options are indeed also visible in v3.1.7.1 but apart from the Start / End option, they are v3.2 decal options. The Decal Type dropdown should be hidden in v3.1.x

    The video is from the HD Roads package, this package uses the Start End decal options a lot.

    The side object at 2.00 are line markings along the full road. These line markings are made using the Procedural side object type. I thought you wanted more line marking instances every X distance? That is why I suggested the mesh type of Side Object which will spawn objects along a path rather then creating a procedural shape along the full road like at 2.00 in the video.

    Starting at 3.25, these are additional assets in the HD Roads package, they are placed on the roads without EasyRoads3D itself directly involved. Built-in options for this will be added in v3.3 when the side objects system will get an upgrade.

    These are indeed simple meshes with a material using the ER Road Transparency decal shader.

    Thanks,
    Raoul
     
    Last edited: May 30, 2019
    40detectives likes this.
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi paoloarnolfo00,

    Glad to hear the tool works great for you.

    The situation in your screenshot is covered on the Troubleshooting pages in the docs, bends with considerable height differences.

    The Unity terrain object is grid based, it is impossible to add detail points. In order to flatten the terrain exactly according the road shape there must be enough terrain points available in that area. Bends with height differences result in a curvy road shape especially exactly at the problem points in your image.

    If you turn on one of the Wireframe shading modes the terrain points in that area will be visible. There are not enough terrain points to handle that road shape. Either the bend must be less steep or the terrain heightmap scale should be smaller by increasing the heightmap resolution.

    Another way to deal with this to some extend is using roads with thickness. In v3.1 this can be done by importing custom connection prefabs with this road shape, attached roads will inherit that shape. In v3.2 custom roads shapes will be built-in.

    Hope this helps

    Thanks,
    Raoul
     
    40detectives and lynx89_ like this.
  9. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    You're right that makes sense. :)
    Thanks!!
     
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Apart of the "Distance Between Objects" settings the setup is very similar. Just set the "Side Object Type" dropdown in the side objects General Settings to "Mesh Object".

    Thanks,
    Raoul
     
  11. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Coming back to this, I've been trying the LWRP with EasyRoads, I've also purchased the HD Roads Add-on but I have some issues.
    For this test I've:
    1. Created a new project in 2019.1.4.
    2. Imported ER3D 3.1.7.1.
    3. Imported HD Roads Add-on
    4. Imported LWRP specific package included in HD Roads add-on.
    And I've been unable to make work any material using the 'built-in' ER3D shaders and to some extent the NatureManufacture shaders too, I'll show you an example with the Transparency shader:

    01-Material comparision.png 02-how_it_look_like_in_2018.4.1_with_Standard_RP.png

    With the NatureManufacture shaders when opening the demo scene I get:
    04-HDRoads_Demo_ShaderError_Console.png
    There were more errors/warnings while importing but I accidentally cleared the console, these ones pop up again when re-opening the demo scene.
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi 40detectives,

    I belief in the LWRP package one of the provided Unity transparency shaders is used, not the EasyRoads3D ER Road Transparency shader. I will double check the LWRP package tomorrow.

    Important, which version of LWRP are you using?

    Thanks,
    Raoul
     
  13. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    5.7.2 the default at the moment, though there is 5.16.1 available to update.
     
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Thank you! I sent a package with updated shaders for 5.7.2.

    The Asset store version will soon be updated as well.

    Raoul
     
  15. Bomshi

    Bomshi

    Joined:
    Jan 17, 2014
    Posts:
    14

    Hi raoul,

    I can give you new info:
    The Problem with the shader is maybe a bug or something. The build finishes - it was my fault..
    But the first time 1 build it, it gives me the error. But it does not stop the process itself. Everything is fine, but thanks !
    So everything is fine!
     
  16. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Bomshi,

    Ok, so no build problems anymore? That is good to hear!

    Thanks,
    Raoul
     
  17. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    I'm planning to do an endless straight road from a pool of terrains each one with one road segment. In that road it should be traffic lights every certain distance. The traffic lights would be side objects, and I want to be able to get a reference to the next sideobject node in that road to control their light when the vehicle reaches the current traffic light. So both traffic lights green light at the same time etc.

    1. If I wanted to know if a road marker has a side object active can I get that via script?
    2. Can I get a array/list with all of the side objects of a kind (like the ones in the sideobject manager) active in a road?
      Since
      ERRoad.GetMarkerPositions()
      returns a vector3 [] and I can't find a method that returns
      ERMarker
      or
      ERSOMarker
      , I'm not sure if 1) and 2) are even possible.
    3. Right now I have a long, completely straight road with a few markers every 150m. If you only want to put a sideobject at each marker how would you do it? I've made a Mesh Type Side Object with the Distance Between Objects set to 150m.
    The problem with that is that I'm not sure there's an easy way to map the sideobject gameobjects nodes with the road markers in a script; I'm starting to think they are not even related apart from the fact that a marker could have the sideobject active or not in its "surroundings".​
     
  18. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    @raoul We need more vegetation studio options possibly.
    Line Mask allows you to include vegetation now. Idk if thats even possible for you to add though.
    The problem i have right now is I want to spawn little grass, sticks and leaves on my dirt road.
    But I also don't want to mask the main vegetation off the road.
     
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi 40detectives,

    1. Side objects is not fully integrated in the scripting API at the moment. It is not possible to get the side object state for a selected marker. But I am not sure how this would work with traffic lights? Are these traffic lights on a straight road with no crossings involved?

    2. This too is not possible at the moment. Side objects will get an upgrade in v3.3. Adding this sort of options to the scripting API is also part of that. Meanwhile the way to build side objects through the scripting API is by activating them on the specific road types. They will automatically be generated when creating new roads.

    3. Does the setup with "Distance Between Objects" set to 150 not work? If you only want objects at exactly the marker positions. You could spawn them yourself using the mentioned ERRoad.GetMarkerPositions(). This process can be automated through callbacks after road changes.

    Indeed side objects and markers are not really related other then the side object marker settings provide a quick way to disable / enable side objects for specific sections.

    Thanks,
    Raoul
     
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Shadowing,

    I am not entirely up to date with the Vegetation Studio options. Do you mean that instead of removing vegetation through line masks, it is now also possible to actually add vegetation through line masks? We can look into that. I guess, if that is possible, two different line mask components are required in the situation you describe?

    One of the new features in the v3.3 side object upgrade mentioned in my post above is to add side objects to Vegetation Studio. This works similar to how currently trees etc that are spawned through the side object system can be added to the Unity terrain object vegetation system. It sounds like this will do what you are looking for.

    Thanks,
    Raoul
     
  21. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Thats correct @raoul
    You can add vegetation. not sure if its for the pro version only though.
    Here is the picture of the new component. It only requires one line mask still.

    When you say add side options though. That mean i can randomly spawn something on the road though? not just on the side.

     
  22. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Ok, so the same Line Mask component can be used. It seems additional steps will be required after pressing "Add vegetation type". So I guess you are asking for a scripted solution through EasyRoads3D instead of through the VS interface?

    Yes, with the side object integration I mentioned objects can be spawned anywhere. In Build Mode they will be added to the Vegetation Studio system.

    Thanks,
    Raoul
     
  23. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I think you can add it to the easy roads inspector.
    It uses a new thing called Vegetation type. There can only be 32.

    so you arn't actually selecting the actual vegetation type. You select vegetation rules defined for that type 1 through 32.
    I haven't actually used it yet. But this is my best understanding how that works.





    Edit: Also this isn't new to Vegetation Studio. Its been out for 6 months now actually. So should be working well i would think.
     
  24. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    22
    Hello again, Raoul! I wonder if there's a function just like a GetPosition(distance) that returns road's left or right lane vector3? Maybe like GetPositionAtOffset(distance, offset). Thanks in advance!
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Shadowing,

    I will have to look into that, it doesn't appear to be something that can be hard coded like for example BiomeType.Road for the Biome Mask Area component.

    Thanks,
    Raoul
     
  26. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi nmbileg,

    Is this v3.2 beta traffic ai related? In v3.2 ERRoad.GetLaneData(int laneIndex) can be used to get all lane points for a specific lane. Or are you more looking for an overloaded version where you can also pass the lane index to GetPosition() rather then the offset?

    Thanks,
    Raoul
     
  27. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    1. Yes, straight road with no crossings involved.
    2. Ok thanks, good to know they're on the road map.
    3. They do work, but maybe I have more control with the ERRoad.GetMarkerPositions() at the moment. I will try. Which API calls would let me "automate through callbacks after road changes" ?

    By the way, other doubt I have:
    4.Trying to do a very basic terrain streaming / pooling:
    Are there any inconveniences with changing parent of the road objects from a Road Network object to a terrain object? If I recall correctly you can't but made a quick example and seemed to not throw any errors. However I prefer to avoid any headaches later going down that road (no pun intended).

    If that is not possible can I change the road position at runtime?

    Thanks.
     
    Last edited: Jun 8, 2019
  28. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi 40detectives,

    Using ERRoad.GetMarkerPositions() the traffic lights can be positioned exactly at marker positions. But using 150 for "Distance Between Objects" should be accurate too if the markers are exactly positioned at every 150 units.

    Changing the parent of road objects to a terrain instead of keeping them inside the road network object hierarchy might not be safe unless the road network is finished. This could be automated and done before builds.

    Thanks,
    Raoul
     
  29. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi,

    I've just tried ER3D v3.1.7.1 with HDRP under Unity 2019.3.0a4 and got a crash right away when selecting the (pink) terrain object in the main scene.
    I know a 2019.3 Alpha is probably way beyond the scope of supported versions at the moment. What is the latest version of Unity you'd recommend?

    edit: fixed the version of ER3D
     
    Last edited: Jun 9, 2019
  30. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Marco,

    The current version is v3.1.7.1, I assume that is what you are using?

    In general for Unity Alpha versions, it is not a guarantee that EasyRoads3D will work well.

    But you mention the Unity terrain object. That is not EasyRoads3D related. I understand this may happen with the provided demo scene scene, but it is not very likely you will be using this terrain. Does the same happen in a scene with your own terrain?

    I will send you a package with the most up to date HDRP shaders. The package itself will be updated as well.

    Thanks,
    Raoul
     
    Last edited: Jun 9, 2019
    Marco-Sperling likes this.
  31. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Thanks raoul,
    by the way, would be ok to move the transfom.position of a terrain and the roads on top of it at runtime? They would be moved the same amount, so their contour still match.
     
  32. NotoMuteki

    NotoMuteki

    Joined:
    Feb 8, 2018
    Posts:
    42
    How can I set the dynamic prefab crossing to switch off terrain deformation?
    Looks like crossings deform terrain automatically when I press "Build Terrain(s)",
    and I couldn't find any option to switch off in ER Crossings.
     
  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi 40detectives,

    That should be possible unless perhaps if you are using runtime features? Are you experiencing issues with this?

    Thanks,
    Raoul
     
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi tex5564,

    Built-in crossings currently do not yet support side objects which could be used to add retatining walls etc. to crossings. So generally you would want the terrain to adapt to the crossings. An option to switch this off can be added.

    Thanks,
    Raoul
     
  35. pjchardt

    pjchardt

    Joined:
    Jul 16, 2015
    Posts:
    7
    I second this issue. Not sure what happened but at some point when I switched from one terrain to two terrains (or maybe because of an update?) my dynamic crossing prefabs started to deform terrain which has broken my scene. Do I need to wait for an update to turn off this behavior or is there a way to fix this? Not sure why I did not have this problem until recently.
     
  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi pjchardt,

    Currently the terrain will update to the shape of built-in dynamic crossings. This is for both a single and a multi terrain setup. There is no option yet to switch that off because in general it would mean the terrain will break through the crossing or the crossing will float further above the terrain.

    What exactly is the problem after changing to the two terrain setup?

    Thanks,
    Raoul
     
  37. pjchardt

    pjchardt

    Joined:
    Jul 16, 2015
    Posts:
    7
    The crossings only started causing issues recently, perhaps it is not related to my switching to two terrains. Either way, many of my intersection are now broken. Not sure what happened as this area of my scene hasn't changed much in months.
    I suspect it might have to do with default indent and my terrain resolution. These values might have changed when I split up my terrain.
    What settings can I play with to change the behavior of terrain deformation for dynamic crossing prefabs?
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    In what way are the intersections broken now? Do you mean the white surfaces (General Settings > Scene Settings > Hide White Surfaces) are generated different now? Are the heightmap resolutions or size of the two terrains different?

    Thanks,
    Raoul
     
  39. pjchardt

    pjchardt

    Joined:
    Jul 16, 2015
    Posts:
    7
    The terrain is pulled through and above inclined roads connected to intersections.I attached a photo.

    I believe I found the issue. If terrain heightmap resolution is low enough, the dynamic prefab indent will extend outside the bounds of the prefab and modify the terrain under connecting roads. The issue is that the prefabs do not update when the indent is changed. When the terrain resolution is increased, followed by decreasing the indentation minimum, crossing prefabs do not update, such that building the terrain still pulls it through the roadway. If I select on a prefab in the scene, it then updates its indent.

    This led to confusion as nothing I changed on the terrain or in EasyRoads settings had an effect (until I started selecting prefabs in the scene).
     

    Attached Files:

  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi pjchardt,

    Within the system, dynamic prefabs refer to built-in customizable crossing prefabs.

    The crossing in your screenshot looks like a crossing based on a mesh imported in the system, "custom connection prefabs" is that correct?

    Referring to the topic started by tex5564 and seconded by you in your post further above, since this can also for example involve overpass type of connection prefabs, for custom connection prefabs "Terrain Deformation" can be switched off in the Custom Prefab Editor window.

    I belief that Indeed indent values do currently not auto adjust. In General Settings > Scene Settings, the minimum global Indent values can be set. This can never be lower then the minimum required Indent values based on the terrain size and heightmap resolution. After increasing the terrain heightmap, this value can be lowered manually. Also, in recent updates the default indent values can be set per road type. For motorways you probably want a higher value then for mountain roads and dirt tracks.

    Is the problem resolved now?

    Thanks,
    Raoul
     
  41. MadAboutPandas3

    MadAboutPandas3

    Joined:
    Jul 3, 2017
    Posts:
    29
    Hello,

    When I click on the game object with the Road Network component in the hierarchy, the inspector opens ER Modular Base with a custom editor for it. Click on the middle button opens a subsettings for Build Settings. Here a button "Build Terrain(s) appear which adapts the terrain height to the roads.

    See
    http://www.unityterraintools.com/EasyRoads3D/v3/html/terrain_control.html

    My question is: I need to execute the Build Terrain functionality in a batch process. How to execute this from a script? The component ER Modular Base is in a dll.

    Kind Regards,
    Chris
     
  42. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Chris,

    That can be done through the scripting API:

    Code (csharp):
    1. // create a reference to the road network object
    2. ERRoadNetwork roadNetwork = new ERRoadNetwork()
    3.  
    4. // Adapt Terrain heights and additionally update the terrain splatmaps, remove trees, remove detail
    5. roadNetwork.BuildRoadNetwork(true, true, true);
    Thanks,
    Raoul
     
  43. Binary-Soul

    Binary-Soul

    Joined:
    Nov 25, 2014
    Posts:
    33
    Good evening,

    There's something that I suspect is probably really simple, but I'm not able to find how it's done so I might just ask around here.

    I've got two projects:

    In one of them, both in the "Scene" window (editor) and the "Game" window (runtime), when I create a road, I always see its "area of influence" (white area below the road that defines how it will deform the terrain) solid white.

    In the other one, in the "Scene" window it only shows up when I select the Road Network object from the hierarchy that the road belongs to, and instead of solid white, it's white and semitransparent and in the "Game" window, it just never shows up.

    I don't remember having changed anything related to that and I can't find how to modify it (I want to always see it solid white, as in the first project).

    Also in "Road Settings", the "Terrain Deformation" checkbox is set to true in both projects, just to discard that reason.

    Hope you can help me out as I really need it to be visible at runtime.

    Thank you!
     
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Binary-Soul,

    That can be controlled in General Settings > Scene Settings

    The "Hide White Surfaces" checkboxes is related to the solid white area surrounding all the roads and crossings. It gives an accurate representation of how the terrain will affected.

    The three "Highlight" checkboxes are related to the semi transparent surfaces that only appear for the selected road. This option can be useful if you rather not always see these white surfaces but if you do want a representation of the shape for example in hilly areas.

    The Space bar can be used to quickly toggle visibility on/off when working on the road network.

    Thanks,
    Raoul
     
  45. Binary-Soul

    Binary-Soul

    Joined:
    Nov 25, 2014
    Posts:
    33
    Thanks! I knew it would be something simple, just couldn't find the option although I went over every menu option xD.
     
    raoul likes this.
  46. pjchardt

    pjchardt

    Joined:
    Jul 16, 2015
    Posts:
    7
    Thanks for clearing things up. You are right about my prefab, my apologies, I am still trying to understand and learn how to use the crossings system.

    Not sure what the ramifications are when indent settings are auto adjusted...would be nice to either auto update or have an indication that these settings do not take effect until some action is performed, clicking a button for example
     
  47. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi pjchardt,

    No problem :) My comment about dynamic and custom crossing types was primarily to let you know that terrain deformation can be switched of for custom connection prefab. It seemed that is what you are looking for after seconding the request by tex5564

    Adding an "Update" button is on the list to add. It is a little bit tricky though because these values can be changed to customize the indent area along roads. So updating all of them may overwrite values you wanted to keep.

    Thanks,
    Raou
     
  48. LandPlanOS

    LandPlanOS

    Joined:
    Sep 8, 2014
    Posts:
    13
    Hi there,

    I have two questions:

    1. Is it possible to create roads based on dynamic data and to bake the terrain afterwards at runtime?

    2. Is it possible to create a ridge (without any road, just terrain edit, call reverse river?

    thx Stefan
     
  49. MadAboutPandas3

    MadAboutPandas3

    Joined:
    Jul 3, 2017
    Posts:
    29
    Hi Raoul,

    first of all thanks for this great asset!
    While I really love working with Easyroads, I am currently facing one issue:

    The general workflow for builds is to "Build Terrain" and safe the scenes. After that is done the build commences.
    Yesterday I couldn't save a scene with a relatively big road network due to memory shortage (16GB RAM on the machine). Since the scene saves just fine while in Edit Mode, I was thinking if you could clear things up why saving the scene with a built roadnetwork takes up so much more memory so I can circumvent similar issues in the future.
    I am using Unity 2018.4.0 with EasyRoads v3.1.7

    Again thanks for your great work,
    Christopher from Mad About Pandas
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Stefan,

    1. Yes, that is possible through the scripting API, roads can be created and the shape can be baked in the terrain afterwards. The runtime scene in the main EasyRoads3D package includes a simple example of this.

    2. That is also possible either by moving the markers upwards and removing the road mesh. Or, better, this can be done using the shape type of side object. An example of this is the river bed side object in the additional free demo package. The advantage of this approach is that you can define the exact shape of the ridge and no road mesh will be created. The idea is the same as for the river bed side object, only the nodes in the Shape Editor window will be above y = 0 instead of below y = 0 like in the river example.

    Thanks,
    Raoul
     
    Last edited: Jun 13, 2019