Search Unity

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,735
    Hi unity_c1ndWE1Nn46iPg,

    This does not look like one of the provided materials, you also mention tga so I assume this is your own texture? What is this supposed to look like? Is this about the area inside the red circle or also in front of it? What shader are you using and because the circle is drawn further away, what is the Aniso Level in the texture import settings? Does increasing this solve the problem?

    Thanks,
    Raoul
     
  2. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    I use my own texture with your shader
     
  3. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Solved it
     
    raoul likes this.
  4. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Why can't connect with crossroad like the non HD road?
     
  5. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Used to see a green ball so that I can connect CrossRoad.jpg
     
  6. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    And how can I reduce size of the crossroad to fit with other roads?
     
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Can you give more details how you created that crossroad?

    It appears you created your own road type with your own material. The next step would be to create a matching connection prefab, Road Types > Create New Connection prefab, below the material options.

    The crossing connection will be built according this road type so the width of the crossing will auto match the road type.

    Regarding your other post, the HD Roads crossings are based on imported meshes and use a road shape setup with three nodes. Default built-in road types are based on two nodes. That is why it will not connect to HD Roads crossings.

    Built-in custom road shapes are supported in v3.2 available in betas.

    Thanks,
    Raoul
     
  8. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Your road mesh with my own texture
     
  9. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Not like your demo scene, I don't see a connector when I create one. 2019-09-07_005434.jpg
     
  10. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
  11. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    I am trying hard to follow you as much as possible.

    Can you please provide exact steps of what you are doing?

    Thanks,
    Raoul
     
  12. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    No custom prefabs available. That's why I cannot connect it to crossroad
     
  13. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Is this still about your new dirt road type? I mentioned that the HD Roads custom prefabs, the prefabs in the red circle in your last image use a 3 node setup. Your new road type is a built-in road type with a 2 node setup. That is why they do not connect.

    If you want you road to work with the HD Roads crossings then try duplicating for example an HD Roads dirt road type and assign your material to it.

    After my previous post I have sent you a PM with an email address, did you see that?

    Thanks,
    Raoul
     
  15. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Red road is the HD road shader. I only change the albedo map
     
  16. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    I don't use the previous shader anymore
     
  17. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Please remember that this is a support forum and is shared/used by many people. It isn't chat. When seeking support, please provide detailed, clear and well thought out posts. Instead of posting several posts minutes apart, either edit your last post to add information, or plan head a little bit.

    Asset store authors are typically very helpful and willing help you solve your problem. Please return the courtesy by being very clear in what you are asking, provide all relevant information so they don't have to continually ask for more details, and make sure it is related their assets. (for general information or core elements like texturing, please see the learn section);
     
    JamesWjRose, sstrong and hopeful like this.
  18. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Indeed it is not always easy to see what the problem is based on an image and a limited explanation. Meanwhile unity_c1ndWE1Nn46iPg sent a video with the problem. Indeed the feature where connections are directly attached to roads does not seem to work well in the current version, no HD Roads assets are listed. I will check that.

    Thanks,
    Raoul
     
    Last edited: Sep 7, 2019
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    This is actually a strange situation that can happen at least in Unity 2018.3.f2 when first importing the HD Roads package and then the EasyRoads3D package. Although the crossing data is available in the prefab in the project folder (looking at it in debug mode) somehow it cannot be correctly accessed. Therefore no HD Roads prefabs will be listed when a road is selected and also, no connections will be visible either after instantiating it.

    If anyone is experiencing similar issues, then please try removing the HD Roads prefabs from /Assets/EasyRoads3D/Resources/custom prefabs/ and reimport the HD Roads package after the full EasyRoads3D Pro packlage is imported.

    Thanks,
    Raoul
     
    Last edited: Sep 7, 2019
  20. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    64
    Hi Raoul -- I'm sorry I did not have time to bundle up the whole scene with the issue regarding the slew of error messages on repaint -- I'm under a time crunch to get this work done. Anyway, although it happens pretty constantly I've learned to work around it, by saving my work constantly and usually deleting the last added object makes it go away.

    But now I have a new problem, I must be doing something wrong --- for some reason terrain deformation is being ignored? (or something) under my crossings. I have Terrain Deformation checked on all my crossing objects. I checked that no Y vreex coordinates are less than 0, and yet I'm getting this result:

    Before Terrain Deformation (road network hidden and shown)

    Screen Shot 2019-09-07 at 3.07.11 PM.png Screen Shot 2019-09-07 at 3.08.09 PM.png

    after Deformation. X's show a few of the resulting "pits" under the intersections:

    Screen-Shot-2019-09-07-at-3.08.34-PM.jpg

    any ideas what I might be doing wrong?

    Thanks,

    --Bo
     
  21. raoul

    raoul

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

    These are custom connection prefabs based on your crossing meshes. Are thery working correctly now? This is also with regard to generating these white surfaces visible when "General Settings > Scene Settings > Hide White Surfaces" is not checked.

    A good way to see if they are generated correctly isd by moving the crossing upwards, do these white surfaces follow the crossing and snap to the terrain on the outside like for example the built-in X and T Crossings do? If not, are the connections generated in clockwise direction in the Custom Prefab Editor window?

    Thanks,
    Raoul
     
    forzabo likes this.
  22. Marc-Saubion

    Marc-Saubion

    Joined:
    Jul 6, 2011
    Posts:
    655
    Hi Raoul. Thanks for your anwser.

    I Solved the issue. It turned out I had a third party plugin running in the back (gaia spawner) and it refreshed with any minor change. Also my road was 4 km long and that seemed heavy. I split it in shorter bits and it runs fine now.

    I found the shorcuts on this page: http://unityterraintools.com/EasyRoads3D/v3/html/quick_start.html. It seems obsolete. Do you have a more recent website?

    Thanks


    I wanted to disable the updating of the terrain but that's solved. Thanks anyway. :)
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Marc-Saubion,

    Glad to hear you figured out what was causing the slow down.

    Regarding longer roads, usually they do already get split in smaller sections by crossings, otherwise they can be cut in shorter sections by inserting I Connectors. That is indeed better for performance then having one long road.

    Thanks,
    Raoul
     
  24. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    64
    Raoul -- Thanks! -- these were the hints I needed.
     
    raoul likes this.
  25. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Hi.

    Please tell me how to put the guard rail at the inside edge of the sidewalk.
    Currently, When I set the guard rail and the sidewalk same time, the guard rail is put at the outside edge of the sidewalk.

    sidewalk.jpg

    Thanks.
     
  26. raoul

    raoul

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

    This can be fine tuned for the side object itself in the Side Object Manager tab (2nd tab from the right). The "X Position" field at the top in "Control Settings".

    The same "X Position" value can then optionally be customized per road in the main "Side Objects" section. These options are available in the foldout.

    Thanks,
    Raoul
     
    combatsheep likes this.
  27. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Thank you, Raoul!
    I make it!;)
    IMG_0009.PNG
     
    raoul likes this.
  28. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Hi, Raoul.

    When I use 'Build Terrain(s)', the height of X- or T-crossing roads are lower than around roads every time.
    The Terrain surface appears on the surface of the X- or T-crossing road...

    TerrainSurface.jpg

    Can I fix it?

    Env:
    Unity 2019.2.3f1
    iMac 2019 mojave (Metal)

    Thanks
     
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    That should not happen. In Build Mode:

    1) What is the "Raise Road Network" value in the Inspector?
    2) What is the Y position of the "Connection Objects" child object in the road network hierarchy?
    3) What are the Y position values of the individual crossing objects?

    And which version of EasyRoads3D are you using?

    Thanks,
    Raoul
     
  30. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Hi, Raoul.

    >That should not happen. In Build Mode:
    Yes. It happens after 'Build Terrains', and it disappears when edit mode.

    >1) What is the "Raise Road Network" value in the Inspector?
    0.05~0.1.
    Only crossing roads are not raising.(Spline road is raised normally)

    >2) What is the Y position of the "Connection Objects" child object in the road network hierarchy?
    ex)92.9

    3) What are the Y position values of the individual crossing objects?
    ex)92.9 (same)

    >And which version of EasyRoads3D are you using?
    v3.1.8.f2

    EasyRoads_EditMode.jpg EasyRoads_BuildTerrain.jpg

    Thanks.
     
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735

    Are these values for sure 92.9?

    If the Raise value is 0.1 (which is fairly high). Then the y value of the "Connection Objects" gameobject should also be 0.1, just like for the "Road Objects" gameobject, the parent of all individual road objects. Is that not the case?

    What are these values in Edit Mode for the "Connection Objects" child object? Can you make sure that object is set to (0,0,0) in Edit Mode. Does that solve the problem?

    And how does this work in the main demo scene?

    Thanks,
    Raoul
     
    Last edited: Sep 12, 2019
  32. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Now, I understand what is wrong by seeing the demo scene.

    XCross.jpg
    When I make the crossing road(which is made with customized road type), it is made at outside of "Road Network" Object.

    CrossingWorkFine.jpg
    And I move them into Road Network manually, their surfaces work fine after "Build Terrains"!;)

    I tested that I make the default road in the other scene, the crossing road was made normally.
    So, the Road Network in my current scene is maybe broken.

    Thanks.
     
    Last edited: Sep 13, 2019
  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    That indeed explains the situation in Build Mode, the crossing will not be raised according the "Raise" value.

    But it is strange, when selecting a crossing prefab in the Connections tab and using Shift + Click in the scene to instantiate it, the object will be placed as a child of "Connection Objects" in the hierarchy. And, in Unity 2018.3+, when dropping a crossing prefab in the scene from the project folder it should also be placed as a child of "Connection Objects" in the hierarchy. There are no known issues with that. So I do wonder how these crossings ended up outside the road network hiearchy on your end? Perhaps this is something to test for this specific road network.

    Thanks,
    Raoul
     
  34. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Hi raoul,
    I don't fully understand what ERRoad.GetPosition function says in the api manual:
    What does float distance value mean? Is that a value that indicates the distance travelled along the road? In other words is it like the position in cam fly over in the editor? Has a range then?

    Also, the in currentElement is the index of a road marker or what?
     
  35. raoul

    raoul

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

    Yes, float distance value is the current distance travelled along the road, currentElement represents the nearest splinepoint index, it is used for optimization reasons.

    The runtime demo scene / script example, part of the EasyRoads3D Pro package itself, uses the ERRoad.GetPosition function as well. First a road is created at runtime, after that an object follows the road. Have you checked that?

    Thanks,
    Raoul
     
  36. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Ok I've checking it and now I think I get how it works.
    One question though, I have a vehicle that is controlled by the user, and I want to know at which distance along that road the vehicle it is, to check his position against the center of the road.
    Do you hace any idea how to pass from the Vector3 position of the vehicle to a distance like the one the method is expecting? I'm in the dark here.
     
  37. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The ERRoad.GetPosition function is indeed more intended for AI purposes, moving objects along the roads.

    The scripting API provides access to the spline points, ERRoad.GetSplinePointsCenter(). Or, if you are looking for the position relative to the center of the road, another way could be to create an invisible vertical shape type of side object in the center of the road. Raycast sideways on that side object from the vehicle position and calculate the distance to the hit point.

    Thanks,
    Raoul
     
  38. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Oh thanks for the idea!

    By the way, is there any way to get the road forward direction at a distance via script? So the objects travelling it via IA have the correct rotation. Being looking in the manual but didn't find anything.

    Also, what does GetMarkerByPoint(int) does?
     
    Last edited: Sep 14, 2019
  39. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi 40detectives,
    Can you try ERRoad.GetLookatSmooth(float distance, int currentElement);

    That is used internally, it returns the marker section of a specific spline point index.

    Thanks,
    Raoul
     
    40detectives likes this.
  40. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Thanks, it worked! :)
     
    raoul likes this.
  41. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    6
    Hi,

    I am struggling to understand how to link roads together with crossings. I am using the recent beta and have read through the example script but for some reason cannot work it out. I am not using the EasyRoads traffic AI system directly, rather the A* pathfinding project for navigation.

    Below, you'll see the situation I have set up. The green lines are custom created links between empty game objects with the tag "Node". I create these nodes with an editor script, iterating through GetLanePoints(). Could you nudge me in the direction towards generating nodes for connections prefabs and linking them as below? I assume I would need a couple more nodes to smoothen out the green line connections, given that they are inherently straight lines.
     

    Attached Files:

  42. raoul

    raoul

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

    The v3.2 AI options is based on lane info defined for road types. This is available on roads and on crossings per crossing connection.

    For crossings you can use:

    ERConnection.GetLaneData(int connectionIndex, int lane);

    connectionIndex is the connection where the road is attached to the crossing. Lane is the lane index which in your case is 0 because there is only one left and right lane.

    This will return lane data in all available directions. In the AI exampl;e ther below code is used. It randomly selects one of the directions.

    ERLaneConnector[] laneConnectors = conn.GetLaneData(connectionIndex, lane);
    ERLaneConnector laneConnector = laneConnectors[Random.Range(0, laneConnectors.Length)];
    Vector3 points = laneConnector.points;

    But I am not sure about the green line linking. With your setup the left and right node on a road also connect, what exactly should this look like on the crossing?

    Thanks,
    Raoul
     
    Last edited: Sep 16, 2019
  43. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    6
    Thanks for the response. The nodes on a single road connect from lane to lane so the vehicle can cross over them. For connections, though, I only want the lanes to connect to each other as one would expect. So lanes travelling in one direction would connect to lanes traveling in the same direction only.
     
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Ok, in that case it seems the data should be generated in a similar way as also visible when selecting a crossing, the required green lines should look similar as the white lines in the image below. That is what you should get using the suggested functions in my previous post. Let me know if you have more questions.

    crossing.jpg

    Thanks,
    Raoul
     
  45. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    6
    Hi — I am not sure what I am doing wrong, but I have set up my connections for the lane and in my script, I can successfully register that a connection at the beginning of a certain road exists, but when I try and get the lane data it is returning an empty list.

    EDIT: Okay, so after a quick test again, I noticed that my lane index is actually 1 and not 0? Not sure why this is the case; I definitely only have 2 lanes set up in either direction.
     
  46. raoul

    raoul

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

    It is hard to give feedback without seeing the road type setup and the code.

    For a 2 lane road with one lane on the left side and one lane on the right side, the below will return the points (tested in the unity editor, lane index 0 is passed for both):

    ERRoad road = EREditor.GetSelectedRoad();
    Vector3[] rightPoints = road.GetLanePoints(0, ERLaneDirection.Right);
    Vector3[] leftPoints = road.GetLanePoints(0, ERLaneDirection.Left);

    Thanks,
    Raoul
     
  47. rmon222

    rmon222

    Joined:
    Oct 24, 2018
    Posts:
    77
    Hi. I need to decrease the number shader keywords used in a project and I notice EasyRoads3D uses about 20-30 keywords. Can you suggest a strategy to reduce number of keywords? For example, do I need the "Unity 5 Standard shader (27 keywords)" if I'm using 2019.3?

    EDIT: Shaders are sharing keywords so total number of keywords is only 20-30

    Thanks,
    Ram
     
    Last edited: Sep 20, 2019
  48. raoul

    raoul

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

    Which exact shaders are involved?

    The EasyRoads3D Standard shader versions are copies of the unity standard shaders, only an offset is added to deal with z-fighting with the terrain. The "Unity 5 Standard shader" can be removed from the project if it is not used.

    Thanks,
    Raoul
     
  49. rmon222

    rmon222

    Joined:
    Oct 24, 2018
    Posts:
    77
    The problem is I've surpassed 256 global shader keyword limit and I'm searching the whole project (not just EasyRoads) for global keywords that I can make local or remove entirely. The "Unity 5 Standard shader" I suspect uses keywords that many shaders use so I can't remove those. Any suggestions for pruning global keywords in EasyRoads would be appreciated.

    Thanks,
    Ram
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    To what extend is this EasyRoads3D related? There aren't that many shaders, especially in the Pro package itself and they are fairly simple. Which packages / shaders do you have imported?

    Thanks,
    Raoul