Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Hi Raoul.

    Upon updating ER3D Pro to its new version, I got this error:
    Assets/EasyRoads3D/Scripts/ERVegetationStudio.cs(64,64): error CS0117: AwesomeTechnologies.VegetationStudio.VegetationStudioManager' does not contain a definition forRefreshTerrainHeightMap'

    Turns out the correct name for this method is "RefreshTerrainHeightmap" with a small m.
     
  2. lynx89_

    lynx89_

    Joined:
    Mar 1, 2018
    Posts:
    27
    Hello, I am building a big race track using the "Kart Track Barrier" sideobject for my mobile game.
    I really need to optimize it otherwise the fps are just too bad.
    For that reason i was wondering how I could apply a LOD group to those side objects in order not to see them when they are too far away.
    I have tried to apply a LOD group to the prefab used to generate the batches but it get removed in the final batches.
    I think I would also need to increase the generated batches, because 3 is just too low for a track that big.

    Any idea? Thanks

    p.s. You may want to change the default collider type from mesh to box for that kart track barrier object included in the demo project because it greatly helps performances and overall it's the same for the player :)
     
    Last edited: Mar 31, 2019
  3. fmarianacci

    fmarianacci

    Joined:
    Oct 15, 2018
    Posts:
    20
    Hi Raoul,

    Yes it is exactly the problem, we cannot keep connection between road/junction across different scene.

    Anyway we have to build a system to merge road in different scene.

    It's really something that is missing in EasyRoads. The ability to work with multiscene easily.
     
  4. raoul

    raoul

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

    Which versions of VS and ER do you use?

    The "m" issue was related to Vegetation Studio Pro. To keep Vegetation Studio and Vegetation Studio Pro in synch regarding this, the author confirmed to correct this. This was months ago, the issue hasn't been reported recently.

    Thanks,
    Raoul
     
  5. raoul

    raoul

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

    The side objects in the demo package are more intended for learning purposes. Indeed you can chose to use box colliders instead of a mesh Collider.

    Activating side objects along the full track on long tracks is something to be careful with regarding performance. One way to optimize this is to split the track in separate sections using the I Connector. This will also split the side objects.

    LOD options for side objects is on the to do list. Meanwhile the LOD Group can be created manually by exporting the generated side objects per LOD level. The "Export" option for individual side objects is available in the main side object fold out for the selected road and side object.

    Thanks,
    Raoul
     
  6. lynx89_

    lynx89_

    Joined:
    Mar 1, 2018
    Posts:
    27
    Thank you for the fast answer once again!
    Have a nice day
     
    raoul likes this.
  7. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    I'm using this with VS Pro but I get this error.
    Assets\EasyRoads3D\Scripts\ERVegetationStudio.cs(64,64): error CS0117: 'VegetationStudioManager' does not contain a definition for 'RefreshTerrainHeightMap'
     
  8. raoul

    raoul

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

    The same issue was mentioned by marcrem a few posts above. Please see my reply

    Which version of VS do you use? Has this indeed perhaps changed back to "RefreshTerrainHeightmap"? Note the small "m".

    Last week we updated the VS integration to support biome masks, we did test this with a fresh VS Pro import from the asset store, there were no errors like in your post.

    Thanks,
    Raoul
     
    ksam2 likes this.
  9. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    That's it. Solved thanks :)

    There is still one more issue I have that splat textures under roads doesn't work with CTS terrain shader. I mean it can't draw any splat texture under road. It worked before with RTP but can't make it to work with CTS.
     
    Last edited: Apr 1, 2019
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    What is the setup, how many splat textures etc.?

    The HD Roads demo uses CTS, baking the road shape in the terrain works just fine.

    Thanks,
    Raoul
     
  11. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    225
    I am having trouble getting EasyRoad3d to work correctly with VegetationStudioPro. the settings in easy road, dont appear to be updating the values in level.
    I have tried changing the grass perimeter on nodes and on road types, but the values used in the level in the component on the road never change from the default.
    any suggestions where i need to set the value or how i can get it to update the value?

    thanks
     
  12. raoul

    raoul

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

    After changing the values for road types the "Update Scene Instances" button near the bottom will update existing roads of that type.

    The option to change the values per road was added in the latest update. The problem here is in the code in /EasyRoads3D/scripts/ERVegetationStudio. The values will only update when the Vegetation Studio Mask Line component is added. It is a matter of moving this bit of code out of the if statement that adds the component in UpdateVegetationMaskLine().

    Code (csharp):
    1. if (vegetationMaskLine == null)
    2. {
    3.       vegetationMaskLine = go.AddComponent<AwesomeTechnologies.VegetationMaskLine>();
    4. }
    5.  
    6. vegetationMaskLine.AdditionalGrassPerimiter = grassPerimeter;
    7. vegetationMaskLine.AdditionalPlantPerimiter = plantPerimeter;
    8. vegetationMaskLine.AdditionalTreePerimiter = treePerimeter;
    9. vegetationMaskLine.AdditionalObjectPerimiter = objectPerimeter;
    10. vegetationMaskLine.AdditionalLargeObjectPerimiter = largeObjectPerimeter;
    This is done in the next update which also supports biome masks. v3.2 b4 will follow later today with these changes.

    Thanks,
    Raoul
    .
     
    Last edited: Apr 2, 2019
    sharkapps likes this.
  13. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    Hello everyone!
    I have a little problem when creating a custom crossroad prefab:
    TextureDifference.PNG BlenderMaterial.PNG
    As you can see i have created a modell in blender and i have given it three different Materials with different UV-Maps.
    Left you can see the model imported as an FBX and with the Remapped Materials attached to it.
    Right you can see the same model, after i created a custom prefab with the EasyRoads Editor.
    I have used a model from an earlier thread as a base and i haven't changed the Materials. (#5658)
    A earlier model I made was behaving fine, even though everything was the same:
    sameTextures.PNG BlenderMat2.PNG
    Any suggestions on what is wrong?
    Just as in blender: Everything is identical in Unity; Material and Shader-wise.
     
  14. raoul

    raoul

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

    Is this related to the darker prefab on the right?

    How does the prefab import in the Editor window? Do you have to apply a rotation? In that case it is also necessary to recalculate the normals and tangents.

    It is recommended to setup/import the model in Unity so Unity does not apply rotations to it. That way the original normal and tangent data can be used. This can be tested by dropping the original prefab in the scene. What are the rotation values in the Inspector?

    This is one of the reasons why we always use .obj. It tends to import better by default although you can probably also change this by using different fbx export settings in blender.

    Thanks,
    Raoul
     
  15. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    It worked by recaculating normals and tangents, thank you!
     
    raoul likes this.
  16. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    225
    good to hear, thanks
     
  17. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    v3.2. beta 4 is now available on our website

    This update includes code optimization for performance and uv / triangulation improvements for the Flex Connector. Support for Vegetation Studio Pro biome masks is also part of this update. This will also be available in the next v3.1 update.

    Please visit http://unityterraintools.com/v3beta.php for more details.

    As always please backup your project before importing the update.

    Thanks,
    Raoul
     
    JamesWjRose and cygnusprojects like this.
  18. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Hi raoul

    I recently started porting my project from an old ER version (v3.1.1) to the most recent (v3.1.6) and found out that when I select a road or one of its markers on the editor the 'color tint' of the selection is bright white and is really difficult to see the road as clearly as I saw it before, (look at the attached image to see what I mean).

    I've made a quick look up at the release notes in the asset store but I don't know where it was changed exactly. Is there a way to change the color tint of the selection? I've checked the road config but does not seem like it and both projects has the same options in Scene View Settings checked.

    Was this an aware change, why? It seems like less readable.
     

    Attached Files:

  19. raoul

    raoul

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

    An option to change the highlight color can be added, but there have not been recent changes to this and over here the roads look like the one in the top image when the highlight options are active in General Settings > Scene Settings?

    Does disabling these highlight options one by one make clear what is causing this?

    Does this look the same in the small main demo scene?

    Thanks,
    Raoul
     
  20. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Thank you @raoul for your quick response as always.

    After more tests, it seems it is related to Unity version instead of ER3D version, in the 2018.3.11 (probably in all 2018.3.x) the selection is much more whitish. Especially if in General Settings > Scene Settings > Scene View Settings I have Highlight Indents enabled.
    If you use a darker road material, like the Default Road it is more subtle, but if you use a lighter coloured texture like the bundled "GoodDirt ER" or ones from the demo project called "dirt flat.tga" it is very white.

    Using the package for ER3D v3.1.6 in 2018.1.9 and 2018.2.21 made the selection darker and bluish like the first screenshot of mine.

    With what Unity version did you checked? Were you using a dark road texture like the Default Road?
     
    Last edited: Apr 3, 2019
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    It could be this renders different in the latest Unity versions. But I cannot recreate the very whitish look in the bottom scene of the image you posted even with a more light dirt texture. This is what the highlighted surfaces look like on the default road type in Unity 2018.3.7f1.

    highlight.jpg

    I will make a note to make the colour of these surfaces editable anyway. I guess meanwhile rendering the Indent surfaces could be disabled, if these are causing the visibility issue.

    Thanks,
    Raoul
     
  22. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Ok I think I've been able to recreate it doing this:
    • Open main scene of the EasyRoads3D scenes folder
    • Select a point in one road
    • Change texture of the material to a lighter "dirt flat.tga" (for example), or create a material with that texture and apply to the selected road.
    • Disable the directional light already set in the scene
    • Add a new directional light, let its transform as is (leave the default values when you add one. The default values of directional light, lights it up more directly and is a bit more obvious).
    • Road should be seen as white as this:
    Unity2018.3.11-ER3Dv3.1.6.png


    Another view from the top:
    Unity2018.3.11-ER3Dv3.1.6-2view.png

    On the other hand when a default road is selected in this scenario it looks like this:
    Unity2018.3.11-ER3Dv3.1.6-4-darer-road-selected.png

    With the indent highlight disabled the whitish road looks a bit better:
    upload_2019-4-3_19-39-12.png

    That would be greatly appreciated.
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Editing the surface colours is meanwhile added and will be available in the next update :)

    Thanks,
    Raoul
     
    40detectives likes this.
  24. conceptdelta_unity

    conceptdelta_unity

    Joined:
    Mar 7, 2019
    Posts:
    3
    I'm using EasyRoads in a VR project where the camera is moved along the road "on rails".

    The ERRoad.GetPosition works great for calculating the camera position, but I wondered if there's anything built in to calculate the angle that the camera should be at to align the centre of the user's view with the centre of the road?

    Thanks.
     
  25. raoul

    raoul

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

    Are you using the latest v3.1.6? Similar to how ERRoad.GetPosition works, have you tried:

    ERRoad.GetLookatSmooth(float distance, int currentElement)

    Thanks,
    Raoul
     
  26. conceptdelta_unity

    conceptdelta_unity

    Joined:
    Mar 7, 2019
    Posts:
    3
    Thanks for the reply. I didn't notice GetLookatSmooth before.

    I've given it a try and the issue I face is that the rotation change is "too smooth". This is for a cycling simulator, so speeds are relatively slow. When going around sharper bends the camera rotation is 'wrong' for what feels like an extended period before it comes back to the centre of the road.
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Another
    Another "approximate" way would be to subtract the previous position from the current position, or something along those lines based on ERRoad.GetPosition().

    Thanks,
    Raoul
     
  28. conceptdelta_unity

    conceptdelta_unity

    Joined:
    Mar 7, 2019
    Posts:
    3
    Thanks. Just using GetPosition 5 metres / units ahead and looking at that worked out well.

    Great asset and great support! I'll leave a review.
     
    raoul likes this.
  29. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    Hi Raoul,
    i am using v3.2.b3 version. I am creating roads and crossings at runtime, and then saving the Road Network game object as a prefab to load on next run time (or later on..). However, when I try to load the prefab then i receive this popup error:
    erroreaszRoad.PNG

    Also on the console, I receive these error log:
    Code (CSharp):
    1. EasyRoads3Dv3 Alert: [ref: SO01] Missing Side Object info, check the Troubleshooting page in the manual or contact us (do not save the scene!))
    2. UnityEngine.Debug:LogError(Object)
    3. EasyRoads3Dv3Editor.OOQQDCDCQQ:OODQCOCCOO(ERModularBase)
    4. EasyRoads3Dv3Editor.OQQCQCQDQD:OnEnable()
    I need to save the Road Network which is created at runtime. I thought it would be possible if it is saved as a prefab but i receive these errors. So how can I save the Road Network instead?
     
  30. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello unity_1koeCnkdY63yvw,

    Saving a standard road network as a prefab generally is not recommended, it will have complications. For example, prefabs require the mesh asset to be physically present in the project folder while unity stores procedurally generated meshes in the scene file. Doing this at runtime will have further complications.

    Can you explain more how this works? I mean, in order to create a prefab this must run inside the unity editor anyway.

    Thanks,
    Raoul
     
  31. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    Yes i am using the UnityEditor library.
    I am creating prefabs using the scripting API of the UnityEditor. This is how i save:

    Code (CSharp):
    1. Object prefab = PrefabUtility.CreatePrefab(localPath, obj);
    2.         PrefabUtility.ReplacePrefab(obj, prefab, ReplacePrefabOptions.ConnectToPrefab);
    this is how i load:
    Code (CSharp):
    1. var prefab = AssetDatabase.LoadAssetAtPath(localPath, typeof(GameObject));
    2. GameObject go = (GameObject)Instantiate(prefab, Vector3.zero, Quaternion.identity);
    And "obj" in this case is the Road Network game object in the scene.
     
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Yes, that is what I meant, in order to create a prefab it must run inside the Unity editor.

    But why exactly is the road network created at runtime inside the Unity editor? Can what you are doing not be done using editor scripts targeting an already existing road network?

    What is the final purpose of the generated road network prefab at "runtime"?

    Thanks,
    Raoul
     
  33. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    Hi Raoul,

    I am creating roads and crossings at runtime via scripting API then I want to save the road network that I created at runtime. I have to create the roads and crossings at runtime. So i tried to save and load this road network that i have created at runtime as a prefab but I received those errors that I have mentioned before. The main purpose is save the created road network at runtime and later on load this road network. Like in a city building game, where i created a city with roads, saved it and can load it at a later point in time.
     
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The scripting API also works inside the Unity editor, not at runtime. Or is there another reason why you have to do this at runtime? The same code can be used, the road network constructor will create a reference to the existing road network object if a road network object already exists.

    Thanks,
    Raoul
     
  35. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    I have to do this at runtime, because i am making something like a Road Building simulation. I have to create the roads at runtime via scripting API, because it is a requirement for the game. I am not creating the roads on Unity editor at runtime, but I am creating them via your scripting API. I am only using Unity Editor API to create the prefabs, as i have no other way to do so. Because PrefabUtility is a class of UnityEditor. "https://docs.unity3d.com/ScriptReference/PrefabUtility.html"
    I dont understand this part:
    .
    I am already referencing the road network object which is on the scene but I need to save this referenced game object to use / load it again later on.
     
  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Ok, so you want to be able to load prebuild road networks in your game at runtime in game. How does this relate to cerating these prefabs at runtime inside the Unity editor?

    It very much looks like you want to avoid creating the road network at runtime and save to a prefab inside the Unity editor. Why does this have to happen at runtime? What are the steps you take at runtime before saving to prefab?

    The comment I made regarding the constructor was purely related to using the scripting API in editor scripts on an already existing road network in the Unity editor, no runtime road network creation involved.

    Thanks,
    Raoul
     
  37. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Hi @raoul, I think @unity_1koeCnkdY63yvw is allowing the gamer to generate roads in the actual game with the underlaying idea that when the gamer does load a previous game the roads are there again. I wouldn't bother to go the create prefab way in such a case either (technically to complicated), why @unity_1koeCnkdY63yvw doesn't you regenerate them when needed? Store the actual data needed to generate the roads in your save game rather than the resulting mesh. That would be my approach in such cases.
     
  38. raoul

    raoul

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

    I now see the roads are NOTcreated at runtime inside the unity editor, but they are created through the scripting API and PrefabUtility (editor class) is used to create the prefab. That is the confusing part here for me :), how are they created?

    In any case, to avoid having to use prefabs at runtime and when already existing road networks are involved that must be editable at runtime, what could be done is save the road network objects in separate scenes and load these scenes additive to the current scene. The road network and scripting API will be fully functional at runtime.

    Thanks,
    Raoul
     
    Last edited: Apr 4, 2019
  39. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    I am trying to register on the unityterraintools website with my serial number to gain access to the 3.2 beta. When I try to register nothing happens, the wheel spins and registration never goes through.
     
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello b1gry4n,

    If you already have a serial number it is not necessary to register, you can download using that serial number. Otherwise, could you please contact us and pass your asset store invoice number?

    Thanks,
    Raoul
     
  41. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    22
    Hello @raoul and @cygnusprojects,

    Sorry for the late answer.

    it is precisley as @cygnusprojects said and i took the advice to heart. I wanted to maybe have a simpler solution than to serialize the road network, so i tried different approaches.
    I have tried the scene method that @raoul suggested. The scene method works great to generate save states on runtime, but the issue is: i can't really make them into save files, that i can load after runtime is over and i start up the game again. So i will have to serialize the road networks and save the underlying info to construct them, as suggest by @cygnusprojects .

    Thank you for your input!
     
  42. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello unity_1koeCnkdY63yvw,

    Because you mentioned PrefabUtility I thought the initial issues you posted were happening inside the Unity editor.

    Indeed the suggestions made by @cygnusprojects for the runtime part, saving changes to the road network at runtime to file and rebuild the road network on the next start up, should work.

    Thanks,
    Raoul
     
  43. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    Do you know when you plan on adding lane merging, turn lanes and off ramp features? I saw a post from 5 years ago where you said these features are being worked on
     
    Last edited: Apr 7, 2019
  44. raoul

    raoul

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

    Off ramp features will be part of the final v3.2 release.

    A full implementation of lane merging and turn lanes is not scheduled yet. But the road shape can be adjusted per marker and line markings can be added as side objects. These two can be used for lane merging and turn lanes. Another way is transition meshes imported into the system.

    Thanks,
    Raoul
     
  45. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    That is it. This very issue had happened to my Unity project, too. Once I hit the build mode and then returned back to the edit mode, the issue has faded away.

    BTW, once again thanks for this amazing asset. It is a must-have one for any city design for Unity.
     
  46. fmarianacci

    fmarianacci

    Joined:
    Oct 15, 2018
    Posts:
    20
    Hi Raoul,

    We have a lot of sideobject on our project. We want to manage wich sideobject cast shadow, how can we do that if our sideobject is not a prefab ?

    With sideobject prefab we can do that by setting the shadow directly on the prefab, but with 3d model sideobject I don't see how to do that..

    Thank you
     
  47. raoul

    raoul

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

    I assume you already have the Custom Prefab Editor window before switching to Build Mode? Because when the road network is in Build Mode, the toolbar should be locked to the middle "mountain" Build terrain tab. The Custom Prefab Editor window is opened from the General Settings Tab.

    Thank you!

    Raoul
     
  48. raoul

    raoul

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

    Indeed the Mesh type of side object instantiates the source prefab as it is. So indeed, controlling the cast Shadows state can be done by creating a prefab from the original imported model and assign the prefab as the Source Prefab.

    Or do you mean "Cast Shadows" is not an option for the "Procedural" side object type? I had a look and indeed this is not an option. It is for the "Shape" side object type. This can be added to the Procedural side object Type too. Meanwhile, as a quick fix, you can select the Shape type from the dropdown, set "Cast Shadows" to the desired state and switch it back to a Procedural side object type. That works, I just tested it.

    Thanks,
    Raoul
     
  49. fmarianacci

    fmarianacci

    Joined:
    Oct 15, 2018
    Posts:
    20
    Ok thanks Raoul :)
     
  50. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    Yep, I have a separate Custom Prefab Editor window which is always open.

    BTW, I noticed the thumbnail generation is not working okay. It was okay until I added more custom connections and now randomly some of the thumbnails are not showing. I wonder how to could fix it - Image below.
    ERTP.png
    FYI: This is the latest ER but it used to happen in the previous versions too, Also note that when it loads/generates the thumbnails, it does load all the thumbnails but at the end, it will show blank thumbnails randomly as shown above.
    With that said, when I delete my custom prefabs from the "Custom Prefabs" folder of EasyRoads, everything goes back to normal!!
    EDIT: After I deleted my custom prefabs from the folder, I decided to restore the files one by one I noticed that the problem never showed up until I after restoring the 13th file, the problem reappeared. So if you have all the add-ons and demo files, if you add 13 more connections the problem starts to occur, apparently.
     
    Last edited: Apr 8, 2019