A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Works In Progress' started by raoul, Feb 19, 2014.
That line along the road is really bothering. I use tga format. How to get rid of it?
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?
I use my own texture with your shader
Why can't connect with crossroad like the non HD road?
Used to see a green ball so that I can connect
And how can I reduce size of the crossroad to fit with other roads?
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.
Your road mesh with my own texture
Not like your demo scene, I don't see a connector when I create one.
I am trying hard to follow you as much as possible.
Can you please provide exact steps of what you are doing?
No custom prefabs available. That's why I cannot connect it to crossroad
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?
Red road is the HD road shader. I only change the albedo map
I don't use the previous shader anymore
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);
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.
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.
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)
after Deformation. X's show a few of the resulting "pits" under the intersections:
any ideas what I might be doing wrong?
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?
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?
I wanted to disable the updating of the terrain but that's solved. Thanks anyway.
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.
Raoul -- Thanks! -- these were the hints I needed.
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.
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.
Thank you, Raoul!
I make it!
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...
Can I fix it?
iMac 2019 mojave (Metal)
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?
>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?
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?
3) What are the Y position values of the individual crossing objects?
>And which version of EasyRoads3D are you using?
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?
Now, I understand what is wrong by seeing the demo scene.
When I make the crossing road(which is made with customized road type), it is made at outside of "Road Network" Object.
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.
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.
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?
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?
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.
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.
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?
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, it worked!
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.
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 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.
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.
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.
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);
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
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.
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.