-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Road addnodes too sparse or to dense flips the road upside down #240
Comments
all the road, if all the nodes are added at once |
Hello Gianluca, I don't see the road being flipped upside down in your example, but there are glitches (folding and maybe material mapping problems). You can inspect the road a bit better if you go into the World Editor (press F11) then at the top, select the Decal Road Editor. Your points are not monotonous in the X dimension (the first 5 go left, and the rest go right) - this describes a very sharp turn, since the Y value does change, but this may explain the 'folding' appearance. The road tool is not perfect, and this pushes it quite stiff. Also - it is probably better to create the mesh before laying the decal road on top of it (although I am not sure this matters from BeamNGPy tbh). The internal tool which creates the roads has some known issues which we are working on (it is very old), so for now it would be best to keep points from being too close together, and to avoid very sharp turns. You shouldn't need to put points that close together anyway - internally, a spline will be fitted to them, so any detail at that resolution would likely be lost in this process. Dave |
You could try running a pass over the points, whereby if two consecutive points are too close (eg < some epsilon) then remove the 2nd, etc. To increase density, you could start adding midpoints. We do this kind of thing sometimes. Dave |
ok thanks, hoping for a correction of the bug in future versions |
some updates: I've done some test to better understand the cause of the problem, here are the test and analysis github.com/gianlucafabris/BeamNGpy - Road test, hoping this might help you |
Hello @gianlucafabris, |
yes, those roads do not have the artefact
from this analysis seams that there is no correlation with artefact and sparse/dense and also radius of curvature, although visually seams due to a tight radius of curvature (inner spline intersects itself - meaning that the curvature radius is too tight) I hope I was clear enough |
Hello Gianluca, Folding issues frequently occur when using 'decal roads', which can lead to UV-mapping errors during rendering. Unfortunately, these limitations are inherent to the current implementation, and we do not have a workaround available at this time. The core of the issue lies in the way decal roads are defined: they are essentially polylines with width values assigned to each node. While this is a straightforward approach, it oversimplifies the complex structure of a road. A more sophisticated method might involve independently managing the left and right edges of the road or re-triangulating the geometry to prevent overlapping and folding. Best, |
Btw - you might also notice some strange tangent problems in the road - especially at the start and end. This is a known bug. I don't see it in your image, though. For decal roads, we fit standard Catmull-Rom splines through the given nodes, but these splines are not the most stable. We will get to fixing it at some point, but not likely to be in the immediate future. |
Regarding the broader challenge of importing OpenStreetMap data: I've experimented with this in the past but encountered inconsistent results. OSM roads are represented in a graph-based format, where all roads converge at a single point at junctions. However, real-world junctions are more complex, with lanes merging into each other rather than meeting at a single point. To address this, you'll need to implement post-processing to adjust the widths or reconfigure the roads to better reflect real-world conditions. This is where I paused my efforts, as I found it difficult to achieve convincing results across various scenarios. Good luck. Let us know how you get on with it. |
thanks keep improving and keep up the good work👍 |
yeap, also noted this |
The mesh roads work similarly (same splines etc). There is a further problem when laying decal roads on top of them (ie materials). We generally do not use mesh roads (procedurally-generated meshes) - they are quite primitive and very costly with respect to the number of triangles, nor do they use optimisations like level-of-detail (LOD) or occlusion (the other 'static' meshes and decal roads that you see on the maps do this). For this reason, it isn't completely supported internally as a way for creating driveable roads, so problems with them are more than likely. Regarding OSM: I was able to import the roads and project them, despite them being strange at junctions. I also imported real-world terrains from OpenDEM (https://www.opendem.info/opendemsearcher.html) and combined them with the OSM roads. This worked pretty well, although it took a bit of work to get the projections correct, and there was some <3m error there when lining up the roads and the DEM. |
great |
It is not so much that the road is flipped - the code which handles the tyre grip just detects the bottom surface as well as the top surface and it gets conflicted (probably this gives opposing force vectors or something like this - not sure exactly). The road meshes can technically be used, eg as in the road architect tool (very soon to be updated) or the track builder tool (which both use procedural meshes). With the road architect tool, it is unfortunately very easy to run into issues when trying to lay decals on top of meshes, although it is possible if enough care is taken. As long as the meshes are about 0.4m deep, they should be drivable, and its possible to put camber and incline into the roads. There is no python end for this though, and it is unlikely there will be since it is a very visual tool. However, what is often a better solution is to generate or import a terrain, then lay roads onto it, which will 'terraform' or sculpt the terrain. Tools to do this kind of thing will be released shortly. Best, |
Creating Road with addnodes and a set of nodes too sparse or to dense flips the road upside down.
This issue affects all the road or part of it, this can't be fixed with flip_direction=True.
The text was updated successfully, but these errors were encountered: