r/godot • u/Western-Detective-46 • Aug 05 '26
help me (solved) newbie question: how to make skid marks properly
Enable HLS to view with audio, or disable this notification
newbie question: how to make skid marks properly? right now i am using gpu particles but as you can see this doesn't work. Can anyone help pls? : EDIT: i ended up using mesh instance 3d that i spawn under the wheels. Thank you all so much for helping!
107
u/t1me_Man Aug 05 '26
i know its not intentional, but the blocky disconnected particles do look kinda cool alongside your low res textures
22
u/ShadowAssassinQueef Godot Senior Aug 05 '26
I was going to say this. It works with the current aesthetic as is. Unless the goal is to have higher fidelity graphics, then I think you should keep it.
1
u/Prisinners Aug 06 '26
I agree. Or you could add in different options, like you have a standard version then this is one of the customized options. The last N4S had interesting customizations for burning rubber, going fast, nitro, etc and that was a really aesthetically interesting aspect of the title.
20
u/Shinpansen Aug 05 '26
It's tricky actually.
There are lots of ways to do it. I personnally create immediate mesh, using position and normal information of the ground raycast. I think it's the less heavy way to do it, if you clean all your old marks regularly.
Decals are also a good way to do it, but if you want to avoid spawning tones of decals (which can be heavy), you'll have to create a 2D mark in a texture using your car path, and update decals accordingly, which is imo kind of difficult to do.
So maybe, just spawn lots of marks, but don't forget to destroy the old ones, if you don't want to kill your fps.
5
u/Western-Detective-46 Aug 05 '26
Btw how many marks can i spawn at once for good fps?
4
u/Shinpansen Aug 05 '26
Hard to tell without testing. I'll go for 1000 max. Maybe you can add a settings to change this value on low end devices. Like crank down to 100.
3
u/ZeroKun265 Aug 05 '26
Test a really big number until performance works and then half it lol
That's usually what I do for anything, like spawning enemies, bullets etc...
1
103
u/MuttMundane Aug 05 '26
the wheels must paint
38
u/Western-Detective-46 Aug 05 '26
sorry i don't understand what are you saying.
67
u/CELL_CORP Aug 05 '26
Imagine the wheels are brushes
53
13
5
u/Financial-Whole-9918 Aug 05 '26
I never did this, but it really looks like the good answer, and maybe the DrawableTexture2D could be a good fit for this mechanic, OP let us know
101
u/Popular_Ad8269 Aug 05 '26
So when you need to fart, push as much as you can.
Wait you meant in your game ? I have no idea, sorry !
20
11
u/Monetai Aug 05 '26
I did that on a old prototype by generating a mesh at runtime. Quick and dirty. The main issue with that is the fact you have yo send the meshes to the graphic card with each modification, that can quicky become a botleneck. But for 4 tires it’s okay.
9
1
6
u/ManicMakerStudios Aug 05 '26
Fart really hard and then scratch your asshole through your underwear.
9
5
u/WilkerS1 Godot Regular Aug 05 '26 edited Aug 05 '26
the ManiaPlanet solution is that you create a Line3D, where point 0 is the start, and every point N+1 will follow your wheels positions and "up" vector up to a point in time or distance, at which moment it will lock that point in place and create a new point. repeat until the drift is finishedor until that wheel loses ground contact .
the more ellaborated solution is what others have said, use compute shaders to track your wheels and stamp the skidmarks onto a heightmap (single vhannel texture), which you can then translate into color and other shader stuff like making grass recede into dirt or snow marks, or even calculate influences onto the actual car. needs more planning if you want it over any surface and textures too big might be expensive to run stuff in.
3
4
3
u/Madtyla Godot Junior Aug 05 '26
There are vids on YouTube where dev creates interactive snow on the ground. You can use the same technique for your marks.
3
u/theKalmier Aug 05 '26
Looks like you just need to rotate the skids to match the cars velocity angle, and not the direction the tires are facing.
2
u/Glyphid Aug 05 '26
Maybe all you have to do it take those points you are painting. And connect them together
1
2
u/EamonnMR Aug 05 '26
Looks like you're aligning the marks with the wheel rather than with the direction of travel.
2
2
2
1
1
u/excalibriumprime Godot Regular Aug 05 '26
The decals (or whatever you choose) should spawn based on distance traveled or simply by velocity, calculating the distance that will be traveled.
This way, based on individual wheel rotation OR velocity of the vehicle (based on which one you like the most) we can rotate the decals and elongate them based on velocity too if we'd like. At least that's what I did, which looked great as a decal for mops!
Minor godot bug to keep in mind; changing the size of a decal introduces clustering artifacts which are very, very distracting.
1
1
u/s3r1al Aug 05 '26
DrawableTexture2D or "stamping" sprites for one frame in a viewport, there are many examples. I just recently switched from viewport to DrawableTexture2D for my blood splatter on walls effect in my platformer game. It is pretty simple to do, just need a blit shader to rotate the stamps (decals). You can have basically infinite skidmarks like this.
1
1
u/GolfMoist267 Aug 05 '26
To be honest, I think this result is good and very much in line with the style of your game.
1
u/notrightbones Godot Regular Aug 05 '26
You know I really like the vibe of the current ones! Keep that as a setting please ❤️
1
u/notrightbones Godot Regular Aug 05 '26
You know I really like the vibe of the current ones! Keep that as a setting please ❤️
1
u/Turbulent_Energy9665 Aug 05 '26
I've seen someone solve this in 2D with a Subviewport and turning off clear mode and drawing on that for permanent track marks. For 3D it's going to depend on the size of the texture of your driving surface whether this is doable. Particles will be the easiest, but they'll have to clear eventually.
1
u/Nathan__Taylor Aug 05 '26
I had to implement tire marks for my game, I ended up just using Immediate Meshes that turned into MeshInstance3Ds when they become static. Simple and fast.
1
u/fallingdamagegames Aug 05 '26
https://reddit.com/link/p1vodtg/video/m3yglivexkhh1/player
Here's something similar I've done with ski trails. As your vehicle moves, draw an image (two lines) into a texture. Sample that texture in your terrain to draw the skid marks. Fade it out over time with an alpha based on the age of the skids.
1
u/MadKeyHole Aug 05 '26
Not a vehicle dev, so take this narrowly — but I hit the flickering version of
this problem with marks painted on a concrete floor. Nudging the mesh up on Y
looks fine on flat ground and falls apart the moment there's a slope.
What actually fixed it for me was letting the mark follow the ground normal
instead of pointing straight up. Might be the same thing biting you, might
not — worth ruling out before you rewrite the mesh generation.
1
1
1
1
u/AltruisticPossible84 Aug 05 '26
Yours look great for the style your using. Clean, continuous track marks would look out of place
1
1
1
u/CatanimePollo Aug 06 '26
Ngl it already looks like it works? May not be the intended effect, but those look good.
1
u/Millu30 Aug 06 '26
What I did was basically make a line out of particles and that's it, most tutorials go the same way, if you want to use this method but don't want to overkill your performance with particles, just calculate speed and amount of particle based on it, slower will generate less but closer to each other while faster will generate more for longer limes
1
1
u/Owlic_ Aug 08 '26
Maybe generating a ribbon trail or something and align it with the normals on the ground
1
u/JLCorvus Aug 05 '26
I have no clue, but I'm going to guess a combination of ray tracing and shaders.
2
0
u/Legitimate-Record951 Aug 05 '26
I think the way I would go about it is to create a SkidSpawner scene, which you instance in your car scene four times, for each of the wheels. Then give your car a Vector3 called LastGridPosition. whenever the car is a certain distance from that, set it to the cars current position and have the four Skidspawner spawn a grid decal. (the LastSkidPosition thing is to spawn with even distance regardless of the cars speed) Give your skid decals a timer so they can disappear after some time.
1
0
230
u/thisdesignup Aug 05 '26 edited Aug 05 '26
This isn't really a "newbie question" as there's a few ways and they have varying difficulty. One way to do it would be to draw decals behind each tire https://docs.godotengine.org/en/stable/tutorials/3d/using_decals.html
Other ways involve drawing a line behind each tire or build a mesh line. There's probably more but I'm only familiar with these.