Search Unity

★ LINEFY ★ GPU powered drawing: lines ╳ polylines ≋ dots ⠇

Discussion in 'Assets and Asset Store' started by polyflow3d, Apr 23, 2020.

  1. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Ahh, I just discovered it. it is the fadeAlphaDistance default for Lines. Thanks for the super fast response :)
     
    polyflow3d likes this.
  2. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Is there an advantage to packing lots of objects into the arrays, for example, one instance of the Dots class, which holds all the dots in my scene. That is one way to do it, but I could also have a custom component which has one dot in it, and then add this component to many game objects...
     
  3. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Yes, of course. You can manager class that collect necessary data from all game Objects into one Dots instance.
     
  4. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    It seems much easier to enable/disable components if they are separate. Is there a performance reason not to have many individual instances?
     
    polyflow3d likes this.
  5. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Each Dots instance needs for one batch. Also keep in mind that Linefy objects are not taken into account in dynamic batching. Thus, the number of Dots instances will add the same number of batches for rendering.
     
    Innovine likes this.
  6. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Sometimes you have to choose between ease of development and performance (when you really need it).
     
    Innovine likes this.
  7. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I have a dot on a game object, I set a position of zero for the dot, and use Draw(transform.localToWorldMatrix) and it is drawn in the world space location of the game object. How do I now draw a label in screenspace, a set number of pixels below the dot?
     
  8. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    use Label.offset property
     
  9. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Is it possible to have Linefy objects drawn last, so they appear on top of world objects, even if they are located behind?
     
  10. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    set zTest = Always
     
  11. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    what is the best way to draw lines in the world, but only when facing the camera?

    I want to draw a wireframe map of the world, but only show countries which are pointing to the camera. It's easy to determine if points are backfacing.
     
  12. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Sorry i did not catch only show countries which are pointing to the camera
     
  13. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    For example, if I wanted to draw something like this: (not my image). I do NOT want to draw the lines on the away side.
    Screenshot 2021-10-01 183010.png

    away side is easily defined by the dot product of camera look direction, and point position - sphere center. One solution is to have an object with all the points, and each frame, calculate which are visible and create a new Lines object and provide all the points. Is there a more efficient way?
     
    polyflow3d likes this.
  14. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Cool effect)
    There are two ways - the first is to control the visibility of the lines and dots through a script according to your algorithms.

    The second is to tune Fade Alpha so that it passes through the center of the sphere.
     
  15. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I am not sure what you mean by "control the visibility"... that is my question, how do i control the visibility :p

    Should I create a new Lines each frame, and fill it with the points I want to draw for that frame?
     
  16. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    You should not create new Lines instance every frame. Linefy is based on retained mode concept.

    Therefore, for implement effect above you should create one Lines instance and one Dots on Start (or Awake) then manipulate it appearance by assigning each line/dot width, color, items count, itc in Update (LateUpdate).
     
    Innovine likes this.
  17. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    so how do I disable lines. Should I leave points in the array and set the width or opacity to zero?
     
    Last edited: Oct 2, 2021
  18. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    yes.
     
  19. Bivens32

    Bivens32

    Joined:
    Jul 8, 2013
    Posts:
    36
    Is there a way to "embed" Linefy into my unity editor tool without sharing Linefy with other people? Just so tired of using Unity's Handles..
     
  20. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    When trying to make a PC Build with 2021.2.0b9 I get this:
    Code (CSharp):
    1. Shader error in 'Hidden/Linefy/DotsPixelPerfectBillboard': Output variable dot4vertPP contains a system-interpreted value (SV_RenderTargetArrayIndex) which must be written in every execution path of the shader.  Unconditional initialization may help. at Assets/3pp/Linefy/Resources/Shaders/DotsPixelBillboard/_dotsPixelBillboard.cginc(90) (on d3d11)
    2.  
     
  21. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Sorry, I have not support a beta releases.
     
  22. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    You have to act according the AS agreement.
     
  23. Bivens32

    Bivens32

    Joined:
    Jul 8, 2013
    Posts:
    36
    So... no? Is AS the "Asset Store" agreement? Man I just want to draw some animated dash lines in my tool. Why does it have to be so difficult ha. I wish Unity would unify gizmos, handles, and gl stuff and actually give us some proper options by default. Maybe in 10 years..
     
    Last edited: Oct 31, 2021
  24. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    What is "my tool"? Internal development or public product? If you try to publish a new product that contains Linefy in the Asset Store, it may be rejected. Moreover, it rules applies even to my other products.
     
  25. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    No worries. I commented out the line since it didn't seem to do anything, and the build succeeded. I noticed lines being drawn, but didn't look closely to see if it was all working as it should. Good enough for now I think, I just wanted to test my build.
     
  26. Bivens32

    Bivens32

    Joined:
    Jul 8, 2013
    Posts:
    36
    It's just a visual scripting solution I'm working on that's in an EditorWindow. Probably won't ever sell it. The plan right now is to one day release it for free on github or openupm. I'm not trying to distribute your product. I had just hoped there was some way to incorporate it into my tool where only I could draw lines with it, but the people who use the tool couldn't use Linefy or any of it's APIs.
     
  27. edufurlaneto

    edufurlaneto

    Joined:
    Sep 18, 2017
    Posts:
    17
    Hi.
    I am having the disappearing lines problem and can`t solve it. I tried changing the fadeAlphaDistance but still did not work.
    It seems to be related more to the camera FOV than the camera distance.
    I am using Playmaker to create and adjust the lines with this script.

    using UnityEngine;
    using Linefy;

    namespace LinefyExamples
    {
    [ExecuteInEditMode]
    public class Dinamic_Lines : MonoBehaviour
    {
    Lines lines;
    public void create_line(Vector3 start, Vector3 end, float width, Texture2D texture)
    {
    if (lines == null)
    {
    lines = new Lines(1);
    //assign lines
    lines[0] = new Line(start, end, Color.white, Color.white, width, width);
    lines.texture = texture;
    lines.transparent = false;
    // lines.fadeAlphaDistanceFrom = 0.01f;
    }
    }
    public void Update_pos (Vector3 start, Vector3 end )
    {
    lines.SetPosition(0, start, end);
    //lines.Draw(transform.localToWorldMatrix);
    lines.Draw();
    }
    public void draw()
    {

    lines.Draw();

    }
    }
    }


    Thanks
     

    Attached Files:

  28. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Try setting boundSize to something like 1 million?
     
    polyflow3d likes this.
  29. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Innovine, thank you. Yes, it's definitely bounds related issue.
    To solve choice one of these options:
    • set lines .boundSize = -1 to auto recalculate bounds
    • set lines .boundSize huge value
    • draw lines at offset coordinates so that their origin can be seen in the camera. If the matrix is inside the camera, the size does not matter, it can even be zero.
     
  30. edufurlaneto

    edufurlaneto

    Joined:
    Sep 18, 2017
    Posts:
    17
    Thank you both for the answer.
    BoundSize worked as -1 and 10000. :)
    Performance-wise, should I choose 10000? (I suppose -1 is constantly calculating the bounds).
     
  31. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Can you please take a look at it if you have some free time?
     
    polyflow3d likes this.
  32. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Dots are not drawn correctly in VR (OpenXR), they are double the size along the vertical axis... this should be a circle:
    Screenshot 2021-12-31 203039.png
    This is the default dots atlas index 0. It correctly draws as a circle in non-VR mode. When VR is enabled, it is rendered as above. The vertical stretch occurs in the vr camera space... turning the headset sideways and upside-down makes no difference, the long axis of the dot is always parallel to the nose-to-forehead axis of the headset.
    I'm using an OG Vive in Forward, SPI rendering mode.
     
  33. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    It looks like it's a Unity bug with builtin shader variables.
    Is there vertical distortion for other objects, such as Lines?
     
  34. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I am only drawing dots right now, but I'll try doing some tests when I get a chance.

    What unity shader variables do you think are buggy? I haven't noticed any problems with any other vr rendering.
     
  35. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Have you made any progress on this?
     
  36. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Seems like wrong screen aspect ratio in provides in shader. Please contact me by email. I will try to make an quick patch .
     
  37. Polyfemos

    Polyfemos

    Joined:
    Nov 13, 2020
    Posts:
    25
    Hello!
    I purchased Linefy after trying another popular Line drawer, while the lines in that product where nice the performance was far from ideal.
    Overall Linefy is awesome, I LOVE that there are 0 allocations during runtime etc. Great attention to detail!
    But one thing I cannot get to work is aligning lines with dots. The dots are offset in a nonintuitive way. Can you please help shed some light on how to get a dot to be centered at a specific location? See this simple example:
    upload_2022-1-25_18-2-26.png
    Notice how the red dot is slightly off-center. The problem is unfortunately a blocker for me, due to how lines and dots have to align in my project :(
     
    polyflow3d likes this.
  38. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    the dot is at position 0.5, 0,5 0,5 while the intersection of the lines is at position 0.5, 0,5 0,0


    Just change Vector3.one to Vector2.one in line 19
     
  39. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Hey, thanks. There's no need for a quick patch if you can update the asset in the next few months?
     
  40. animal531

    animal531

    Joined:
    Aug 26, 2014
    Posts:
    25
    I'm experiencing an issue in HDRP (2020.3.19f1 LTS), lines will be heavily aliased (changing aliasing in the camera doesn't seem to do anything), for example from the Quick Start scene:

    aliasing.png

    The same will happen with for example the Circular Polyline example:
    aliasing2.png


    Thanks,
     
  41. lLcrowe

    lLcrowe

    Joined:
    Sep 12, 2017
    Posts:
    7
    I am satisfied after various tests after purchasing.
    but how draw arc?
     
  42. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    Very disappointed to see that the UI/Canvas implementation doesn't work as expected. Linefy objects don't sort properly, ignore canvasgroup alpha, and in general are simply not UI objects. Worse yet, if you have a 3D camera position linefy skews your canvas in the 2D view mode, making it impossible to work with.

    I bought Linefy because it had Canvas support, which is lacking in Shapes, so it's a letdown that I have to remove it from my project.

    upload_2022-2-16_11-45-5.png
     
  43. LiquidEggProduct

    LiquidEggProduct

    Joined:
    Jul 19, 2017
    Posts:
    3
    I'd like to have a width mode like Worldspace XY, except it is on XZ.

    Anyway this is possible without adding a new width mode and changing shaders?
     
  44. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Any progress on this bug?
     
  45. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Please start showing some tech support responses in here. I don't want to change my positive review to a negative one, but people should know if this product has been abandoned.
     
  46. flipwon

    flipwon

    Joined:
    Dec 29, 2016
    Posts:
    179
    Is what this user is reporting the same with lines in VR? I'm looking for a solution to draw lines but not interested in going through refunding processes if it is just broken for my use case.
     
  47. Wanwu314

    Wanwu314

    Joined:
    Feb 28, 2021
    Posts:
    10
    Hi, I'm making a game where I need to randomly generate some 3D lines, but I often see the wrong overlap which can affect the visuals of the game. I want to know if there is a way to solve the sorting issues.
     
  48. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Good luck trying to get some support for this asset, it's been abandoned.
     
    flipwon likes this.
  49. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    What is the way to implement a clickable line at runtime?
     
    polyflow3d likes this.
  50. polyflow3d

    polyflow3d

    Joined:
    Oct 6, 2014
    Posts:
    297
    Liinefy is not abandoned. I serve in military and have limited time to support it.
     
    yong991122 likes this.