• "Bwoah." - Generic Kimi Quotes.

# Bobs Track Builder - Progressive banking

Discussion in 'Bob's Track Builder' started by Brian Johnson, Apr 27, 2012.

1. ### Brian Johnson

Messages:
46
Ratings:
+2
Does anyone know a good way make progressive banking. I am currently working on an oval that is supposed to have 6 degrees on the inside, 9 degrees in the middle, and 12 degrees of banking on the outside in the corners.

2. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
Cross-section. You need to do some calculations but make the banking an even 9 degrees camber and calculate the outside/inside elevation difference. You need to make a lot of control points to cross-section to make the transition smooth. For ex 25m track width and using the parameters you describe you will need at least one control point per meter, that's 26 control points in total. Hard to describe with words but let's imagine there's only 12 controlpoints in the cross-section. First four would make the outer banking, the next 4 the middle and the last four for the inside. then i'd select all points from 1st to 6th and use the "align" function with 25% strength to make the first smoothing. Then select the controlpoints from 2nd to 5th and repeat align 25%.

If i remember, i'll make you a picture tomorrow, it's 04:00 and i need to go to sleep since i'm running out of beer.

• Like x 2
3. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
Ok, here's some screens to clarify what i meant. I noticed that i needed to do it a bit differently from what i described above to get the curve smoother. First i made a flat cross-section 10m in each direction. Then added the points until i got 11 of them, zoomed in as close as i could and moved the end points precisely, selected all points and applied 100% align to make them even distances from each other. The rest of the process is shown using 25% align in each step. You need to calculate the actual endpoints elevation, i used 50cm to show the effect more clearly.

End points raised:

Three points selected, 25% align:

Four points selected, align 25%

Three points again, 25%

6 points selected and the last 25% align

You may need to use different smoothing and possibly if i've selected four points and align it one more time to smooth it even more but i think this is sufficient to show the process.

4. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
There's one trick of how to find the 6 degrees and 12 degrees by using three track copies, all perfectly flat.. This method is not as accurate as calculating the profile but is intuitive and fast.

Make two copies from the original 9 degree oval track. Adjust the first copy to 6 degrees of camber and the second copy to 12 degrees. You should end up with two tracks forming a kind of X with original track sandwiched between. You have to lower the temporary tracks to get the actual profile you're after. Don't use those track copies in the final track, it's tempting but it will increase the GPU load and may cause bugs. I would use them only to find the two endpoints and use the method described above to smooth out the actual track. Delete the temporary tracks later. Change the texture of those temp tracks to show the three track surfaces more clearly...

Like this, the orange-white is the 12 degrees, the grey is the original and the red-white-blue is the 6 degree banking:

Messages:
46
Ratings:
+2
Thank you

6. ### FerrariMan96

Messages:
1,072
Ratings:
+134
I'm not sure about this, but could you potentially then edit the width of the tracks and line them up edge-to-edge so that there is little/no overlap?

7. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
Unwelded seams. If you weld them in 3DSimed or some other equivalent, then yes. You get either of these two with unwelded seams: a tiny gap between the panels, GPU friendly but ugly. Or overlapping panels, GPU costly and possible flickering in screen. If you overlap the panels, the GPU then will have to make new triangles on-the-fly. GPU can not process anything other than triangles (a face with three points and three edges) thus welded edges (triangle edge is shared) simplify the process significantly. There is some benefits too, you can create very complex shapes very fast but that's whole different thing. For ex imagine one triangle, parallel to the ground. Then push on triangle vertically thru it. GPU has to make a new edge from horizontal triangles two endpoints to the horizontal/vertical triangle intersection and repeat this for both the vertical and horizontal triangles ALL endpoint to ALL intersections increasing tris in the final count by 6 (2 tris vs 8 tris) If you weld them properly, you get the same 8 tris in this example but they are all premade and GPU just has to draw them. And when there are more than two tris overlapped, the situation quickly becomes very complex (a real life figure with 4 tris overlapping could become tens of tris that GPU has to create.. I'll try to make some kind of picture of this..

Slightly off-topic: i developed a method some time ago of quickly doing very complex road shapes. I got negative feedback and statement that it is very stupid. NO ONE explained why.. I could say, FU, just saying to a noob that a method is stupid without explaining is, well, stupid...I had to study half a year to understand why it was stupid.. I just tried to do it above, was it so hard to explain?

EDIT: BTB has no option of how to weld seams so we usually end up with a lot of objects pushed thru the ground, like wall that goes thru the ground. The game can accept some amount of these but with road and all driveable surfaces, those unwelded seams will cause minor inaccuracies in the HAT and increases its size significantly. When the is two different materials, like "rmbl" and "roada" overlapping, HAT can be even more distorted. Fortunately, those inaccuracies usually (almost everytime) is in the scale of millimeters or smaller so we don't have to think about them. But inaccuracy is inaccuracy, something that should not happen with digital information...

8. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
Ok, here's the pics:

4 panels (8 tris) with a gap:

Same with overlapping, unwelded seams:

