Theory Behind These Uncharted 4 Bullet Trails

Started by
6 comments, last by deftware 7 years, 8 months ago

Hello everybody.

I'm trying to achieve a bullet trail effect similar to the one seen in Uncharted 4.
Specifically, the bullet smoke trail (not the tracer round).

You can see the effect on the attached files and here:



I don't believe they are using a Particle System, nor a Trail or Line Renderer for this. It looks like it is some kind of mesh which gets displaced in its trayectory. The effect can't be appreciated in all weapons, since most of them make all bullet trails follow an almost straight line. But some weapons leave a "wonky" trail, where the bullet kind of goes off its intended trayectory at first but then readjusts its direction.

People have mentioned using a disturbance field or turbulence shader.
I'm really new to shader programming and can't find a way around mixing examples I've seen around the web.

I'd really appreciate any kind of guidance tou guys can offer.

Cheers!

Advertisement

I don't know how they achieved it, but when people want thicker textured lines, sometimes they use long narrow quads.

Since the line gets distorted, imagine you had a collection of line-segments attached to vertices, with each segment actually being a thin quad.

As the wind blows on the bullet trail (or rather, as you randomly pertube the trail), you distort the line vertices in-equally, distorting the appearance trail. Further, you also fade out the quads to make the trail fade into non-existence, and don't forget the quads themselves can be animated (with subtle smoke animation).

You could look at ways to render lightning/electricity. I know it isn't the same, but the principles could apply. It generally involves calculating a line from A to B, and then perturbing points on said line, creating a chain of segments. You could do something similar for this random smoke trail, but instead of rendering line segments as brightly colored, you either render lines as cloudy smoky textures(which little by little lose alpha), or make some sort of path particle emitter, or a point emitter than moves really quick along the path.



I don't believe they are using a Particle System, nor a Trail or Line Renderer for this. It looks like it is some kind of mesh which gets displaced in its trayectory.
To me, it looks just like a particle system with a trail/line renderer, but immediately after spawning, the "smoke trail" starts deforming, with different particles in the trail drifting off sideways at different rates.
Try manually creating the smoke trail you want in a 3d modeling program such as blender first. Once you have figured out how to get the look you want manually, then try to write code to automate it.

If I had to guess how they made that effect, I would suspect they generate and manipulate a triangle strip with a texture/shader applied to it. Similar to a trail renderer but more customized.
My current game project Platform RPG

It appears that they are just using a quad strip particle effect and allowing the vertices to drift - this could be achieved by simply generating a single strip to submit to the GPU and then sending a time variable to the vertex shader which then randomly drifts the vertices while fading out the alpha. The goal here is to have the strip facing the camera, which is pretty simple to do, it's virtually the same as having a billboard face the camera. The texture coordinates of the smoke trail could also be allowed to drift lengthwise down the strip at a decelerating speed whilst also spreading out across the width of the strip to create a more vivid dispersal effect.

I got an answer from the fx artist who created these trails in reddit. Here's the link https://www.reddit.com/r/Unity3D/comments/4w0p4t/how_would_you_achieve_these_bullet_trails_smoke/d64b1ma

He uses "ribbons", which looks like a simpler but more limited approach to what you said, @deftware.

Anyway, I like your idea. Do you happen to know about any example on how to do that on Unity?

I don't have any experience with Unity, I've always been a hardcore DIY type. I'm sure it can be pieced together pretty easily. The trick is treating the 'ribbon' (as it were) as just a line of points, ie: connect the dots, and generating the actual quad-strip vertices from those in screen-space. From there it's all about just how you animate the texture across that geometry, making it look like it's drifting down the strip and also drifting in the breeze by randomly pushing the points along the ribbon randomly and in accordance with an overall breeze velocity, I would imagine.

This topic is closed to new replies.

Advertisement