Search Unity

Vectrosity - Fast and Easy Line Drawing

Discussion in 'Assets and Asset Store' started by Eric5h5, Sep 26, 2014.

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can just look in the project to see if it's there or not. Although if you're not using a custom material, you should get a "No DefaultLine3D material found in Resources" error if it's not.

    --Eric
     
  2. sad-gopher

    sad-gopher

    Joined:
    Aug 1, 2018
    Posts:
    3
    Code (CSharp):
    1.             var mat = GuiContext.UnitAssetBundle.LoadAsset<Material>("assets/materials/defaultline3d.mat");
    2.             if (mat == null) {
    3.                 UnitLogger.Error ("No DefaultLine3D material found in Resources");
    4.                 return;
    5.             }
    I've modified a code a bit, to load material from bundle, and it does not shows an error, so it means material is here.

    also, I've tried to log material inside VectorObject3D.SetVectorLine

    Code (CSharp):
    1.     public void SetVectorLine (VectorLine vectorLine, Texture tex, Material mat, bool useCustomMaterial) {
    2. //
    3.         m_vectorLine = vectorLine;
    4.         m_material = mat;
    5.         m_material.mainTexture = tex;
    6. // mat and tex are not null here, it shows Default3DMaterial and ThinLine
    7. //
    8.     }
    can I add log method somewhere in update? to track if material is here or deleted in runtime?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It would probably be better to check in Draw or Draw3D.

    --Eric
     
  4. look001

    look001

    Joined:
    Mar 23, 2017
    Posts:
    111
    I noticed the drawDepth doesn't work with points and lines mixed. It seems like the lines are always drawn on top. Is it possible to change the order some how? Also i am searching for changing the texture of the points from the default squares to a circles. I tried to change the line texture but that only works with lines, not with points. Thank you!
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    DrawDepth works if you use Draw (it requires a canvas so it wouldn't work with Draw3D), and if you're using the sorting numbers correctly. For example, a line and a point where the line is drawDepth = 1 and the point is drawDepth = 0:

    line1.png

    If you reverse that so the point is drawDepth = 1 and the line is drawDepth = 0:

    line2.png

    If I assign a texture to the point:

    line3.png

    So, these things do in fact work. I'd need more information to properly guess why they might not in your case; all I can think of offhand is that perhaps you're using a shader that prevents it.

    --Eric
     
    look001 likes this.
  6. look001

    look001

    Joined:
    Mar 23, 2017
    Posts:
    111
    Thank you for the answer. The textures work perfectly fine now i tried to set a linecap instead of the texture :)
    For the overlapping points: I thought i could use drawDepth for 3d points. Now i noticed that does not make sense since it is doing it automatically with Draw3D(). However i still have the problem with the overlapping and it has not to do with shaders. I made a clean new project with a test scenario (no custom shaders or anything) and i still have the overlapping points on top of the lines, even though the points are located in front in the cameras perspective. I also noticed that this only occurs if the points are close to the line. Else it works just fine.
    I have uploaded the test project as a package on Dropbox (version 2018.1.1f1 personal, Vectrosity not included).
    Anyways thank you very much for the patience. I am very impressed of how well this asset is made. For me it's probably the most usefull asset out there
     
    Last edited: Aug 6, 2018
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Still a shader issue, if you're using the default line shader, since that's a UI shader and doesn't write to the depth buffer. Try using a custom material with a different shader.

    --Eric
     
  8. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    Hi Eric. I have an old game 2012 that needs updating and I needed to update Vectrosity too. The game uses the old OnGui and GUI textures to draw its elements on screen and your Vectrosity used to draw its lines behind these elements. Now after updating the lines are on top of the GUI elements. The entire game is using the old GUI and it's not feasible to change it to something else. How can I get your lines behind the gui elements?
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I tested with OnGUI, and Vectrosity draws behind that, in Unity 2018 anyway. If you by GUI textures you mean GUITexture components, that will be removed from Unity, so it would be best to make the effort to replace them, if you intend to keep the game updated with the latest Unity. In any case, I don't know of a way to change the drawing order of a GUI canvas vs. OnGUI or GUIText/GUITexture components, sorry. That seems to be an internal Unity thing that isn't actually defined.

    --Eric
     
  10. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I can't go to 2018 as too much legacy has disappeared. Too many of my games are just too antiquated with not enough downloads to make a huge update viable, but i want to keep them on the stores.
    I need to rewind to the original vectrosity before you used a canvas. I only updated because there is a bug where when it creates the vector camera it enables HDR and all my textures start glowing!
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Vectrosity draws behind OnGUI on Unity 5 and Unity 2017 as well.

    --Eric
     
  12. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Are there any implications of having a 3D line parented to a canvas or not? I noticed they always have a RectTransform regardless of their parentage.

    Also, is it safe to move them from the UI layer? I need them visible only to a specific camera.
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Parenting could have implications if the canvas isn't at the origin. The layer isn't used for anything, so it's fine to use whatever layer you like.

    --Eric
     
    GroZZleR likes this.
  14. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Thanks mate.
     
  15. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi, I purchased Vectrocity some years a go and now I'm using it in my new 2D game.

    I have VectorCanvas with Line and a script that changes the start and end position of the Line. My problem is that I can see the Line in scene view with correct position but I can't see the Line in my game view. I have put higher value to VectorCanvas Sort Order but it won't work.
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Actually Vectrosity specifically makes lines correct for the game view, not the scene view. Make sure you have the latest version of Vectrosity, and that the start and end position of the line are appropriate for the game view. Also have a look at the included demos, to see if there's anything you're doing differently.

    --Eric
     
  17. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Eric, this comment is to "Go to the asset store window, find Vectrosity in your purchased list, click Import.". Is this right? upload_2018-8-21_0-58-50.png
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, that's the Vectrosity store page, not your purchased list.

    --Eric
     
  19. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Oh, could I get a link to what you’re talking about? (I’m sorry for wearing my stupid pants)
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  21. Glasgow

    Glasgow

    Joined:
    Jan 15, 2015
    Posts:
    8
    Hi

    I'm looking to create an app where users can place text markers and draw routes onto a floorplan (plane) in-game and I purchased Vectrosity for this purpose. Can anyone point me to some tutorials or offer any advice? I am looking through the demos but I feel I need someone to 'hold my hand until I find my feet' so to speak. Screenshot attached. Screenshot 2018-09-01 14.38.40.png

    Regards,

    David
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The text markers aren't really something Vectrosity would do. As for the lines, I imagine you'd do something very similar to the demo DrawLinesMouse script, specifically using the line3D option, and the useEndCap option (for the arrow at the end). Probably add some code so you can't draw outside the floorplan area.

    --Eric
     
  23. Glasgow

    Glasgow

    Joined:
    Jan 15, 2015
    Posts:
    8
    Thanks Eric

    If anyone else has implemented anything similar to what I'm seeking to do, I'd love to hear from you and find out more about the approach you took.

    Regards,

    David
     
  24. look001

    look001

    Joined:
    Mar 23, 2017
    Posts:
    111
    Hi Eric,
    what are the units of the linewidth? I searched around in the docs and everywhere.
    I build a custom wireframe. For this i want to move the lines by half their width to not overlap with the edges of the mesh. Right now the line intersects with the mesh. They aren't visible if the mesh edges are too sharp since the lines lay inside the mesh then. Is the linewidth even usable for this since it is in screenspace?
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The docs do actually mention in several places that line width is measured in pixels. It would indeed not be something that would really work, sorry, since 3D line coords are in world units, which don't correspond to pixels in screenspace as you note.

    --Eric
     
  26. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193

    Attached Files:

  27. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Vectrosity would draw the line itself easily; it's up to you to figure out how to supply and manipulate the actual points though. Therefore it's not really a substitute for a rope-wrapping package, since doing the edge detection and so on is the hard part, and not something Vectrosity does on its own.

    --Eric
     
  28. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    thanks for replay Eric

    you are alright the hard part is how to detecte edge, where vectrosity use just list of point to draw lines.
    i hope i will found solution for that case.
     
  29. Blaze5565

    Blaze5565

    Joined:
    Sep 11, 2018
    Posts:
    11
    Hi,

    I'm hoping to draw a line/segment with a gradient applied that can be modified in code, like how vertexes can be given colours in the normal Unity LineRenderer. Is that possible in Vectrosity, and if so, how?

    Thanks,
    Cory
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    In Vectrosity, line colors are per-segment, however you can get a gradient by having at least two segments, and using smoothColor = true. That way the colors are blended, and they can be modified in code.

    --Eric
     
  31. Blaze5565

    Blaze5565

    Joined:
    Sep 11, 2018
    Posts:
    11
    Thanks! So, I got it working by splitting the one line into two and moving the centre point to a point one quarter of the way along the line, so that the gradient changed at the middle.
     
  32. AxiomIT

    AxiomIT

    Joined:
    Aug 23, 2018
    Posts:
    2
    Hi Eric,

    I have purchased Vectrosity to render wireframes of existing 3D Models.
    Since the mesh generation at runtime is pretty expensive and I want to avoid using Read/Write on the models I'd like to "bake" the wireframe mesh into my prefabs on Import.

    I know I can use the LineMaker to generate a Wireframe from a Gameobject's mesh, but I have tons of models so a manual approach would be very unproductive. For the model import workflow I am using an editor plugin which processes the models at import (modify material and other properties)... is it somehow possible to use MakeWireframe() (or the methods of the LineMaker Utility) in my plugin and save the created mesh into my prefab?

    Thanks for the help. :)
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not directly, but since 3D lines are made from a standard Vector3 List, after using MakeWireframe you could save out the list as a text file or similar using various methods, and read it back in when you want to make the line.

    --Eric
     
  34. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    I am trying to use Vectrosity with VR (HTC Vive) and although the lines are drawing OK; I dont seem to be able to influence the canvas or sorting order. My lines are looking semi-transparent when appearing on front of other objects, which looks very weird. I've tried SetCamera3D, canvas.renderMode and sortingOrder, but none of these made any difference.
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use VectorLine.material to use a different material; the default UI material doesn't write to the zbuffer.

    --Eric
     
  36. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Ahh. works nicely now, thanks :)
     
  37. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Would you look at a quote from MGEAR's thread here:

    i don't have that packagt.. surely its inside there somewhere?
    or ask from the support thread if its inside dll or something
    https://forum.unity.com/threads/vectrosity-fast-and-easy-line-drawing.270846/


    So,after you look at the is it inside dll... or something? If you think I'm asking to much of you (which I think may be correct), please tell me what to do!
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    PM me with your invoice number for Vectrosity, and I'll send you the Tank Zone package.

    --Eric
     
  39. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Cool, i’m Watching Unbroken right now. When it concludes i’ll Message you.
     
  40. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    It has concluded. I’m heading home.
     
  41. abledbody

    abledbody

    Joined:
    Dec 2, 2015
    Posts:
    5
    I'm making a 2D game with a vector graphics style. I can't see any of my objects in the editor, though, because 3D lines need to be created at run time and I haven't found a way to attach 2D lines to a transform without generating them at run time as well. Is there anything I can do to make lines both visible in the editor and attached to a transform?
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can create 2D lines in the editor by using the GameObject > UI > VectorLine menu item.

    --Eric
     
  43. abledbody

    abledbody

    Joined:
    Dec 2, 2015
    Posts:
    5
    Right, but how can I get them attached to an object's transform?
     
  44. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    They're already attached to a transform, namely the transform of a canvas. If you want a line to follow the transform of another object in the scene, you can use VectorLine.drawTransform.

    --Eric
     
  45. abledbody

    abledbody

    Joined:
    Dec 2, 2015
    Posts:
    5
    This is the line of code I tried before I came here. It doesn't work.

    VectorObject2D vectorObject = GetComponent<VectorObject2D>();
    vectorObject.vectorLine.drawTransform = target;

    target is the transform it's supposed to attach to. The line just doesn't get transformed.
     
  46. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    I found it. I’m on my cellphone though. Ii’ll just wait until I get on my computer. It will be about 15 minutes - an hour and 15 minutes.
     
  47. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Unless you have an email account I can just forward you the order confirmation to,
     
  48. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    Yeah, I like that. I like the email address idea:
     
  49. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
  50. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    But it didn’t work. Where should I send it?