Everythings looking honky-dory but the thruth is much nastier. The next picture shows how GPU has to remake new tris to complete it's task. It also shows how modeller need to the seams.

The backside shows the other side of the picture, literally. There are a lot of thrash. With welded seams, all those faces that are not showing at all, they are "deleted" from the package that gets sent to GPU. This is called culling and CPU does that for us (note! culling is done BEFORE everything is sent to the GPU for the picture to be drawn on screen...) Following picture represents the endresult with unwelded seams and after GPU has made all the new tris. The GPU does not do any culling after it has made all the corrections so it has to draw those unseen tris...

This is how the underside looks after culling with proper welding.

When you think that after GPU does all that new geometry, it has to apply those changes to UV mapping (how textures are mapped) with multiple shader maps, how HAT has to consider multiple materials intersecting and their feedbacks in that transition.... We end up with A LOT of unnecessary processing, lowering the overall perfromance in ALL levels of the process. Mesh filesizes is the only exception, that of course grows slightly but comparing it to the amount of unnecessary realtime processing....

So that's why the banking needs to be done with only one mesh instead of three. You save on everything in that case, file-sizes are smaller, fewer individual meshes, CPU power, GPU power, less RAM/VRAM usage etc...

We don't need to be concerned with objects going thru the ground, GPU has enough power to deal with that plus i think it has some nice methods of streamlining the process. But since the road is the most important part of track creation, it needs to be done optimally and with minimal amount of inaccuracies. There is some occasions where collision detection goes haywire with the same problem; unwelded collision surfaces where the object can shoot up in space (or gets stuck, pushed thru the ground etc) when it receives multiple collisions simultaneously happening in different directions.

Most of us bumb in to this phenomenon in some part of our "career". Most often it happens with sobjects, CK-Pits_and_barriers XPack for ex has some conditions where the tirewall does that (follow spline, drop object to follow the ground = stepped sobjects does that with properly made objects very often, even the Default XPack objects can be made to do this.....)

• Like x 1
9. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
Welding is long and arduous process but is one the most powerful optimizing tools... If only i had this information 2 years ago, i wouldn't get so many headaches of trying to find the reason for sudden and unexplained FPS drops... And work methods that were flawed from the start. The amount of rework i've since had to do..

10. ### neteye

Messages:
90
Ratings:
+22
serious and interesting information kennett, didnt know that seems like i did it mostly right from the beginning, as i did not have such problems.

what i just want to throw in is with the hat file, as i experienced the following some weeks ago: the Hat file seems to only look at the edges of tris and is only created there. with really big tris, in the middle of it i had always the problem that the car sunk into the ground, like it is when you forget the hat file entirely. would be cool if someone could verify this, or if its just me

greetings,
neteye

Messages:
4,695
Ratings:
+3,936
12. ### FerrariMan96

Messages:
1,072
Ratings:
+134
If BTB ever does make it to a final version, a feature at export to "weld all seams" or something like that would be great

Unfortunately, it does seem that BTB probably won't progress much from where it is now... Brendon has done a food job to get it to where it is though so thumbs up to him

• Like x 1
13. ### gazzari

Messages:
44
Ratings:
+8
It's easy Brian. Do some trig to calculate the angles.
Or I'll catch up to you and send a copy of what I do.

I dont seem to have your teamspeak any more.

14. ### Brian Johnson

Messages:
46
Ratings:
+2
Sorry its taken so long for me to reply Gazzari. I can meet up with you sometime on the SCE teamspeak or my teamspeak address is ts40.bargainvoice.com:7460

I am now working on another track that has progressive banking, but I'm running into an issue with doing the banking. The track has a max of 17 degrees of banking on the outside and zero banking on the inside, the track does not have different grooves though, the banking just curves from zero on the bottom to 17 at the top.

15. ### FerrariMan96

Messages:
1,072
Ratings:
+134
Unfortunately you can't do a proper curve in BTB, so I think the best you can do is have a cross-section image and make some reference points to work out where to put your panels.

16. ### gazzari

Messages:
44
Ratings:
+8
You can if you know how!

• Like x 1
17. ### Kennett Ylitalo

Messages:
4,695
Ratings:
+3,936
EDIT: damn, i just realized i made that pictorial in this thread.... So there is a way already explained and below you can fin another...Well, there's no vertical spline control but it doable. You need to use a lot of panels and use the aligning functions. By pulling the middle point down, then selecting it and all left side road panels, align all points in that crossection 100%. Do the same for right side to get a V shape. Select the three middlemost points and using 50% align (or 25%, you can always press it twice..)... I've got pretty smooth curves with that method. It's not accurate but it's smooth...

You can also do precise cross-sections manually.. First make a new XPack in XPacker. Then do a draft of how the curve should be, the most important info here is the amount of points and what materials each part uses. Then close XPacker, open BTB\XPacker\XPacks and the correct folder. Then locate the cross-section that you just created, it's a XML file. Open it in notepad and you can see the exact coordinated. Xand Y if of course only used, the Z axis is not used, AFAIK.. You can insert pre-calculated co-ordinates to get exactly what you want... This means that you need to calculate the coordinates yourself but then it's perfect..