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
    Hi Christian,

    Thank you for posting this update! Glad to hear that connecting roads to crossings through the scripting API was actually related to this same situation with large differences between node positions.

    Thanks,
    Raoul
     
  2. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    44
    #1 simplify left/right is exactly it. I know about the mirror in the Shape Editor, and that works great until you decide to edit things after duplicating. But something to look forward to in 3.3.

    #2 is about auto-generating start and end objects for shapes. When I look around at the roads I'm trying to model, a lot of them have fairly simple geometry that can be easily simulated with simple sweeps - which is not all that different from how concrete curbs are poured and shaped (which in no way makes the geometry any easier to calculate).

    UPDATE: I had an idea about generating the ends. What if we could provide an Iterator that produced a vector3 containing the position/rotation of the shape and ER3d could use that to produce a mesh? That might make it a bit easier to handle some of the complexity by pushing it on to the users :)
     
    Last edited: Jul 26, 2019
  3. DonkeyPotato

    DonkeyPotato

    Joined:
    Mar 23, 2018
    Posts:
    9
  4. raoul

    raoul

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

    Yes, I just mentioned it as a quick way to make left / right versions in the current version. A similar mirror option exists for the procedural side object type.

    Yes, I think I mentioned that it is possible and certainly doable for simple shapes.

    Any feedback and suggestions is very much appreciated, I will make notes of this for v3.3 . It is just not that simple to come with a solid solution for this given that the shape by itself can be complex and that the defined shape in the shape editor window not necessarily matches the start / end shape when terrain snapping weights are used on the shape nodes. :)

    Thanks,
    Raoul
     
  5. raoul

    raoul

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

    Which road shader do you use? Most EasyRoads3D shaders use an offset to deal with possible Z fighting with the terrain. This is probably interfering with the projector. Depending on the shader that is used these values can be adapted in the Inspector. 0 is no offset. Or a similar Offset can be used on the shader used on the projector. If you look into the specific road shader, search for "Offset X, X" or "Offset [_OffsetFactor],[_OffsetUnit]" . X, X will be a negative value. A similar line can be added in the shader of the projector.

    The second part sounds related to the same.

    Thanks,
    Raoul
     
  6. vpamidi

    vpamidi

    Joined:
    Apr 18, 2019
    Posts:
    11

    Hi Raoul,

    I am trying to draw a single road around the building in rectangle shape. I need an exact 90 degree turn at the corners. Could you let me know how can I do it. I also need lane data of that road.
    I tried like this below.
    I defined lane data for road type. Then I drew the road using that road type like this below. At the corners it looks 90 degrees (marker spline control type is straight XZ) but it has overlaps.

    upload_2019-7-26_15-51-45.png

    my lane data has overlaps.
    upload_2019-7-26_15-53-4.png upload_2019-7-26_15-51-45.png upload_2019-7-26_15-53-4.png


    I am looking for the road in your above screenshot(which is 90 degrees) with Lane data also. Could you let me know how can I do it.

    Thanks & Regards,
    Vijayalakshmi
     
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
  8. vpamidi

    vpamidi

    Joined:
    Apr 18, 2019
    Posts:
    11
    Thank you. It will help for me.
     
    raoul likes this.
  9. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    44
    That's where exposing it as code could make things somewhat easier, for you. Instead of having to imagine every possible configuration a user might want and having to deal with every possible terrain and road configuration, if you exposed a standard interface and provided a few out-of-the-box implementations (e.g. a simple sweep around a fixed point, a straight extrude to a point, etc.) anyone who had a more complicated scenario in mind could write their own code. You might even be able to expose multiple levels of customization:
    1. simple translate and rotate:
      • here's the shape, you move it into x-z position + y-rotation, then ER3d takes it from there (elevation, tilt and deform)
    2. translate + rotate and deform
      • here's the shape, you move it into x-z and elevation and any tilt, ER3d does any additional deformations
    3. handle everything
      • here's the shape, you move and deform, ER3d just adds whatever you return to the mesh
    You could probably even extend that to the entire side-object system, i.e. allow for user-supplied code to calculate x- and y- offsets, rotations, shape profile, etc.

    I've tried modelling my start/end objects in Blender, and while I've got the right shape, I can never get them to import in the right orientation, which means they show up rotated 90 degrees down under the terrain or similar. That I can probably solve by figuring out which way I need to rotate the original, but it also appears that ER3d is doing some magic with normals and such that make the very simple shape look way more realistic than my imported object does, even though both are using the exact same original profile. The generated side object looks _exactly_ like the curb I'm modelling and took me all of 60 seconds to create right inside ER3d, while my custom end object which took 10s of minutes to create in Blender looks like a faceted, circa 1995 computer generated surface.

    Can you tell I'm a coder, not an artist? :)
     
  10. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Hi Raoul,
    I have another problem with custom prefab. I wanted to create a bridge with terrain deformation switched to off (as you told me), and I have a weird issue. Connection on right works great, but on the left, there is a gap. Object is the same on both sides. Do you have a solution for this? Thanks.
     

    Attached Files:

  11. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    It is on the list :) just like several other side object improvements.

    The orientation of the side object models in the demo package can be used as a reference. They should point in the z-direction. Also, often Unity applies rotations to them which is visible when dropping them in the scene. In that case the orientation will still be wrong. To fix that the model can be rotated in the modelling app or a new prefab can be created with the model assigned as a child including the same rotations unity applies. And assign the new prefab as the source model or start / end connection objects.

    Thanks,
    Raoul
     
  12. raoul

    raoul

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

    That is related to the nature of the unity terrain object. I guess the bridge starts / ends exactly at marker positions? In that case, if this position is somewhere in the middle of a terrain cell then there will be a gap.

    To deal with this the start / end offsets of the bridge side object can be adjusted. This can be done in Build Mode where the terrain deformation results are clearly visible. Have a look in the Side Object marker section for "Start Offset" "End Offset". Or press the H Key. This toggles on / off Scene View handles for these offsets. The positions can be fine tuned easily this way.

    Another option, assign default Start / End offsets to the bridge side object in the Side Object Manager. When this offset is about 1.5 of the terrains heightmapscale, there will never be a gap between the terrain and the bridge.

    Thanks,
    Raoul
     
  13. DonkeyPotato

    DonkeyPotato

    Joined:
    Mar 23, 2018
    Posts:
    9
    I had found an older post that mentioned the offset. I'm using the default '2018 Standard' road shader. I tried commenting out the offset from that shader, but it didn't change anything. Adjusting the offset in my projection shader to match the road shader value got the projector working.

    The wireframe was a bit trickier. Adding an offset didn't help - but adding a pass to write depth and no color got things working. Thanks for the help!
     
  14. raoul

    raoul

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

    Glad to hear you got that working.

    Just in case, the adapted '2018 Standard' shader has that Offset line actually added twice. It is the only difference with the Unity Standard shader.

    Thanks,
    Raoul
     
  15. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    It is me again. I have troubles with flex connectors in the latest beta. I have attached a scene which generates error messages continuously, as long as the Road Network object is selected.
    I have created this scene by:
    1) Create a default T crossing by shift-clicking
    2) Create three default roads
    3) Connect them to the T crossing by dragging the marker onto the connector
    4) Toggle the flex connector checkbox. The crossing is now a flex connector
    5) Toggle it again. The connector is back to being a normal connector but creates a large amount of exceptions constantly.

    I hope that the same error occurs on your side and it is not a problem with my project. I am not sure if this error in general effects my workflow, but I wanted to let you know regardless.

    Kind regards,
    Christian
     

    Attached Files:

  16. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    A different problem occurs with I connectors. Can you check if the code snippet below works for you? The last statement prints out true, so the roads should be connected to the I connector.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections.Generic;
    4. using EasyRoads3Dv3;
    5. public class BreakER
    6. {
    7.     [MenuItem("Window/Break I Connector")]
    8.     public static void BreakIConnector()
    9.     {
    10.         ERRoadNetwork network = new ERRoadNetwork();
    11.         var roadtype = network.GetRoadTypeByName("Default Road");
    12.         List<Vector3> markers = new List<Vector3>();
    13.         int scale = 10;
    14.         int numMarker = 5;
    15.         for(int i=0;i<=numMarker*scale;i+=scale){
    16.             markers.Add(Vector3.right*i);
    17.         }
    18.         ERRoad r1 = network.CreateRoad("Road 1", roadtype, markers.ToArray());
    19.      
    20.         markers = new List<Vector3>();
    21.         for(int i=numMarker*scale;i<=2*numMarker*scale;i+=scale){
    22.             markers.Add(Vector3.right*i);
    23.         }
    24.         ERRoad r2 = network.CreateRoad("Road 2", roadtype, markers.ToArray());      
    25.         ERConnection conn;
    26.         r1.InsertIConnector(numMarker, "I Connector", out conn);
    27.         UnityEngine.Debug.Log(r2.ConnectToStart(conn, 1));
    28.     }
    29. }
    However, dragging the I connector around, only the first road is attached to it and an exception is being thrown:
    Code (CSharp):
    1. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2. Parameter name: index
    3. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    5. System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    6. EasyRoads3Dv3.ERModularRoad.OCQQODOQOD (System.Boolean ignorePrefabAlignment, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    7. EasyRoads3Dv3.ERCrossingPrefabs.OCOOQDDODC (System.Boolean ignorePriority, EasyRoads3Dv3.ERModularRoad road) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    8. EasyRoads3Dv3Editor.QDOQDSQQDQODD.OnInspectorGUI () (at <fe851b335869451bbfc7018b3f480125>:0)
    9. UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at /home/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:445)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Maybe I am making a mistake in applying the scripting API like this? I did not find an example for instantiating I Connections, so I am sorry if I overlooked something.

    Kind regards,
    Christian
     
  17. raoul

    raoul

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

    The "Flex Connector" checkbox was added in the very first v3.2 beta as a way to create a new Flex Connector. meanwhile in new projects, it is not really required anymore. Pulling out a new road from another road will instantly insert a Flex Connector. It is an easier workflow then first inserting an X or T crossing.

    Indeed toggling off this Flex Connector checkbox afterwards will throw errors. I will make sure this checkbox is disabled for Flex Connectors.

    It is undecided at this moment whether in the final v3.2 release it will be possible to switch from a Flex Connector back to T or X crossing because the Flex Connector can do anything the X and T Crossing can do. But in that case for sure the error will be dealt with.

    Thanks,
    Raoul
     
  18. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    I just did a quick test on a road in the scene with 7 markers attached to a crossing.

    Code (csharp):
    1.     [MenuItem( "EasyRoads3D/Insert I Connector" )]
    2.     public static void   InsertIConnector()
    3.     {
    4.         ERRoad road = EREditor.GetSelectedRoad();
    5.         road.InsertIConnector(3);
    6.        
    7.     }
    The I Connector is inserted without errors. Both roads are fully functional.

    I will test with your code.

    Thanks,
    Raoul
     
  19. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    I tried to try the code snippet you have posted, but according to the editor, EREditor does not exist in the current context. Is there a special using statement I need?

    I might create roads with different types, for example a wider road with a left turn lane which is connected to a normal 2 lane road. To smoothly connect them, I want to use an I connector, which will be instantiated at the end of one road before being connected to the start of the other.
     
  20. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,112
    Hey again @raoul

    So I tried using i-connector and other methods to transition from 2 to 3 lanes (or more). It's still unclear to me how I would use a custom mesh to do that. Could you perhaps explain the steps involved or link to a video that showcases that? Again, I am trying to transition from/to different road types (2, 3 and 4 lanes).

    Thomas Transition.png
     
    christian-l likes this.
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Sorry that is in EasyRoads3Dv3Editor

    using EasyRoads3Dv3Editor;

    or

    EasyRoads3Dv3Editor.EREditor.GetSelectedRoad();

    Thanks,
    Raoul
     
  22. raoul

    raoul

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

    Because of the line pattern and the shape of the lane transition, that is not something that can be done with the I Connector.

    Indeed this is something for the custom prefab system at the moment. The transition can be modelled and imported in the system through the Custom Prefab window where connections can be assigned.

    http://unityterraintools.com/tutorials/custom_crossings.php

    A quick way to get a feel off this system is by testing it with a Unity plane primitive positioned at (0,0,0). Just like in the video, add connections in clockwise direction.

    Thanks,
    Raoul
     
  23. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    So I tried out the snippet you posted and I can confirm that this code works for me as well. However, this seems like a very inefficient way to create a connection between two different road types with a script, as I would have to create my roads, change the roadtype to match, join them, then cut them apart and reapply the correct roadtype. Especially because an I connector seems to be, in essence, not that different from normal crossings. I would rather create my roads with the correct roadtype from the start, then create an I connector to connect them.
    While thinking about this, is there a way to set the connector distance with a script for an I connector?

    Kind regards,
    Christian
     
  24. raoul

    raoul

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

    Your first post related to the I Connector didn't mention different road types. Using ERRoad.InsertIConnector(); an I Connector can be inserted anywhere along the road. The scripting API is mainly build on what we need and the requests we get. InsertIConnector() was added at the time upon request to automate cutting road objects in two road objects on terrain chunk edges for streaming terrain chunks and the corresponding road objects.

    That said, it can also be used for different road types. If the second road not already exists, the same code can be used , the newly created road is returned. After that SetRoadType(ERRoadType roadType); can be used to change the road type of the returned road.

    But InsertIConnector() can also be used at the start or end of the road. And actually, your code appears to work fine here on our end. The I Connector is inserted and both roads are attached. Both roads update without error after manual changes. This is tested in both v3.1.8 and the v3.2 beta

    Thanks,
    Raoul
     
  25. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    Using two different road types was something I did not mention in the first post, as it did not seem to relate to the issue at hand, which also appears for the same road type.

    Thanks for taking your time with me. I have attached a video how it looks on my end. Ihave uploaded a video of how it looks on my end:
    In the video, I show the code, then I execute it. When I move the I connector around, only one road moves with it, the one it is attached to. It shows the second road as being connected, and I have to disconnect it before being then able to connect it. After manually connecting the second road to the I connector, it works as expected.

    Kind regards,
    Christian
     
  26. raoul

    raoul

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

    In the video the I Connector is selected in the hierarchy when moved. Although this should be fine, does the same problem occur with the Road Network object selected and selecting the I Connector through the yellow handle?

    Also, at 0.27, the road marker is actually positioned at the connection handle. At that point you move it away which will disconnect it from the I Connector. What happens when you move another marker of that same road? Does the road update while still attached to the I Connector

    At the end of the video after the marker is attached to the I Connector again everything appears to work well.

    Thanks,
    Raoul
     
    Last edited: Jul 30, 2019
  27. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Hi Raoul,
    I have a quick question. Is there a possibility to add side objects to custom connection prefabs with ER Editor?
    Thanks.
     
  28. raoul

    raoul

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

    Do you mean add side objects through the system just like for roads? That is not yet possible. It will be possible in v3.3. What type of side objects are these?

    What is currently possible is:

    1) Add an instance of the custom connection to the scene at (0,0,0).
    2) Add the side objects to the scene as a "side object" object (no road involved) aligned with the custom connection added in 1).
    3) Export these side objects to .obj to the project folder. Inspector selected object> "Side Objects" section > selected Side Object > Foldout > "Export Side Object" button.
    4) Add this .obj as a child to the specific Custom Prefab in "/Assets/EasyRoads3D/Resources/custom prefabs/"

    New instances will now have the side objects as childs part of the custom prefab.

    Thanks,
    Raoul
     
    Last edited: Jul 30, 2019
    Meceka likes this.
  29. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    I was already out of the office last night. Moving the I connector using the yellow handle looks the same. I also tried to move the I connector using code, which moves road 1 and the handles, but the second road does not update. An exception is being thrown in that case:
    Code (CSharp):
    1. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2. Parameter name: index
    3. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    5. System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    6. EasyRoads3Dv3.ERModularRoad.OCQQODOQOD (System.Boolean ignorePrefabAlignment, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    7. EasyRoads3Dv3.ERCrossingPrefabs.OCOOQDDODC (System.Boolean ignorePriority, EasyRoads3Dv3.ERModularRoad road) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    8. EasyRoads3Dv3.ERConnection.SetPosition (UnityEngine.Vector3 pos) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    9. BreakER.BreakIConnector () (at Assets/Aperol/Scripts/Editor/BreakER.cs:32)
    However, moving a different handle from the second road leads to the road mesh attaching itself to the I connector correctly. After that, everything works as expected. I can force the same behaviour if I move a node with a script or even by just calling the Refresh() method of the second.
    So the problem script from further up is fixed, by simply adding a r2.Refresh() at the end:

    Code (CSharp):
    1.     [MenuItem("EasyRoads3D/Break I Connector")]
    2.     public static void BreakIConnector()
    3.     {
    4.         ERRoadNetwork network = new ERRoadNetwork();
    5.         var roadtype = network.GetRoadTypeByName("Default Road");
    6.         List<Vector3> markers = new List<Vector3>();
    7.         int scale = 10;
    8.         int numMarker = 5;
    9.         for(int i=0;i<=numMarker*scale;i+=scale){
    10.             markers.Add(Vector3.right*i);
    11.         }
    12.         ERRoad r1 = network.CreateRoad("Road 1", roadtype, markers.ToArray());
    13.    
    14.         markers = new List<Vector3>();
    15.         for(int i=numMarker*scale;i<=2*numMarker*scale;i+=scale){
    16.             markers.Add(Vector3.right*i);
    17.         }
    18.         ERRoad r2 = network.CreateRoad("Road 2", roadtype, markers.ToArray());    
    19.         ERConnection conn;
    20.         r1.InsertIConnector(numMarker, "I Connector", out conn);
    21.         UnityEngine.Debug.Log(r2.ConnectToStart(conn, 1));
    22.         r2.Refresh();
    23.         conn.SetPosition(new Vector3(scale*numMarker, 0.0f, 5.0f));
    24.     }
    Maybe this behaviour should be documented?

    Kind regards,
    Christian
     
  30. raoul

    raoul

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

    So the second road by itself updates fine.

    Does that mean that moving the I Connector also works well after updating road 2 manually?

    This is not how this should work and a second road refresh could also be added to r2.ConnectToStart(conn, 1) if an I Connector is involved. But this road will already be refreshed anyway or do you still get error messages when running the code to Insert the I Connector? Do you have the same problem with an X or T crossing using similar code to attach road 2?

    Thanks,
    Raoul
     
  31. Jbs_GameZone

    Jbs_GameZone

    Joined:
    Dec 14, 2018
    Posts:
    102
    Hello Raoul,

    How can you increase the scale of the guard_rail_prefab ? I've tried modifying the "Scale Factor" from Model import settings or the transform scale from the prefab itself (or from the guardrail object inside the prefab), none seem to make a difference in what EasyRoads3D generates. As a last resort I could edit in a 3d editor the guardrail mesh itself, but I was hoping there is an easier way than that.
    There are a number of settings that we can adjust from side object manager but they are mainly offsets and don't affect the scale.

    Here is the default size of the guardrail in comparison to the cars, I'm trying to make it twice (or even 3 times) as tall / big :

    Y-GUARDRAIL_ISSUE.png

    Thanks
     
  32. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    If you mean by update manually, move a different marker than the one the I connector is connected to, then yes, it works fine in that case as well.

    I do not mind running refresh in this situation in my code. So this is an okay state for me. I generate my T and X crossings differently, as I instantiate them explicitly before moving and aligning and connecting them to the roads. As far as I can tell, no problems like this occur. Moving the crossings manually correctly updates all attached roads. However I also use the ConnectToStart/ConnectToEnd methods for that, so they are not wrong in the general case I think.

    Kind regards,
    Christian
     
  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    In the video first the I Connector was moved, this resulted in the second road not updating. You already confirmed that moving a marker of the second road does update road 2 correctly. My question was if you can now also move the I Connector with road 2 updating correctly, or does that still fail?

    Yes, Refresh() sounds like a simple solution and good that that works, but it shouldn't be necessary :) so ideally it would be good to know what goes wrong on your end since we cannot recreate it. The cide you posted works well on our end.

    Thanks,
    Raoul
     
  34. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Thomas, @raoul ,
    This is something I am also looking into. As a future feature, I think this could be modeled if I connectors are changed by allowing the user to set Stretch Width for the left and right side of the I connector independently:
    upload_2019-7-30_10-52-52.png
    For the image Thomas posted, this would mean that the right side stretch width would be 1 for both roads and the left side would be > 1 for the smaller road and <1 for the bigger road. However, this would would not fix the problem with the lane markings, and I am not sure how such a setup could be realized in the context of ER3.
    I guess one way, which is completely different than the current setup, is to embrace using side objects for lane markings. In that case, the dotted line in Thomas image would be a side object with a fixed distance from the right side of the road. However this would change how every single road functions where currently the lane markings are normally part of the texture. In the demo scene, there is an example how to use side objects as lane markings.
     
  35. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539

    Hi @Jbs_GameZone,

    Are those the guard rail from the additional demo package? They do look small. These guard rails are scaled 1 Unity unit is 1 meter.

    The way this works is that the guard rail source model is split in a start / mid / end section in the Mesh Editor Window. After that the source model is no longer used that is why scaling the prefab up in the import settings doesn't immediately work.

    Please remove the source prefab for the Source Object slot and add it again. Then press "Open mesh Editor Window" and define the Start / Mid / End sections based on the new scale.

    http://unityterraintools.com/tutorials/side_objects.php#duplicate

    This tutorial is more regarding duplicating side objects, but it shows the guard rail and where the start / end sections are set.

    In v3.3. there will be a more scale option.

    Thanks,
    Raoul
     
  36. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    This is what is looks like on my end with an added r2.Refresh() Please ignore the other code in the script file, that is a new thing I am working on.

    You can see that the I connector is created and can be moved around freely with both roads being attached to it. Moving markers of the road also works perfectly. So I am unaware of any problems remaining.
    I will try to recreate this problem in a blank project.

    Kind regards,
    Christian
     
  37. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Yes, that is what I see, everything is functional after running the code. I cannot clearly see the code so I am not sure if this is with the additional r2.Refresh()?

    Thanks,
    Raoul
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539

    Usually generating the geometry is not the problem here. Getting the UVs right etc. is the problem. For this additional texture info is required. V3.2 does already have more options to define the texture profile. With motorway on/off ramps coming there will be more options. With that info it will also be easier to indeed extend the I Connector options with proper lane count changes or support this directly on the road object without an I Connector being necessary.

    Indeed the alternative is to use side objects for lane markings but there will still be significant stretching in the asphalt texture.

    Thanks,
    Raoul
     
  39. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    I think you have to open the video in a new tab/window to get the full resolution. The embedded players makes it very hard to read. This is with the added Refresh in my code.
    I just tried to reproduce the issue in a new project and there the error does not occur. So I will just chalk this one up to having a messed up version of EasyRoads in my current project, as I have imported the asset from the asset store, tried out the demo scene and then imported the beta of EasyRoads. Somewhere in these steps, something probably went wrong.
     
  40. raoul

    raoul

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

    Yes opening the video in a new tab does show it in full resolution.

    In which version were you originally testing this? Yesterday I tested the code in the latest v3.1.8 and v3.2 beta without problems.

    Thanks,
    Raoul;
     
  41. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    I am running the latest beta (6). But in a new project, though the setup seems to be the exact same as in my actual working project, the problem disappeared. I tried to reimport the asset in my actual project, overwriting all files, but the problem still persists. As I can easily work around it, I do not mind the current state though.

    Kind regards,
    Christian
     
  42. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    It is strange, I guess it is not critical but to sort this out you could send us perhaps the project in which this issue persists?

    Thanks,
    Raoul
     
  43. Bogat

    Bogat

    Joined:
    May 26, 2017
    Posts:
    25
    Hello! I made a fence, but I just can’t achieve a normal smoothing of the object! How can you make a smoother seamless surface?
    Below is a picture of the problem. guard_11.jpg guard_12.jpg
     
  44. raoul

    raoul

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

    The demo package includes a very similar guard rail side object. But the name of this side object name is GuardRail1 so it seems it is indeed a side object you created.

    The "Smooth Normals" checkboxes are indeed what controls this, there are no known issues with that.

    Do you have the same problem with the guard rail in the demo package?

    Is this the model from the demo package? If it is yours, perhaps you can send it to use so we can test on our end?

    Thanks,
    Raoul
     
  45. Bogat

    Bogat

    Joined:
    May 26, 2017
    Posts:
    25
    I took your model from the package, the model name is "guard rail". In the standard scene, everything is fine! Version of the roads 3.1.7.1
    I will try my model!
     
  46. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,539
    Does this only happen with this model or also other models like the concrete barrier? And does the same happen when using the original Guard Rail side object?

    The standard scene, is that the same project and same version of EasyRoads3D? It is always recommended to use the latest version. Or perhaps only test this in a copy of the project using the latest version if you prefer that.

    Thanks,
    Raoul
     
  47. Bogat

    Bogat

    Joined:
    May 26, 2017
    Posts:
    25
    Here are the pictures my model still goes wrong! The model itself is attached! quard_14.jpg
    https://cloud.mail.ru/public/KHbZ/221GvLL6c
     
  48. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    44
    I am getting the following error in the console:
    Connector Warning: two lower priority roads of different type next to each other. This is not yet supported

    Followed by:
    Connector Warning: No Connection Match found on the left side
    Connector Warning: No Connection Match found on the right side

    What does that mean and what do I need to do to fix it? I'm presuming it is from the new flex connector I just spent the last hour creating to replace the previous one that seemed to have forgotten it was a flex connector as I could not connect one of the 3 roads to it and it was not showing the green handle for dragging out a road from the third, unconnected, connection.
     
  49. raoul

    raoul

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

    Thank you for the fbx.

    The post inside the red circle in your image breaking through the rail is another topic. The model has a setup with start / mid /end sections with two posts at the start / end edges and two more posts in the mid section. The rail itself has no additional detail between the start and end edge, all triangles start / end at these edges. The procedural side object type will generate the shape along the spline shape adjusting all vertices according the spline position at that point. Because there are no guard rail vertices near these additional two posts these post will not exactly match the guard rail in curves. while each full guard rail section will be positioned in the direction between the spline positions at the start and end. Does that make sense?

    Regarding smooth normals, toggling this on/off there is a difference noticeable. There are some vertices quite close to each other. The system uses a small offset to make sure vertices at the start and end can be matched even when they are not exactly at the same position. It seems this is interfering and the vertices for averaging the normals are not matched correctly. I will have to look deeper into this and see if this is indeed related.

    Thanks,
    Raoul
     
  50. raoul

    raoul

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

    Yes, this Flex Connector v3.2 beta related. In v3.2 the type of road can be set in Road Types. For example Motorway, Primary Road, Secondary road.

    When different road types are involved in a Flex Connector, roads with less priority will be attached to roads with an higher priority. Between Primary and Secondary road types, the primary road type will continue, the secondary road type will be attached.

    In this example, the message you get means that currently it is not possible to connect two secondary roads at the same side of the primary road. There must be a primary road attached to the Flex Connector between the two secondary roads. The reason for that is that Primary road > Secondary road > Secondary road > Primary road requires a different type of triangulation where somehow the two Secondary roads also connect.

    Thanks,
    Raoul