Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Example Project - Line Renderer & Trail Renderer

Discussion in '5.5 Beta' started by LeonhardP, Sep 6, 2016.

  1. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    403
    Hi everybody,
    the project you can download through the link below is meant to grant you immediate access to the revised 'Line Renderer' and 'Trail Renderer'.

    The example projects allow you to see changes in action, without having to implement anything yourself. They are an advanced starting point for your exploratory adventures in Unity’s Beta.

    Project link (17 MB):
    (Link has been removed)

    In the 'Walking Robot' Scene you take control of a robot that draws a trail behind itself while it moves. Additionally, you can create a network of lines by right-clicking.

    [​IMG]

    You can find more information about the improved 'Line Renderer' and 'Trail Renderer' here:
    https://docs.google.com/document/d/1ECYkfNbXDiXJ0Sl-VjfQynfc_BPBT8TAAQ6dFeVroug/edit

    Please use this thread to discuss the subject matter.

    Edit:
    Project link has been removed due to the end of the Beta phase.
     
    Last edited: Dec 1, 2016
    rakkarage, John3D and Avietry like this.
  2. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25
    can we get a emission variable xD? theres no way to make a trail/line renderer to stop emitting.
     
    Xepherys and richardkettlewell like this.
  3. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    That's an interesting idea.. I've added it to our roadmap, thanks :)
     
    John3D and atomtwist like this.
  4. atomtwist

    atomtwist

    Joined:
    Mar 20, 2013
    Posts:
    21
    Hey. Great work !
    Can we get an option to disable the billboarding for the Line/Trailrenderer?
    It's very annoying in VR, and makes them pretty much useless in most cases in VR projects ;)
     
    Last edited: Sep 20, 2016
  5. BenPerryDlala

    BenPerryDlala

    Joined:
    Mar 8, 2016
    Posts:
    3
    I would love this too. The line rendering has poor temporal coherence at the moment. You can see acute angles jitter as the camera moves when seeing them at glancing angles. I would still have to write my own custom solution because of this issue.
     
    atomtwist likes this.
  6. achap5dk

    achap5dk

    Joined:
    Jul 15, 2014
    Posts:
    1
    These changes are great, thank you guys!

    I did notice one visual problem with the trail renderer that can be repro'ed in this demo by using the jetpack: Sharp reversals in movement seem to violate the width constraints of the trail renderer.

    If you use the jetpack and just go up and down quickly it should be obvious.
     
  7. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    The latest 5.5 beta has a new option to align lines/trails to its transform component instead of the camera (i.e. disabling the billboarding)

    We are also working through some bugs, including the jetpack issue you mention.

    Thanks!
     
    atomtwist and BenPerryDlala like this.
  8. atomtwist

    atomtwist

    Joined:
    Mar 20, 2013
    Posts:
    21
    Sounds great.
    Athough, from what I can tell so far, it's still billboarding in VR, regardless of what settings i choose. (see image)
    Or is the new option just not yet in the beta?
     

    Attached Files:

    Last edited: Oct 6, 2016
  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    Setting Alignment to Local should make it face whichever way the transform component faces, instead of looking at the camera.. is it not?
     
  10. atomtwist

    atomtwist

    Joined:
    Mar 20, 2013
    Posts:
    21
    No it's not actually.
    At least not in VR. I'm using OpenVR with the SteamVR Plugin & the CameraRig.
    behaves exactly the same, regardless of the setting.
     
  11. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    Hmm, I'm seeing the same thing here. Not sure how that's happened. I'll look into it, thanks and sorry!
     
    John3D likes this.
  12. atomtwist

    atomtwist

    Joined:
    Mar 20, 2013
    Posts:
    21
    No prob. Thanks for investigating. :) Let us know when there's stuff to test again.

    Got another question:
    • Any chance we could also get a setting to adjust the thickness of the line, so if e.g. cranked up all the way, it would turn into a tube, rather than a line?
    • Or is that against the purpose of what the LineRenderer is supposed to be?
    • It's another VR thing, basically if billboarding is disabled, it's still awkward when parts of the line disappear when viewed from certain angles, cause its so flat
     
  13. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    Yeah that is tricky.. I can add it to our roadmap, but its not something that we have any plans for currently, sorry!
     
  14. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    301
  15. atomtwist

    atomtwist

    Joined:
    Mar 20, 2013
    Posts:
    21
    No prob.
    Disabling billboarding is already really cool :D

    @iivo_k - Thanks, I'll look into that.
     
  16. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,474
    Recently i've been working with the old trailRenderer for a project in 5.3.6f and come across a few issues that I would hope this new update will address. Unfortunately apart from some initial testing of the provided demo early in the beta cycle i'm currently crunching and so don't have time to check beyond the doc provided to see if this functionality is included.

    Time
    The old Trail Renderer used time as the only factor to determine length. In my project the trails emanate from gameObjects a variable distance from the camera and the trails would be clipped by the camera near plane. Using time makes it almost impossible to avoid clipping the trail renderer which is meant to fade out ( using color and width) as it nears the camera. If there was an option to control the length of the trail by distance that would be far more useful.

    Min Vertex Distance
    I've found this isn't working very well due to the relative speed that the gameObjects are moving at, and possibly due to camera tracking the objects from behind them. No matter how small i make the min vertex value each section of the trail appears to be the same length. I suspect this is due to maybe the gameObject moving such a large distance per frame that the smallest vertex distance between one frame and the next is naturally greater than the Min Vertex value.

    This suggests what is required is another option to allow for sub-division of a trail section if it exceeds the min vertex distance. This would greatly help smooth out the trails in my case which due to the motion of the gameObject up/down result in them looking rather jaggy.
     
  17. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    1,186
    In the new line renderer, could we get an array of arrays of points instead of an array of points?
    This way we can make a tree with two line renderer instead of 100: one for branches and trunk and one for leaves.
     
  18. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    1,186
    The line renderer extrudes a line, if you gave the option to extrude a profile instead or even just two lines in a cross, we could switch to local instead of view and VR would be happy.
     
  19. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    1,186
    Could we get this bug fixed, I'd like to use linerender? 848934
    What it is : when viewing the line along its axis, it bloats and scrambles up.
     
  20. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    138
    Would it be possible to also add an example about a trajectory visualization (angry birds like)? I've seen a lot of questions about how to visualize a trajectory and many answers involve using a line renderer. However, that looks just plain ugly with everything below 5.5. Does 5.5 change that?
     
  21. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    285
    I do see similar problems @laurentlavigne pointed out, at specific angles the trail render creates some very strange artifacts, even if it is set to Alignment local. Is there a setting I missed out, that can handle sharp corners in better ways?
    [​IMG]
    (Recorded with Unity 5.5 Beta 11)

    A second request I've seen and also miss quite a lot is a parameter that controls whether the position is traced. Kind of like in particle systems with pause and the emit parameter. I think with trailrenderers there could simply be a parameter called trace.
    When enabled it does what it does right now, otherwise there is a cut in the trail:
    [​IMG]
    Right now, this can only be achieved with multiple trail renderers (as of my knowledge), and it would be hard to sync all their timed property data (Like the stretched texture and width over time). I could also imagine to use a shader for that, but I don't quite see a flexible solution with the exposed data we got.
     
  22. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    498
    Thanks for the feedback. We already have the "trace" thing on our roadmap, and the sharp corner bug is being worked on :)
     
    Johannski likes this.
  23. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    285
    @richardkettlewell Really happy to hear that! I'm quite excited to see how you will solve the"Trace" option. I did think about it again, and I think in some cases it might be interesting to be able to fade out the width or texture when stopping the trace.
    Anyways, good to hear that you're on it, thanks for the fast response! :)
     
    richardkettlewell likes this.
  24. lth3726381

    lth3726381

    Joined:
    Oct 15, 2013
    Posts:
    9
    Hi,

    We need use line and trail on UI/2D frequently.Why not show SortLayer/Order property like Particle System's Renderer.

    In Fact ,I need adjust Mesh Renderer's SortLayer/Order personal. And I have to create a custom script to do this. It will be more convenient if all of Renderer can adjust SorLayer/Order .

    BTW, when can we have the property to stop trail from emit.just like particle,so we can do some effect like fade out or something others....is it will exist in stable 5.5?

    Thanks,
    Lth
     
    Last edited: Nov 22, 2016
    hitwicket likes this.
  25. John3D

    John3D

    Joined:
    Mar 7, 2014
    Posts:
    278
    I'm interested in this too.
    Trail Renderer looks really cool.
    Thanks!