Trail Renderer flickering?

http://justinallenpierce.com/spaceJunkweb.html

The bullets for the primary weapon in my game use trail renderer. Sometimes they flicker, sometimes they don’t. I’ve temporarily replaced them with particles so I don’t have flickering bullets, but I preferred how the trail renderer style looked.

Any idea why it happens and how I could fix it? Or a better way to get bullets that look like tracers (I know tracers are every 3-5 rounds IRL but I want every bullet to be visible)?

Try using stretched particles instead.

http://unity3d.com/support/documentation/Components/class-ParticleRenderer.html

Sorry for the late reply – have been working on other stuff.

I can’t seem to get stretched particles to show up and perhaps it is due to how my bullets move? They aren’t rigidbodies, so I guess they won’t stretch? I move them manually so I can raycast and get perfect hit detection.

I’m looking for something visually similar to this: http://upload.dfyb.net/uploaded/twisted-metal-heli-shooting-o.jpg

Stretched particles should be able to give a impression of tracer fire similar to the effect in your video. You may be having problems if the bullet particles are moving very fast (true bullet speeds are way too fast :wink: ). The impression of speed comes through strobing as much as anything else. Try enabling colour animation on the particle animator, setting all the colours the same and then setting the alpha value of alternate colours to 50% or even lower. Also, set the minimum and maximum energy to slightly different values and try adding a iittle bit of velocity scale (although too much will likely reduce the impression of speed).

Revisiting this problem again –

I notice trail renderer bullets flicker a lot more when there’s more to render otherwise – looking relatively open space helps them flicker less, but if I look toward the center of the map I don’t even see the bullets at all (until they hit something and spawn their particle effects).

Is this a bug or what? It’s sort of driving me crazy. Is there a way I can just give priority rendering to the bullets or something?

I don’t think I ever got stretched particles to show up – my guess is because my bullets aren’t rigidbodies so they don’t have velocity to base the stretch on.

edit: seems to help a great deal to increase the trail’s Time value to .1 or larger. Still some flickering though.

And on another note, trail renderer seems like a bad choice for a multiplayer game – seems to become unstable when used over the network (doesn’t crash or anything, but the trail is just all over the place).

I fixed the flicker by making sure that all the colors on the Trail Renderer component are not alpha = 0.
It’s flickering by design because alpha is transparent color.

Edit: Or no it’s still flickering but much less. It’s a bug maybe.

1 Like

Very late answer, but the solution is usually to increase the vertex count (not too much, just enough that there’s enough vertices to display the gradient)