Search Unity

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. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,238
    As soon the 1.3 update hits the store, count me in! :)
     
    Pigeon Coop likes this.
  2. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Awesome to hear! Well, we are happy to announce that Better Trails 1.3 is now live.

    You can now purchase 1.3 or update your 1.2.1 projects to 1.3! We highly recommend you do, because the garbage collection improvements are vital (especially for mobile games).

    Change log 1.3.0
    • Performance boost!
    • Greatly reduced GC Allocations for the various types of trails
    • New example scene (Fruit Ninja-esque "swipe" example)
    • Fixed some errors in some of the example scenes (Rifle had no muzzle flash, Swords had redundent trail components)
    • A Thank You dialogue
     
  3. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    210
    Is it possible to reposition a complete trail? Let's assume that you drove a certain distance with the tank in your example scene: Can I move the trail behind the tank to a different place without extending the trail?

    I need that because I have a huge world and at some points I need to move my objects to the origin to avoid floating point issues.
     
  4. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    I can put together something for you tonight. Send us an email contactpigeoncoop[at]gmail.com with your invoice number and we'll email you a build with that feature. Sounds like a useful thing to have to we'll include it in the next build!
     
  5. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    210
    Okay, sounds great! I didn't buy your package yet but if you really can implement this featue I will buy it now.
     
  6. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Check your email BrightBit!

     
  7. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    210
    Perfect! I did test it in my own project, too. It works flawlessly!

    Thank you very much!
     
  8. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,238
  9. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey BTStone. I do want to look into something similar for Better Trails. It is especially useful for 'fast moving objects' where there is not much data between positions to generate a smooth path. It is one of the features I wanted to include in 1.3.0 but will include in the next version instead. I have no ETA on the next version.
     
  10. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,238
    Alrighty then, so it will come :)
    Nice!
     
    Pigeon Coop likes this.
  11. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    I've started on this feature tonight and got most of it finished. I have some problems I need to kink out but its coming along very nicely. Here is two comparison GIFs! I'm really excited with it so far. Enjoy.



     
  12. EnergyUP

    EnergyUP

    Joined:
    Jul 7, 2014
    Posts:
    3
    Hello. This looks like a great asset.
    I purchased the asset to implement a sword trail effect in a game.
    However, I got compile errors and was unable to use it.
    I later realized that the asset requires Unity 4.5.0 or higher.
    I am working with Unity 4.2 projects and cannot upgrade to 4.5 or higher.
    By any chance, is there any way to use the trail.cs script in Unity 4.2?
    I would really like to use it, and any help or suggestion will be greatly appreciated.
    Thank you very much.
     
  13. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey there. Could you copy/paste the compiler errors here?
     
  14. EnergyUP

    EnergyUP

    Joined:
    Jul 7, 2014
    Posts:
    3
    Hello. Thank you for your help.
    These are the errors I am getting when using it in Unity 4.2:

    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(22,56): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(23,56): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(30,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(31,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(34,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(37,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(38,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(42,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(43,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(47,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(50,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(51,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(55,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(56,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(59,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(62,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(63,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(66,30): error CS0122: `UnityEditor.EditorGUIUtility.labelWidth' is inaccessible due to its protection level
    Assets/PigeonCoopToolkit/Effects/Trails/Editor/TrailEditor_Base.cs(67,30): error CS0117: `UnityEditor.EditorGUIUtility' does not contain a definition for `fieldWidth'
     
  15. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey there, I've sent you a PM with a fix for your version which I'll include in the next version of Better Trails. If anyone else has this issue, leave us a message and I'll PM you the patch. :)
     
  16. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    John O'Neill from Spark Plug Games has just sent me a few screenshots of their upcoming game Mech Runner! Mech Running is an action packed game that'll be hitting PS4 + PS Vita when it releases! Awesome stuff! You can find more information on their kickstarter page, check em out!

    Here is some pics of Mech Runner with Better Trails in action!


     
  17. EnergyUP

    EnergyUP

    Joined:
    Jul 7, 2014
    Posts:
    3
    Thank you so much!
    Your fix works perfectly.
    Trully appreciate it!
     
  18. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    804
    Your asset certainly made its way onto my wishlist. :)
     
    Pigeon Coop likes this.
  19. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Thanks @c-Row! That is awesome to hear :)

    I just wanted to update everyone on the status of the smooth trails. Well, they are pretty much finished now! Check it out!



    Now this is a huge feature. There is an asset on the store that offers a really nice trail effect for swords. There is one problem though - all of these systems need to sample the animation clip of their character at really fine intervals to generate the trail. And thats where the problem is... With that setup you cannot use mechanim as mechanim does not allow you to sample the animation, and you must use the legacy animation system for anything that needs to have a trail. That sucks.

    The smooth trails we've created does not rely on sampling animation. Our setup works really well for smooth swooping actions (Like swords!). However, it can't work magic lol - if you have a lot of super fast zig-zaggy motion, you'll loose some data (there is no way around this). If you draw a "Z" shape trail really really quickly, the "Z" will smooth out to a backwards "S" (so you'll loose the sharp corners!). This is because there is no way for your computer to tell if you draw sharp corners or soft corners when you were moving really fast. The game just doesn't update fast enough to capture all that information!

    Anyway, the smooth trails should meet almost all your needs! Hoping to get this out ASAP!
     
  20. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    The next version will contain a new demo asset! Say hello to the jet!



    Remember, you can do whatever you like with everyone that is included inside of Better Trails - you can use the models/textures in your own assets, aswell as all the example trails systems we have setup for you. You get a heap of toys to play with! It's like a bonus for buying Better Trails :)
     
  21. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    Your asset looks great ! Will buy it soon!

    For smooth trails, we used the same asset you are talking about that sampled the animation (a feature we'd like to see in mecanim as well). We made it work with mecanim by going through a tedious process... of having both a legacy character (for the sampling animation data) and a mecanim one - the legacy character is not visible and then we tried to match both; It looks good but its a hack of sorts… and then if you need a trail where it blends between two animations its not going to work well...
     
    Pigeon Coop likes this.
  22. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    I had a chance to talk with some Unity dudes and raised the same issue - I wanted an abillity to sample Mechanim animations. You can't predict 'into the future' in mechanim like you can with the legacy animations for obvious reasons (Things like IK/blending generate the animation 'on the fly', in a sense). But I wanted to atleast be able to record an animation and sample that recording (Record for one frame, sample that data the next frame after it has recorded the frame). You can record animations in Mechanim but you can't sample the recording. You can just play it back. I don't know how it works internally but I guess it isn't 'samplable'. Maybe the recording only records the information mechanim needs to recreate the animation "on the fly" again. We'll never know.

    Anyway, when I brought this up with them they said that it is most likely not going to happen as mechanim is a system that goes off and 'does its own thing'. You give it your animations, define your states and transitions, set your IK targets, and away it goes.. into magic Mechanim land.

    Ah well!
     
  23. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Expect Better Trails 1.4 soon guys, it's already been submitted and those smooth trails are coming soon!
     
  24. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Can this product be used to create tank trail on uneven mesh terrain?
     
  25. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Nice, this looks like something I really need.
    That gun demo really appeals to me. I'm working on a first person shooter (and, by the way, am looking for team members *shameless plug*).
    Some features of the game are inspired by Left 4 Dead (it's not a zombie shooter, but L4D still has some solid shooter concepts that are worth borrowing - for instance, the deployable items such as Incendiary Ammo which one team member deploys for other team members to use).
    Anyway, one of the things I absolutely love in L4D are the smoking barrel of the gun - it's a subtle detail that is visually very powerful.
    Until this asset, I wasn't sure it could be done in Unity without a lot of custom coding. Looks like I'll just be picking this up instead - save a lot of time :)
     
  26. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    @PhobicGunner

    Hey thanks! I had the same thought about the gun barrels when I played Last Of Us. I thought it must be easy to do that! Turns out it needed a fair bit of work to turn into a useful/reusable script and so Better Trails was born! The smoking barrel examples are exaggerate in the demos because I needed to show off the smoke plume in action. When/if you buy Better Trails, try to use less opacity on your barrel smoke. Like you said - it looks really powerful when it is a very subtle effect!

    @ikelaiah

    Yes it sure can! You can specify a custom 'up' vector for the trail and have it relative to its parent object. So you would specify (0,1,0) as 'up' and set it to relative, and as your tank/car/wheel moved up and down hills, it would make all the trail points point 'up' relative to the floor. I'll put together an example when I get a chance this week.
     
  27. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Excellent. I'm buying it today.
     
  28. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Figured as much :)
    Already purchased, but might be a bit before I actually integrate it - still looking for and interviewing 3D artists, and after that will put out a first early graphics demo, and then the second demo will probably use the effect (in total, plan to put out 4 different demos prior to the full game)
     
  29. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    This is sick. keep it up!

    Might actually consider purchasing this later for some nice smoke trails, should I need them! ;)
     
  30. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    @ikelaiah Awesome to hear man! If you need a hand send us an email and I'll give you a hand. If you like, I can PM you the example scene I create with hills + tire tracks. (Should be able to get it done tonight)

    @PhobicGunner I would love to see the result when you get your graphics demo out! Would be awesome if you can post a few screenshots in here too :)

    @FuzzyQuills Thanks dude!
     
  31. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey guys, Better Trails 1.4 has hit the store, so go and update! Play around with the Smooth Trails and let us know what you think. :) I've done my best to try and iron out every problem but if you happen to find an issue just send us an email or reply here, I'll get it fixed up ASAP!

    Oh and here are the new assets!




    Change log 1.4.0
    • New example scenes!
    • New example assets, Rocket and Jet! (Free!)
    • A function to translate your trails so that your trails do not stretch when you teleport your gameobject (myTrail.Translate(...));
    • Smooth Trails! Awesome!
    Known Issue 1.4.0
    • Trail batching throws an error when the batched trail exceeds 64k vertices.
      • Keep in mind, every 'Point' in your trail = 2 verts.
      • A trail with 50 max points = 100 verts
      • A smooth trail with 25 max control points and 4 in-between points = 25 + ((25-1) * 4) = 125 verts.
     
    Last edited: Jul 25, 2014
  32. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Great job on updating and improving this asset! Smooth trails is something I've wanted in this tool for awhile so it's great to finally see it in here. One thing, I noticed that the example scenes with smooth trails are missing. Did they not get uploaded?
     
  33. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey @ojuzu, do you mean example scenes 8 and 9? (SmoothTrailScene and SmoothTrailInteractiveScene). Or are those missing..? :oops:
     
  34. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Yep, that appears to be the case. Unless I'm just too tired from hours of coding and I'm not seeing them. :)
     
  35. ojuzu

    ojuzu

    Joined:
    Jun 29, 2006
    Posts:
    67
    Update: It looks like it is in there after all. Sorry for the false alarm! I keep all my asset store items in a sub-folder and it looks like it overwrote the old files in the sub-folder correctly but then put all the new files in the assets root. That's weird. At any rate, disregard this! ;)
     
  36. neojsm

    neojsm

    Joined:
    Mar 7, 2014
    Posts:
    4
    I have a question.
    Mesh does not appear when using the background sprite. What should I do now?
    (Because it is not possible to use a renderer, I will not be able to use the sortingOrder.)

    (I used a translator. ^ ^;)
     
  37. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Hey @neojsm

    That is a sorting issue with sprite renderers and mesh renderers. It is a little tricky to use 2d sprites and 3d objects in the same scene. I recommend you change your background image to a 3D Plane and an "Unlit Texture" shader.





    @ojuzu Phew! Glad to hear that ;)
     
  38. neojsm

    neojsm

    Joined:
    Mar 7, 2014
    Posts:
    4
    Thank you for answer.

    We sprite background does not use one.
    Like this:


    :(

    How to change 3d plane with all the sprite is there any other way?
     
  39. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    You have to change them yourself. Don't use sprite! :) You have to create a new material with an unlit transparent texture shader. Then you create a Quad in your scene and assign it that material.
     
  40. neojsm

    neojsm

    Joined:
    Mar 7, 2014
    Posts:
    4
    Thank you for answer.
    sprite packing system of unity will reduce the many draw call.
    We, without the use of a quad in order to have a background object of many, to improve performance
    I am using a sprite.
    (And for ease of use, sprite renderer of unity can save many hours of work.)
    :(
     
  41. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    I understand. In that case you might be able to create a custom shader for your trail material and force it to render in front of the background. I am not sure if that is possible though.

    I looked into this issue a little more and Unity3D doesn't support sorting layers for Graphics.DrawMesh. I use Graphics.DrawMesh to draw the trails so I can't specify the sortingOrder :(

    http://feedback.unity3d.com/suggestions/graphics-dot-drawmesh-and-2d-sorting-layers
     
  42. neojsm

    neojsm

    Joined:
    Mar 7, 2014
    Posts:
    4
    Thank you for answer.
    I Understand too. :(
    Honest answer, thank you very much!! :):)
     
    Pigeon Coop likes this.
  43. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    @Pigeon Coop

    I managed to create trails on uneven terrain effortlessly using your asset. Great work. Thank you.
     
  44. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Awesome! Your welcome!
     
  45. keefus

    keefus

    Joined:
    Jul 27, 2009
    Posts:
    10
    Hi There, I just bought your asset, looks fantastic.

    Before I delve into it though, I was just wondering if its possible to shoot a trail out from an object, like a flame thrower or water spray, I'm desperately looking for a way to avoid particles.

    I had a brief look at the smoke plume for this purpose but its only relative to world space?

    Thanks for your time.
     
  46. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    I will look into adding a 'local space' tickboxs for the smoke plume direction for you. Until then though, you can you could set the smoke plumes direction every frame yourself. Something like this..:

    Code (CSharp):
    1. GetComponent<SmokePlume>().ConstantForce = GunBarrel.transform.forward;
    Though I am not sure if it would look good or not! The 'ConstantForce' isn't 'baked' into each point in the trail, so changing the constant force on the component will cause the entire trail to move in that direction. If your trail is fast enough and has a short life span, it could look ok!
     
  47. keefus

    keefus

    Joined:
    Jul 27, 2009
    Posts:
    10
    Brilliant, thanks very much.

    I understand what you are saying about the constant force, I think I would need some lag to the trail when moving the 'gun barrel'.

    Perhaps this functionality is getting beyond the original intention of the asset. But I'll try your suggestion.

    Thanks again.
     
  48. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    @keefus its ok, most special effects are just faked using whatever tools the designers had available to them, right? :) I really liked your idea of using smoke plume as a 'flame thrower' effect without needing a particle system. I whipped this up myself using just the assets included in Better Trails (so you could potentially make a better flame texture/material!)



    Here is the code I used to point the smoke plume's "forward".

    Code (CSharp):
    1. public class ConstForce : MonoBehaviour {
    2.     public float speed;
    3.  
    4.     // Use this for initialization
    5.     void Start () {
    6.    
    7.     }
    8.    
    9.     // Update is called once per frame
    10.     void Update () {
    11.          //I recommend you cache the result of "GetComponents" in your own code, I was just being lazy!
    12.         foreach(var plume in GetComponents<PigeonCoopToolkit.Effects.Trails.SmokePlume>())
    13.         {
    14.             plume.ConstantForce = transform.forward * speed;
    15.         }
    16.     }
    17. }
    18.  
     
  49. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    So just to confirm... this asset is not compatible with Unity's Sprite Renderer at this time?
     
  50. Pigeon Coop

    Pigeon Coop

    Joined:
    Jan 17, 2014
    Posts:
    186
    Its just as compatible with Sprite Renders as the built in particle system or the built in trail component. There will always be sorting issues between Sprite Renderers and other types of renderers. The sprite will either be drawn completely in front of the other renderer, or completely behind it, which can look funny. In neojsm's images, the background in his scene is one giant sprite and the sprite just so happens to renderer completely infront of the trail system (Because of how its decided to sort things). He would have similar issues with Particle Systems. The issue looks particularly bad when the sprites in your scene are REALLY large.

    Not much I can do about it unfortunately, it's just the nature of things when sprites interact with 3d objects.
     
unityunity