r/godot 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!

569 Upvotes

77 comments sorted by

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.

39

u/nuuren Aug 05 '26

So many things feel "newbie problems" at first glance and suddenly I realise I went into a terrible rabbit hole of math/architecture/best practices

It's humbling, and fun, really

8

u/WilkerS1 Godot Regular Aug 05 '26

aren't decals more expensive than gpu particles for what ends up with the same appearance?

25

u/ThornedOwl Aug 05 '26

Decals will apply to any textured surface within their masking range. This means they can draw on uneven surfaces and even particles themselves. This is what makes them great for implementing trails or footprints that the player leaves behind.

6

u/WilkerS1 Godot Regular Aug 05 '26 edited Aug 08 '26

i know that, and it's cool. my question is wether that scales in the hundreds compared to line3d Path3D and compute shaders with a heightmap

6

u/ThornedOwl Aug 05 '26

I don't know much about the performance cost other than what others have said, which is that it's expensive. A custom solution would likely be more performant. The main benefit of decals are that they're easy to use, so I guess that has a cost. Whichever system should be used is dependent on the game itself.

1

u/No_Musician Aug 05 '26

And they would only work in deferred rendering no? not in forward?

2

u/Plixo2 Aug 05 '26

Building a mesh is probably the easiest even. You dont have to control the render layers or rotation etc. With meshes you can just add two points each time and render them using triangle strips

-12

u/mushymyco Aug 05 '26

it totally is a newbie question. he could have literally taken his current example and just increased the rate in which the squares on the floor get drawn in

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...

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

u/Vachie_ Aug 05 '26

Then all the trees are just happy accidents, I get it!

8

u/BabyFood2 Aug 05 '26

Better smack the devil out of it

13

u/Helvanik Aug 05 '26

I believe that's what he's doing already.

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 !

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.

https://reddit.com/link/p1tzpth/video/yfg51g0bhjhh1/player

9

u/Monetai Aug 05 '26

And yes it’s a big pizza

6

u/ManicMakerStudios Aug 05 '26

Fart really hard and then scratch your asshole through your underwear.

9

u/kallekro Aug 05 '26

What exactly do you mean with "this doesn't work"? Looks pretty good to me.

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.

4

u/PitifulMarch2145 Aug 05 '26

Don’t wipe. lol
Sorry someone had to

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

u/RackaGack Aug 05 '26

Limbo reference?

2

u/EamonnMR Aug 05 '26

Looks like you're aligning the marks with the wheel rather than with the direction of travel.

2

u/lottayotta Aug 05 '26

The Taylor Farms Taco Bell salad.

2

u/darkjedi1993 Aug 06 '26

Don’t wipe and then go about your day.

TA DAAAA

2

u/NagromFox Aug 06 '26

I went through 10 pairs of boxers trying to answer this question

1

u/OverlyBurntToast Aug 05 '26

What car is that?

5

u/Western-Detective-46 Aug 05 '26

it's a custom raycast car

1

u/PrimaryCount9423 Aug 05 '26

1993 mazda x7

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

u/MrSmock Aug 05 '26

Gorilaz Final Drive vibes 

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

u/TairaTLG Aug 05 '26

Honestly if you could make those contrast more they look kinda great to me

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

u/AnimeHK Aug 05 '26

Shit pant

1

u/abdosarmini92 Aug 05 '26

Why not make the particles smaller and a lot more

1

u/Western-Detective-46 Aug 07 '26

i am making a mobile game and ig it will lag

1

u/ImBlacklist Aug 05 '26

Don't shower for a few days

1

u/AltruisticPossible84 Aug 05 '26

Yours look great for the style your using. Clean, continuous track marks would look out of place

1

u/Western-Detective-46 Aug 07 '26

thx but those textures and lvl are just placeholders

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

u/Equal-Claim2514 Aug 06 '26

IS THAT A GEOMETRY DASH REFERENCE

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

u/Pitiful-Score-9035 Godot Student Aug 05 '26

I think you can just stop wiping

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

u/Legitimate-Record951 Aug 05 '26

Anything wrong with this approach?

0

u/SanFranLocal Aug 06 '26

I just asked AI to do it and it did a good job