- Home /
Can I make a trailrenderer with a blur effect?
Hello,
I'm working on a bullet trail script. I'm currently using a trail renderer to achieve the effect of a bullet trail. What I would like to know, if there's any way to give that trail a 'blur' effect (more realistic version of a bullet trail), it's like the motion blur effect, but then in one line behind the bullet. I'm hoping this is possible using a custom shader or something similar, but I haven't worked much with shaders before. Does anybody know how to achieve this, or if this is even possible?
Btw, I'm using the C# language, but if anybody knows how to achieve this using JavaScript/UnityScript, I'm able to convert it to C# myself.
Thanks in advance, Tim Visée
Answer by Sprakle · Jun 29, 2013 at 04:13 AM
If you just want a trail that doesn't have a hard edge, you can use a material with a particle shader and a transparent texture.
Answer by Kiloblargh · Jun 29, 2013 at 03:34 AM
I think what you need to do is apply a mask material to the trail renderer (use teh googles) that will keep everything behind the trail from rendering; in your top, non-blurred, non-clearing camera. Then have a bottom camera that is exactly the same except for a full screen blur effect, and exclude the trail renderers from that camera.
If you wanted to then get fancy you could also maybe add lights or particles or some kind of tapered object with cubemap refraction to the back of the bullet and exclude them from the top camera, so they will appear only in the blurred trail.
Do you have an example script, I don't see to understand it, I'm sorry. (If you have any, I prefer C#, but JavaScript is fine too)
Tim Visée
There's really no scripting involved in the approach I described. Also, I can't test it because I don't have Pro. Depth$$anonymous$$ask shader Camera docs