Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    783
    @raoul would be great if the next beta contains these 2 changes:
    - allow to set indent and surrounding to higher values, like 50
    - allow to control both horizontal and vertical tiling for shape objects (the current tiling value applies on both axes)
     
  2. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi jimmikaelkael,

    New beta 8.1 builds have already been created and will be available today.

    Wasn't your initial request for Indent only? That is updated in 8.1

    Could you explain how you want to use the horizontal and verical tiling? Uv coords are calculated by distance, there is not such thing as horizontal / vertical tiling for UV coords. First thoughts are that what you need is more shader related. Are you asking for two sets of UV coords (which will also require a custom shader)?

    Thanks,
    Raoul
     
  3. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    783
    Yes I was, but I realized that surrounding also needs to be slightly larger as indent.

    I'm not an expert there, so let me explain what I'm trying to do instead as I'm maybe approaching it in a wrong way:
    - when using shape objects to create some asphalt planes in turns, the UV stretching will depend on how large is that asphalt plane. If it's very large it can appears as stretched in some places (and the opposite when the plane is very thin).

    Capture.JPG


    Another thing I'm not sure how to approach: the race track I'm reproducing have some colored bands on that asphalt extension but it is not stretched, I mean for example it's 1.5meter wide and constant (not following the "Shape Object" shape it is on).

    I know I could have another side object slightly above the asphalt extension but maybe it's just not the proper way to go... I'm not sure. FYI the asphalt extensions material is using the same shader as the road asphalt, one of the easyroad's one which offsets road depth in its pass.
     
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    The max surrounding value has been updated as well, but as mentioned, I already prepared the 8.1 builds, available in a minute. It is already uploaded.

    The width change in that image is quite a lot, indeed that will result in visible stretching, that cannot be fixed by different UV coordinates on a standard shader. I am working on blending textures on crossings, a similar approach can be used on roads to achieve what you want. I will put that on the list but it will not make v3.0, the blending on crossings will also be v3.x (a custom prefab example will be part of v3.0 demo project). If you need this more urgent you could look into customizing the generated roads yourself.

    It indeed sounds like another side object should be used for that coloured band.

    Thanks,
    Raoul
     
    jimmikaelkael likes this.
  5. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Beta 8.1 can now be downloaded from our website

    New in this update is the option to lock/unlock road objects that you are finished working on and the “Exclude Locked Objects” option in General Settings > Scene Settings (Shift + L). Marker handles for locked road objects will no longer be displayed in the scene which can be useful for big road networks.

    For Procedural and Shape type of side objects the Prefab Childs dropdown will be visible for Connection objects when the source prefab has child objects. This can be used to add variation like also available for Mesh type of side objects.

    This update also includes fixes for bugs recently reported in this thread.

    The asset store update is being uploaded at the moment and will hopefully be approved soon by the asset store team.

    Thanks,
    Raoul
     
    sstrong, hopeful and jimmikaelkael like this.
  6. FH_GameDev

    FH_GameDev

    Joined:
    Sep 12, 2016
    Posts:
    1
    Oh wao :) ... simply awesome!
     
    raoul likes this.
  7. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi everyone,

    I am not sure this is possible with ER3D, but here goes: is it possible to build a road not by defining its axe, but rather by its contours? e.g. the road, instead of being drawn on left and right sides of the path, would be created inside the boundaries of a closed path. What I actually need is a way to build roads that are not necessarily width constant.
    I'm not sure I'm making myself clear, so let me know if you need extra explanations.
     
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613

    Hi ceyssette,

    A little bit more info would be useful, perhaps an example?

    The width of the road can be defined but is “constant” by default. You can change the width, manipulate the shape, per marker.

    Do you want the road to nicely “snap” to a bumpy terrain with irregular widths instead of having the terrain flattened according the road shape?

    Thanks,
    Raou
     
  9. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi Raoul,

    I don't want the road to snap to the terrain relief, I need it to follow a particular shape, which is not width constant.
    Here is an example road I would like to build with ER3D:

    Clipboard02.jpg
     
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi ceyssette,

    Generally the road has a fixed width but there are some irregular sections and crossings.

    It looks like you can do the crossings with the available dynamic crossings system, T crossings which suports a flexible corner radius.

    The difficulty with those irregular sections in your image is always what the road visually should look like, texturing, just like with crossings in general. Perhaps some parts can be done by using the option mentioned in my previous post, changing widths per marker (the N key toggles that feature on/off).

    Other irregular sections, like the one at the top in the bend can be done using custom connection prefabs based on your own meshes imported into the system, like the small custom road network in the main demo scene of the package.

    Thanks,
    Raoul

    [Edit] Just to confirm, it is not possible to auto generate the roads based on shape input like included in your last post. Creating the road geometry wouldn't be too complicated, the texturing is the hard part unless you just need planar UV coordinates according, for example, the bounding box.
     
    Last edited: Sep 14, 2016
  11. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Ok thanks Raoul, I'll try what you recommend! :)

    I have another question, I can't find whether this is possible or not: How can one export its road and side objects definitions in order to re-use them in other projets?
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi ceysette,

    After creating your first road network in a project the following prefab will be created:

    /Assets/EasyRoads3D/Resources/ERSideObjectsLog

    This prefab is where the side object and road type data is stored. You can create a unitypackage from it and import it in the other project. Just be careful not to override the current prefab if you already created other road types / side objects in the new project.

    Alternatively you can rename it into ERProjectLog and replace the original ERProjectLog prefab. This prefab comes with the package (the default side objects and road types). You will be able to import road types and side objects through the respective Import buttons in General Settings > Road Types and the the Side Object Manager for side objects.

    Also make sure to export additional assets, prefabs, materials etc :)

    Thanks,
    Raoul
     
  13. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Again, thanks Raoul, for your dedication and support!

    On a side note, I'm running into an issue trying to build walls.
    In order to create walls, I use a simple cube prefab (I just changed y and z scales) as source object for a procedural mesh side object. The result is as follows:

    Clipboard02.jpg

    Why is a triangle missing, and how can I solve that problem?
     
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi ceyssette,

    No problem, the resources are still provisional and limited so I understand there will be questions, certainly when you dive deeper into this :)

    I will check how the system behaves when the input is a simple cube. Did you define start / end sections in the Mesh Editor window?

    For a simple wall you generally want to use a source prefab with 3 clear sections, a start section, middle section and end section. You can use the concrete wall side objects in the demo package as examples for this.

    Thanks,
    Raoul
     
  15. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    I did not define start / end sections.
    I'll check the concrete wall example.
     
  16. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Ok, I will try this with a simple cube without defining start / end sections. But this is not an ideal setup, for each segment triangles will be created "inside" the wall if no start / end sections are defined.

    Thanks,
    Raoul
     
  17. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    175
    Trying to deal with this issue (pictured). The problem is caused by the 5 metre indent area either sides of the road. My road is a racetrack and it runs alongside itself causing this issue in multiple places where the road is very close to itself. Why is the ident so big and why can't I reduce it below 2.92 metres? Please suggest a solution to this as currently I have a race track with lots of holes in it from road indent areas overlapping and I've fidlled with every option to try to remove it without success. (EasyRoads V3 beta 8)

    upload_2016-9-15_19-11-41.png

    Lots of problems in the area highlighted ....

    upload_2016-9-15_19-15-58.png
     
  18. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi Raoul,

    I tried this, but I can't get it work. Here is the result:

    Clipboard02.jpg

    You mention an example in the demo project, but I can't find it. Can you tell me where it is?
     
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi catfink,

    It seems like your terrains heightmapscale is small enough to go below 5. You can check that in General Settings > Scene Settings > Min Indent. This value is also to which the marker Indent valus are locked. So if you lower that value you shoukld also be able to lower the marker Indents.

    But indeed, if road sections are too close to each other, within the Min Indent value (the terrains heightmapscale) something like in your screenshot will happen. There will not be enough terrain points available to flatten the road sections independently. In that case all you can do is make the gap between the two sections wider or perfectly match the heights of both roads.

    Or another solution would be to lower the terrain afterwards manually and use the side objects system to fill the gap with for example a grass strip and a wall.

    Thanks,
    Raoul
     
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613

    Hi ceysette,

    First thoughts are that the normals are pointing downwards. Did you check that? The "Flip Normals" button should fix that.

    Or, since this side object is created at the center of the road (X Position dropdown set to "Relative to the center of the road") at y = 0, it may interfere with the road itself. You could try raising the nodes a little bit or raise the Y Position value in the Side Object Manager.

    When creating side objects I would recommend to use a test road on a flat surface so you have a clear view of the situation.

    With "new demo project", I meant the final v3.0 demo project. It is being worked on, final steps for release...

    Thanks,
    Raoul
     
  21. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    175

    Perfect that did the trick, managed to get the indents down to around 1 metre and then with some slight tilt and repositioning it all resolved :)

    Thanks, Ash.
     
    raoul likes this.
  22. Gphysono

    Gphysono

    Joined:
    Jul 24, 2015
    Posts:
    21
    Question about accessing roads through code..
    I'm using the V3 Beta and have one road named "road_0001". I clicked the "generate waypoints" from the inspector and it created all these waypoint child objects with road_0001 as the parent.

    I'm trying to drill through and access the waypoint list with the following code:


    public ERRoad _road;
    _road = GameObject.Find("road_0001").GetComponent<ERRoad>();

    It comes back with
    GameComponent requres that the requested component "ERRoad" derives from MonoBehavior or Component or is an Interface."

    Any ideas? Is there another way of getting to the waypoints?

    Thanks
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi Gphysono,

    The Generate Waypoints button is not API (ERRoad) related. If you need the waypoints through code you could go through the _road transfoms childs and check the name for "Waypoint".

    But the Generate Waypoints button is a little bit obsolete. You can now use the scripting API for this.

    Code (csharp):
    1. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    2. ERRoad _road = roadNetwork.GetRoadByName("road_0001");
    3. // get the marker positions
    4. Vector3[] markers = _road.GetMarkerPositions();
    5. // get detailed spline info
    6. Vector3[] splineInfo = _road.GetSplinePointsCenter();
    Scripting API: http://unityterraintools.com/EasyRoads3D/v3/html/scriptingAPI.html

    Thanks,
    Raoul
     
  24. Gphysono

    Gphysono

    Joined:
    Jul 24, 2015
    Posts:
    21
    Thank you Raoul, It works!
    I was approaching it all wrong.
     
    raoul likes this.
  25. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    I just bought the Pro version of EasyRoads and am trying the Beta V3 version. I get everything set-up and then either Unity crashes or I now, I try to Build the road and the Flatten terrain option is missing. This might be due to performing it once and then deleting the Road Network. Not sure, but seems like a bug. Here is a screen shot of the Inspector upload_2016-9-20_8-27-29.png

    Roger
     
  26. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    I am trying to create road and river tiles. Setting the first two point to fixed positions and straight xyz, so they merge seamlessly. Has anyone else done this already? Are there any good Wang tillable Road / terrain pieces available?

    Roger
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi Roger,

    The screenshot indicates that your road network is currently in Build Mode. You can click the "Back to Edit Mode" button to switch to Edit Mode, afterwards the Build options will appear again.

    Does that solve the problems you are having?

    Also, the Raise value is set to -1, this means that the road network will be positioned 1 unity below the terrain, you probably want that set to somwhere between 0 and 0.05.

    Thanks,
    Raoul
     
  28. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Could you show an example of what you want to achieve? Indeed using straight xyx for the controller type will result in a perfect line and in theory you could connect two separate objects that way but perhaps there is another way to achieve what you want.

    Or is this done on the seams between terrain tiles so you have tile specific objects? In that case you could experiment with the split road option, if the markers controller type for the involved markers are straight xyz and you use the alignment options on these three markers first, the two new roads indeed should nicely connect after splitting the original road at the middle marker.

    Thanks,
    Raoul
     
    Last edited: Sep 20, 2016
  29. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    No, the Build just takes me to the previous editor. The terrain never gets flattened and there does not seem to be a button for it. I was just trying different values to see if I could it to work. Also, I get a warning about maximum of 512x512 heightmap. I gave it a heightmap of 513x513.

    upload_2016-9-20_12-39-8.png
     
  30. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    Truchet tiles would be a classic example. I do not want to take a large scene and break it into tiles. I want to construct a scene from a set of tiles:
    upload_2016-9-20_12-46-7.png
     
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi Roger,

    I am not sure what the maximum of 512x512 heightmap error / warning is about. I don't think this is EasyRaods3D related. Can you post the full message when you see that again?

    If there is not terrain deformation, could you check your road object and make sure "Terrain Deformation" in the Inspector is toggled on. You can also do this for the associated road type in General Settings > Road Types. This way new road objects of that type will have this automatically active.

    Thanks,
    Raoul
     
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Creating a road network by connecting tiles like in your screenshot is not really how EasyRoads3D works. It is a spline base toolset including options to create crossings. Or do you want to use these tiles as crossing/ connection prefabs between the roads and you have them modelled?

    In that case it seems you want to look into the custom connection prefab system. You can use this to import your own models. You can instantiate these tiles in the scene and connect roads to them or pull new roads out of the connections.

    Th below videos show the process:





    Thanks,
    Raoul
     
  33. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    Actually, I am not interested in crossings at all. We are looking at loops right now, so need LeftToTop, TopToRight, RightToBottom, BottomToLeft, LeftToRight, and BottomToTop tiles to support all possible loops on a grid. Here is a LeftToTop using V2, if we rotated it CCW and moved to the top we would extend our road.
    upload_2016-9-20_13-35-37.png
     
  34. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    New issue. Trying to save the RoadObject as a prefab. The mesh has no name, not sure if that is the problem. However, when I save to a prefab the Mesh goes to none. Is the mesh internal? If you try to select a mesh it is not listed (not registered?). I did an export, so could look at bring the .obj file back into Unity, but hopefully there is a better way.
     
  35. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    SO I did not see an option for that anywhere. I changed the Inspector to Debug mode and found it. It was not checked, but checking does not seem to change anything. I am using the Default Road.
     
  36. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    I do get this when going to the Build screen on occasion:
    upload_2016-9-20_15-2-9.png
     
  37. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    I found the checkbox on the individual markers. Things seem to work now. I also found a mesh saver on GitHub so I think things are good with V3. Thanks.
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    But that image does look like a terrain tile with a road section. Do you intend to reuse that terrain tile and road section? In that case all you have to do is make sure the road is exactly in the middle and indeed use straight XYZ for the first / second last marker and align these markers at a 90 degree angle with the terrain edge.

    Or am I still missing something?

    Thanks,
    Raoul
     
  39. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Unity stores dynamically created meshes in the scene file, the mesh name is not important.

    Unity prefabs expect the mesh to be physically present in the assets folder. To achieve that, click the "Store Mesh Assets in Assets Folder" button in the Inspector after switching to Build Mode. The mesh slot will now point to a names mesh in the assets folder. You can now create your prefab.

    Thanks,
    Raoul
     
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Please do not change anything in the Inspector by switching to Debug Mode, the editor scripts will not run. Can you undo that change.

    How did you select the road? Please do this with the main road network selected and by selecting a marker, look in the Inspector for "Terrain Deformation" below "Closed Track".

    Thanks,
    Raoul
     
  41. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    I am not sure what this is about? Perhaps you changed something in debug mode that is now intefering with the editor scripts. Judging from your next post all is fine now. If not please let me know.

    Thanks,
    Raoul
     
  42. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Yes, you selected a marker and found the "Terrain Deformation" option in the main road settings, is that right? Regarding the mesh saver, check my post above about "Store Mesh Assets in Assets Folder" option if you didn't already saw it :)

    Thanks,
    Raoul
     
  43. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    Nope. That is what I am trying to accomplish. Curious whether others have already done this with EasyRoads and have some pretty tiles. I am a programmer, not an artist :).
     
  44. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    103
    Great. Thanks.
     
  45. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    I just wanted to say that, this is an awesome Unity Asset.
     
    hopeful and raoul like this.
  46. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    That is an interesting concept. In that case it is indeed a matter of placing the first and last marker exactly on the terrain edge and 2nd and 2nd last marker somewhere inside the terrain tile at the same x resp z position with XYZ Straight as the controller type for the first and 2nd last marker.

    Thanks,
    Raoul
     
  47. joe_ftg

    joe_ftg

    Joined:
    Nov 9, 2015
    Posts:
    50
    Hi Raoul

    I noticed today that certain parts of the terrain deformation cannot go below 0 in worldspace, is this intentional?

    I know Unity terrains cannot store local height values below, so I have set my terrain position to -50, and then use 50 as the default terrain height so that I can increase or decrease terrain height, while still using 0 as the default world y for game objects.

    But when I create a road going below 0 in worldspace, this happens:
    road2.JPG road3.JPG

    It works as expected if I move the terrain position 50 metres up.

    Thanks, Joe
     
  48. joe_ftg

    joe_ftg

    Joined:
    Nov 9, 2015
    Posts:
    50
    Also, is there a way to fade out road. i.e. I'd like to set the opacity of this last waypoint to 0.
    road1.JPG
     
  49. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Hi Joe,

    I had a quick look at this. It appears to be working fine but it seems these issues appear when you change the Y position of the terrain object while the road network is already created. Is that what you did? And does positioning the terrain before creating the road network also fix the issue you have?

    I will look into this. Thank you very much for reporting it!

    Raoul
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,613
    Yes, you can that, select the first or last marker, in the Inspector at the bottom of the marker controls you will see "Fade In Distance" resp. "Fade Out Distance". You can see this at the end of the dirt track (part of the road network using custom connection prefabs) in the main demo scene.

    Note that you have to use the EasyRoads3D transparent shader for this, or tweak your own shader accordingly.


    Thanks,
    Raoul