I'm currently working on implementing a trail system and I have the basic stuff working. A moving object can specify a material, width, life time, and time based curves for evaluation of colour and width. For each trail point I generate two vertices, trail point is center, vertex A is offset "left" and vertex B is offset "right", half width each. A setting for minimum distance between two trail points determines how spread out they are. This works nice until width and turning angle are so "close" that one side of trail triangles starts overlapping and in case of additive shading causes ugly artefacts.
So. I'm now playing with ideas on how to solve this:
- do some vertex detection magic and check for overlapping, maybe discard overlapping vertices or move them close by
- push both vertices on one side of trail, ie: A = point, B = point + width (instead of A = point + half_width, B = point - half_width), but I yet have to figure out how to detect that I need to do this
And other solutions or tips?
Forgot to mention, I'm doing mesh generation on cpu side.