Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Better Trails - Unity3D Trail Replacement (Trails, smoke plumes, skid marks, etc!)

Discussion in 'Assets and Asset Store' started by Pigeon Coop, Mar 19, 2014.

  1. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Better Trails for Unity
    Asset store ($15) | Webplayer | Documentation






    Replace Unity3D's Trails with Better Trails. With Better Trails you can clear the trail, check if the trail has any visible segments (nice to have when you want to wait for the trail to fade away before destroying an object!), specify your own 'up' direction for the trail (so you can have skid marks that are flat against the ground rather than billboarded to the camera) and you can even extend the code to have trails with custom behavior. We've included 2 custom trails - smoke trails and smoke plumes!

    Check out the webplayer!
    Read the documentation!

    • More control over your trails
      Clear the trails at any time and query whether or not there are any visible trail segments on screen!
    • Awesome examples
      The gif's above were all mode with the example scenes included!
    • Fancy smoke trails
      Generate animated smoke trails or smoke plumes
    • Flexible and Easy to use components
      Control over all the trail settings.
    • Gradient editor for color and curve editor for size over
    • Trail previewer



     
    Last edited: Apr 2, 2014
    Farelle likes this.
  2. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
  3. hamyshank

    hamyshank

    Joined:
    Jan 31, 2013
    Posts:
    88
    where can i get unity3d 4.6.0

    says its required
     
  4. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Eh, must be a bug I'll contact the admins and sort it out!
     
    Last edited: Mar 19, 2014
  5. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    The issue has been resolved and you should have access to the package now!
     
  6. Andrew_atl

    Andrew_atl

    Joined:
    Sep 21, 2010
    Posts:
    103
    Looks pretty cool
     
  7. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Thanks Andrew. Here are some melee weapon trail examples, achieved by attaching a trail renderer along the blade of the sword


     
    Last edited: Mar 21, 2014
  8. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey guys, a new version of Better Trails has hit the shelves! There is a new trail renderer and some awesome new example scene! (Check out the GIF's on the first post!). Here is what the trail previewer looks like :)



    Change Log
    - Implemented Trail Previewer
    - Local trail override
    - Stretch to fit option for trail effects
    - New Example Scenes!
    - Updated docs
     
  9. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    subscribed to thread, will get it soon
     
  10. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,434
    interested. question: can i "prewarm" a trail? so when i start the scene it is already displayed although the object has not really moved yet (circular orbits).
     
  11. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    No, I had thought about it and couldn't think of a nice way to do it. Maybe just a prewarm function which taked an array of Vector3's as your 'past positions'? You'd really have to get your hands dirty every time you wanted to prewarm the trail though! (i.e. calculate your position X number of frames ago, or maintain an array of past positions just for the sake of prewarming the trail).

    Its very easy for me to implement it, but I would imagine it'd be a pain for you to use. I'll still look into it for the next version though. :) It would definitely be a nice feature to have.
     
  12. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey everyone

    A new version of Better Trails has just hit the store! The most notable feature for this release is batching! It will now take one draw call per unique material being renderered as a trail - this means you could have 100 trails all emitting at the same time, and as long as they share the same material (regardless of the trails properties (size/color/life/etc)) then it will only be 1 draw call. It is important to note that Unity's inbuilt trail renderers do not have batching. If you need to draw a whole bunch of trails and you are constrained by hardware (mobile platforms, we're looking at you) then batching is vital!



    Here is the Release Notes:

    - Trail Batching! Only 1 Draw call for every trail sharing a material
    - Added option to stretch color and size from start to end independently
    - New inspector for trail behaviours (It was getting crowded)
    - Updated the docs (The public copy of the docs (ie. the link at the top of this post and the link on the asset page) will be updated in 8~ hours after this post - sorry about this)
    - Draw call example scene!
     
    Last edited: Apr 3, 2014
  13. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
  14. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Thanks :) I have updated the docs and you can find it here. The docs contain everything you might want to know about Better Trails before purchasing, including images of the editor and property details for each inspector!



     
  15. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    This looks very cool, It's on my wishlist :D
     
  16. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    567
    I agree... will be getting it in the future.
     
  17. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Thanks you two. In the future, if you do get Better Trails, we'd love to hear from you regarding how you are putting it to use and if you have any feature suggestions - we're always looking for ways to improve Better Trails! For example, there is a feature to 'stretch' the trail effects from start to finish (rather than lerp over lifetime) which was suggested by a user via email - it's a great addition!
     
  18. copenhagenjazz

    copenhagenjazz

    Joined:
    Oct 2, 2005
    Posts:
    45
    Hi

    I purchased your pack yesterday and while the demo scenes look great I cannot really figure out how to implement it in my own scene.

    As a clueless artist I am used to Unitys standard trail renderer which is pure drag and drop but this seems like it needs to be activated by scripting.

    I super simple step by step walkthrough of a basic implementation would be much appreciated :)

    Thanks in advance
     
  19. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey man! No need for scripting at all. It works just like the build in trail renderer. Attach the component to the game object, and make sure that:

    • The material is not null
    • The life time is greater than 0
    • The trail size over lifetime is greater than one
    • Emit is ticked on

    You can check out the Sword example scene. Those swords are not scripted. There is an animation clip sets "emit" to true and false as the sword swings.
     
  20. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey everyone. We'd love to hear back from the users who purchased Better Trails. We'd love to see how you are putting it to use! Also, we are trying to decide on the next feature to focus on. We are thinking about giving you the ability to define the shape of the trail as the next feature (rather than a billboarded triangle strip, you could have an extruded cylinder/star/etc). Though we'd love to hear your suggestions first!
     
  21. Pitje

    Pitje

    Joined:
    Apr 17, 2014
    Posts:
    5
    Hey,

    I have a quick question about it. I have to make some effects for the company I'm working for at the moment, I need to draw an arrow on the screen when you swipe with the mouse. This needs to be some kind of a trail renderer following the mouse. The problem with pretty much every trail renderer script I've seen is that they don't stretch the texture, they just create another part of the mesh which will use the complete texture again. I need some sort of system that stretches the arrow on the screen.

    Is this possible with your package?

    Nevertheless awesome work and I will definitely buy your package!
     
  22. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey there Pitje! I don't quiet understand what you mean by "they don't stretch the texture, they just create another part of the mesh which will use the complete texture again". So you just want the texture to stretch from the start of the trail to the end? If thats the case, then yes, you can do it very easily Though your arrow will become distorted due to the stretching!



    Also, horray! Thanks for helping us reach page 2. :)
     
  23. Pitje

    Pitje

    Joined:
    Apr 17, 2014
    Posts:
    5
    That's pretty much what I'm aiming for, this is what I meant : http://imgur.com/cKPL6qA

    I need what you have right there, how did you achieve that with your script?

    Also, thanks for replying that fast, and you're welcome for my help getting to the second page :)
     
  24. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Here is a picture of what the trail inspector looks like along with the material.
    $Untitled.png

    The key is to set the "Tile" value to 0 for the material - a "tile" value of 0 will cause the material to stretch from start to end!
     
  25. Pitje

    Pitje

    Joined:
    Apr 17, 2014
    Posts:
    5
    Thank you for your help, we're happy with what it's doing now. But we are experiencing this problem : http://imgur.com/yAp9ayE
    The jagged edges on the side. is this a texture problem or did we set something wrong?
     
  26. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    No you did nothing wrong. It is just errors in the bill boarding. It would look fine if it was a "particle effect" but because you are dealing with crisp graphics, you will need to specify a "forward override". I didn't include this in the previous screenshot because the values are always specific to whatever you are working on. In the sword example, you can smooth it out by applying these values, but outside of the sword example you will need different values.

    $Untitled.png

    If you like I can put together an example scene for you with a "smooth arrow" trail that you can paint with the mouse? I am busy for the next 2 or 3 hours though, but I can send you it after that. :)
     
    Last edited: Apr 17, 2014
  27. Pitje

    Pitje

    Joined:
    Apr 17, 2014
    Posts:
    5
    That would be really awesome. If you could do that I would be really happy!
     
  28. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey dude! Here you go. It works nicely when the mouse is moving fast. The path is too jittery if the user is moving the mouse slowly, not much you could do about that unfortunately. The basic rule here is that the bigger your trail is (big arrow) the faster the user needs the move the mouse to get a smooth trail. If you make the trail size smaller, its less susceptibility to "overlapping" errors, but thats just the nature of these things unfortunately :)

    Just import the UnityPackage into your project, and in the examples scenes folder check out the "Arrow Scene". Run the scene, click and drag with MB1 to make an arrow. If you want to know how it works, check out the "MouseFollower" script, its very straight forward, give me a yell if you need me to clear up anything!

    $Untitled.png


    View attachment $ArrowExample.unitypackage


    Let me know if there is anything else I can help you with man!

    PS: Do you mind me including this in the official package as an example scene for others to learn from?
     
    Last edited: Apr 17, 2014
  29. Pitje

    Pitje

    Joined:
    Apr 17, 2014
    Posts:
    5
    You wrote it, so feel free to include it in the official package!
    Thanks a lot for helping me out!
     
  30. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    No problem, and thanks dude. It makes for an awesome "Fruit Ninja" effect!

     
  31. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    This looks awesome, I'm subscribing to the thread :D
     
  32. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,005
    I used Better Trails to create an interesting effect. The trunks of these trees are generated proceduraly' using Better Trails. I set the trail to have 'infinity' life so it never disappears. To make the tree 'grow' I just move an object with a Trail Renderer attached upwards!


     
    minujeong and IndieAner3d like this.
  33. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Awesome stuff!

    We just wanted to remind you guys that if you are happy with Better Trails, we'd love a review on the asset store! No need for a written review - just let us know how many stars you think Better Trails was worth! It would help out a lot!


    And don't forget you can always email us or comment here with feature requests/help/etc - we don't bite! :)
     
    Last edited: Apr 24, 2014
  34. Gunhi

    Gunhi

    Joined:
    Apr 18, 2012
    Posts:
    294
    hi, I just bought it and try with my animations, but my attack animations are very fast.
    How can make the trails smoother in edges when the attached object is rapidly moving?
    let's say, the Sample SwordScene with Speed at 3 or higher.
     
  35. AcidState

    AcidState

    Joined:
    Jan 20, 2013
    Posts:
    1
    Would it be possible to create a trail with a collider?
     
  36. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey you two, thanks for the reply!

    @Gunhi:
    Thanks for the purchase Gunhi! Unfortunately this is just one of the problems that exists with trails renderers. The only way to make it smoother is to decrease your games timestep so that it Updates more often per frame. This will let the trail renderer insert more points into the trail and give you a smoother trail.

    When your sword swings from PointA > PointB > PointC over the course of 3 frames, there is no way to correctly 'guess' the 'in between points'.

    However, if you are using an animation to move around your trail, then we are in luck! We can sample an animation at different intervals, so we can get all those 'in between points' and generate a really smooth trail! I don't have a feature like this implemented yet, but I will work on something now for you. I'll let you know when I have something. :)

    @AcidState
    No, unfortunately not. The collider would need to be regenerated every frame and so it wouldn't really work very well at all. Would be very performance heavy.
     
  37. HenryV

    HenryV

    Joined:
    Apr 25, 2012
    Posts:
    100
    Hey,

    Thanks for the nice asset!

    I sometimes get this error while playing in the editor. It occurs rarely and so far has not occurred in any build versions. I have multiple guns in the scene like in your gun demo, they have bullet trails, barrel smoke, shell ejection trails etc. Any idea what could cause this?

    Code (csharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. PigeonCoopToolkit.Effects.Trails.TrailRenderer_Base.GenerateMesh (PigeonCoopToolkit.Effects.Trails.PCTrail trail) (at Assets/PigeonCoopToolkit/Effects/Trails/TrailRenderer_Base.cs:278)
    3. PigeonCoopToolkit.Effects.Trails.TrailRenderer_Base.Update () (at Assets/PigeonCoopToolkit/Effects/Trails/TrailRenderer_Base.cs:125)
    4. PigeonCoopToolkit.Effects.Trails.SmokeTrail.Update () (at Assets/PigeonCoopToolkit/Effects/Trails/SmokeTrail.cs:53)
     
  38. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hmm, are you able to narrow down exactly when it is happening? I understand the error, but I can't think of any scenario where it would happen. I'd love to get this patched up with your help!

    The only time I have seen this issue is when I have scripts that call runtime functionality in the editor while the game isn't running. So - if one of your scripts has the [ExecuteInEditMode] attribute, it can cause some errors if you try and interact with the Trail component.

    edit:

    Oh and thanks for the purchase Henry!
     
  39. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    870
    This looks great!

    But how's the performance on mobile like? What about GC?
     
  40. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    We've tried to keep it as performance friendly as possible as we too will be using it in mobile games. We use circular buffers to store trail points so that we dont constantly allocate new lists and we batch wherever we can. We do generate a bit of garbage though - there is always room for improvement. We'll aim to improve on that point in the coming versions.
     
  41. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,197
    Is the garbage at load or runtime? We can't have any garbage on Vita unless it's during setup or editor (in which case it's fine).

    Could this system preallocate?
     
  42. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    It is at runtime. There is only so much that can be done considering we need to rebuild the trail meshes each frame. Still looking for a better way to do it!
     
  43. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,197
    Ah I see! So the only hit is from submitting a new mesh? Your own code doesn't do this?

    Some optimisations you know but might not that I include just in case:

    - you keep a local copy of the mesh array data, so you only need to submit, rather than fetch data from mesh and modify and submit (saves allocs and of course is faster)

    - you use MarkDynamic()

    - you've tried double buffering your trails - that is you upload a different mesh each frame rather than the same:
    From: http://docs.unity3d.com/Manual/MobileOptimisation.html

    ... etc

    Other than this, if your only garbage is from Unity itself due to submitting a new mesh then that's probably unavoidable :)
     
  44. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Although i've purchased this package, i am very interested in these questions about optimizations.

    Thanks to you and Hippocoder. :)
     
  45. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Thanks for the suggestions :)

    The meshes are of course marked as dynamic, but the other 2 optimization points are great. I'll get coding tonight and see if I can bring that cost down.
     
  46. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    We've been poking away at the code to figure out how to make it more eco friendly (err, that is, generate less garbage). We explored lots of solutions and settled on the one that will change the framework the least. We're VERY happy with the results!

    This change has been pushed to the asset store and should be available within a week or so. This change is purely for performance and so introduces no new features (except for a new example - the "Swipe" example scene).

    The workflow is the same and updating is very straightforward - so if you've already started using Better Trails in your project don't hesitate to update! (We recommend you do it ASAP, especially if you are working on a mobile game!)

    Who likes data? Here is the GC Alloc for a few of the examples scenes in version 1.2.1 (Current) and 1.3 (New!). As you can see by the "improvement", we've really hit the nail on the head with this update.

    TheresYaProblem.png
    We'll post here again with a change log as soon as the change goes live!
     
  47. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,197
    You guys really improved the S*** out of that :D
    (those are per-frame numbers right? 600kb per frame would be atrocious!) :D
     
  48. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Yes those were per frame numbers, and 600kb was indeed atrocious! It was from the Draw Call Test Scene - the sole purpose of that scene was to draw a lot of trails on the screen and check that the draw calls remained low. 60 trail renderers were responsible for generating 600kb of garbage.

    Anyway, we've fixed that now! Hoorah! The exact same scene is producing 2.6 kb of garbage which isn't bad at all considering the number of trails. Maybe in the future we can eliminate even more!
     
  49. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,197
    Yeah - you know draw calls aren't *that* bad. On some devices they're actually on another cpu core, which up to a point makes them pretty much free...

    Is it the batching that's causing those final bits of garbage?

    What game are you guys making? Just interested and curious.
     
  50. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Yeah it's the batching. Maybe we can just offer a toggle between batching/no batching for the entire plugin. But first I want to dig around a little more and see if I can eliminate the GC Allocations and maintain batching.

    We're working on a small top down spaceship game. Essentially Samurai Gunn meets spaceships! Using Better Trails on the spaceship and weapon projectile trails (As well as our NavMesh2D asset for enemy path finding). We have not really shown much of the game though, just a few screenshots/gifs here and there.

    Edit:

    Finished packaging up Better Trails 1.3.0 and it has been uploaded for review. Now the wait begins.
     
unityunity