Search Unity

Vectrosity - fast and easy line drawing

Discussion in 'Assets and Asset Store' started by Eric5h5, May 26, 2010.

Thread Status:
Not open for further replies.
  1. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    Yes to first. Yes (I think) to second. The *only* thing I've changed is set the SDK Version and Target iOS Version to 4.2. Otherwise, left as normal.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You've imported Vectrosity into a new empty project?

    --Eric
     
  3. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    Yes. Created a brand new empty project. With only Vectrosity included. In addition to the standard Vectrosity scenes I have created a brand new scene and attached the DrawLinesTouch script to the camera in the scene. Except for the camera the scene is blank. Saved scene, made sure that it (alone) is added to the build menu. Those are the errors when I try to build. Repeated this process four times now ... although I am an idiot generally (sorry) I am trying to make sure I do everything exactly right.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Can you send me the project?

    --Eric
     
  5. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    PM sent with file location. Only 3.8MB.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Aha! Take the Tank Zone stuff out; it's not written for iOS. I tend to forget that the Asset Store version has everything packaged together, whereas I normally have the core Vectrosity scripts and the Tank Zone demo separate. The problem is that all scripts are included whether you're using them or not. I've updated the docs to make it clear that Tank Zone needs to be removed if you're building for iOS...sorry about that.

    --Eric
     
  7. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    Thanks Eric, will try as soon as I get home from work.

    Yup that fixed it, thanks.
     
    Last edited: Feb 8, 2011
  8. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hey Eric, just wanted to chime in and say thank you for developing such a wonderful tool. I'm currently using Vectrosity in my project, Amoebae, and combing Vectrosity with Unity 3's dynamic batching has enabled me to make fully procedurally generated wireframes that run lightning fast.

    If you want to check out the project, see the Showcase page here:
    http://forum.unity3d.com/threads/77...y-generated-music-based-evolution-SCREENSHOTS

    Also, here is a video:
     
    Last edited: Feb 9, 2011
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Looks cool!

    --Eric
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Vectrosity 1.3 released! Highlights are variable widths within a line, and vector text:



    Additions:
    • VectorLine.Resize for changing the number of segments that make up a line, instead of having to destroy and recreate it.
    • Vector.MakeCharsInLine for making vector text.
    • Vector.SetWidths for setting the pixel width of each line segment in a VectorLine. Pass in an array of floats, one entry for each line segment.
    • VectorLine.smoothWidth for whether or not line segment widths should be interpolated between segments.

    Changes:
    • Vector.SetTextureScale and Vector.ResetTextureScale work for 3D lines as well as 2D lines.
    • Some miscellaneous minor speedups; line drawing is 2-5% faster depending on the function.
    • VectorLine.vertexColors changed to VectorLine.lineColors, to make it consistent with lineVertices and lineUVs.
    • Improved documentation.
    • Requires Unity 3.2.

    Fixes:
    • VisibilityControlStatic accounts for rotated objects now.

    I'm sending this to the Asset Store now, so anyone who bought it there will have the upgrade available as soon as they approve it. Otherwise, if you bought an earlier version from my site, send me an email/pm if you want the upgrade (it's up to about 3.9MB now, so make sure you have email space for it first; in particular MobileMe addresses don't seem to like it).

    --Eric
     
  11. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Eric, thanks for the new release.

    This is the preview of a game I work on for about a month. It is inspired by Tempest.
    Most of the visuals use Vectrosity (ie bullets, the web).
    I would appreciate your feedback.
    Thanks !
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Ah yes, Tempest, that was a cool game. Unfortunately I can't seem to fire in your preview, so my games don't last very long! Good idea though.

    --Eric
     
  13. Wraith2021

    Wraith2021

    Joined:
    Dec 8, 2010
    Posts:
    81
    to fire is the up arrow
     
  14. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    And the z :)
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Ah...the page says w to fire but that doesn't work here. Up arrow did though.

    --Eric
     
  16. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Thanks for the feedback. If somebody would like to give some feedback or purpose something Thyella has its own thread (sorry for not mentioning before) so no hijacking on Vectrosity's thread. The link is here: http://forum.unity3d.com/threads/77711-Thyella-WIP
    Today I integrated kongregate's statistics API (yeah!). If you wish to discuss about how I implemented various features using Vectrosity though, it can be done here (if Eric agrees).
    After intensively working for over a month with Vectrosity I want to say that it is a well made product.
    The drawing calls are held to a minimum. The quality of the "fake" antialiasing is very good. But there is more.
    It is possible to attach a collider in a gameObject that has a Vectorline script. This is the basis for Thyella's bullets. The bonus is that I get antialiased bullets (that can be dynamically batched in unity ios pro I presume since they have <300 vertices). That can drastically lower the number of draw calls. If someone wishes, other objects could be represented via lines too. This further lowers the number of draw calls.
    The lines (or polylines) coordinates in 3d can be used to create 3d meshes in real time , while the lines serve as a visual guide. This is implemented in my level editor (not published but working).
    I do not risk to upgrade my project right now to 3.2 so I can use the new version but I will definitively do so after 15/02.
    In the docs Eric describes how to implement your own Vector fonts. This will drop the draw calls ever more !
    The implementation of variable length for lines is a very nice addition, as well the texture scale working in 3d now.
    The idea of gradually plotting a line over time by manipulating the transparency of its segments is amazing.
    What would be great to see in the future ?
    I am looking forward that Eric will implement VectorPoints in 3d so we can use them as a particles system (it can be used now for this purpose but working in 2d is limiting).
    I also wish that it would be possible to use an existing vector format (eps, ai, svg) so we could import lines (think font outlines for example) from a vector graphics package.
    A third wish would be the ability to create a closed polyline with every point being on a single plane forming a convex polygon, which should be easy to triangulate -> outlined plane mesh! An outlined plane mesh would be really usefull, especially if it could be implemented in such a way that a bunch of those still consume one draw call.
    Now, Eric have already done much for such an affordable package. But I hope that those things will be implemented at some moment :)
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Dynamic batching isn't limited to Pro, actually. (Only static batching is, which wouldn't apply here.) VectorPoints in 3D will definitely happen, and some kind of filled shape support is something I've thought would be interesting. I downloaded some .svg files a few weeks ago and looked at the specs, and it seemed like at least some limited support would be feasible.

    --Eric
     
  18. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Eric,

    I have two cars racing and want a camera on each one. I'd like a split screen so you can see the race from either car ... Also within the view for each camera I would like to have a speedometer and I'd like to use Vectrocity for the speedometer ...

    Its my understanding that Vectrocity sets up one VectorCam. I need two right? So, can I use Vectrocity to do the job here?

    Hope this makes sense. I probably have not thought it through as much as I need to ...
     
  19. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    Also,

    Would it be possible to share the textures you used to create the very cool stuff you have in the very first post of this thread?
     
  20. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just the one VectorCam is fine. You would use two (or more) VectorLines and position them as appropriate so each speedometer is over the correct part of the screen. The textures used in the first post are included in the Textures/VectorTextures folder.

    --Eric
     
  21. Werit

    Werit

    Joined:
    Dec 12, 2010
    Posts:
    38
    Is it possible to make a multicolored line, or is just making several different lines a better way to go about it?
     
  22. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    It is possible, if you supply an array of colors Color[] This also allows you to modify the transparency of each segment, by modifying the a component of the color (r,g,b,a).
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Also see Vector.SetColors in the docs.

    --Eric
     
  24. Werit

    Werit

    Joined:
    Dec 12, 2010
    Posts:
    38
    Thanks, so far it all works great!
     
  25. sparkyman

    sparkyman

    Joined:
    May 3, 2009
    Posts:
    21
    Hi All

    This is more a general multi array Java question but will ask anyway

    I can create the following which works fine

    private var Line1 : Vector2[];
    Line1 = [Vector2(10,10),Vector2(20,20)];

    I can also create :
    private var Line2 : Vector2[,];
    Line2[0,0]=Vector2(10,10);

    But how do I create an array that I can do this with:

    Line2[0,0]= [Vector2(10,10),Vector2(20,20)];

    Not sure if it possible.
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  27. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    According to http://unity3d.com/unity/whats-new/unity-3.2 in the latest version of unity editor multidimensional arrays are included.
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, but he seems to be trying to put an array at a location in another array, which is something you could do with a jagged array (Vector2[][][]), but not with Vector2[,,].

    --Eric
     
  29. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Thanks for the clarification, haven't thought of these nuances. I have a (irrelevant) question too.
    Suppose I have a 3d vector line assigned to a gameobject via vector manager. Its vector points are (0,0,0), (0,0,1).
    I change the scale of the gameobject in the inspector to be (1,1,2). In world space, the new coordinates of those points should be (0,0,0), (0,0,2).
    How should I proceed to bake this back to the vector points ? And, generalizing this, how is it possible to bake a transform from world space to local space in those vector line objects (position, rotation, scale) ?
    Any hints on the logic of this conversion would be greatly appreciated, I am *completely noob in vector math.
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I would guess Vector3.Scale for the first one; something like "for (v in vectorPoints) v = Vector3.Scale(v, transform.localScale);" (untested). For the second one, probably localToWorldMatrix (see the Setup function in the VisibilityControlStatic script). Or rather worldToLocalMatrix?

    --Eric
     
  31. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Eric, how do we get the updates if we bought your products before the launch of the Asset Store ? I have all of them, tried the contact form on your site and checked my spam filter with no success.
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Make sure you read the directions on the contact page (and follow them ;) ), basically it's a captcha because of the spam I get otherwise. Contact me somehow (contact page, email, PM) with the email address you used to buy Vectrosity and I'll send the new version. If you'd rather have the asset store version with auto-updates, buy it on the store, send me the paypal/asset store receipts, and I'll refund the paypal price.

    --Eric
     
  33. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Thanks very much, Eric.
     
  34. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Eric, I just bought Vectrosity again from the Asset Store, but right after downloading the package I got a Unity crash. Tried to create an empty project with no package : no crash. Imported Vectrosity again : crash. This happens in Unity 3.2 at the end of the assets import process, on both an iMac 24' from 2007 and a brand new MacBook Pro.
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, I just found out today that the 3.2 .obj importer can crash when trying to import certain .obj files now (seems to be OS X only). I submitted an update to fix this. In the meantime, contact me for an update directly.

    --Eric
     
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I just picked up Vectrosity today and am loving it so far. I put up a 3 part tutorial series that goes into extending Vectrosity to add line animations and color animations. Feel free to give it a look. Part 1 is here.
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nice, I haven't really used LINQ much. I did say "Wait a sec..." at one point, but then you popped up a correction, so that's cool.

    (By the way, the Vectrosity 1.3.1 update with fixed .obj files went up not long after I submitted it; the approval times for the asset store seem very fast now.)

    --Eric
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    That little mistake was just me being a fool for not looking at the source to see what you are doing in there. In my defense I only owned Vectrosity for an hour when I made the tutorial :D

    LINQ has some really neat tricks that are applicable to games. Definitely worth adding to your toolset.
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Indeed, that's pretty impressive for only having it an hour. :)

    --Eric
     
  40. Werit

    Werit

    Joined:
    Dec 12, 2010
    Posts:
    38
    Eric,

    Is there a way to ensure a VectorLine appears in front of GUI elements?
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spaceshooter, not without using a RenderTexture as the GUI element. GUI always wins when it comes to z-ordering.
     
  42. Werit

    Werit

    Joined:
    Dec 12, 2010
    Posts:
    38
    Ah thanks, hmmm. I was hoping to use a VectorLine to draw a box around a texture drawn with GUI.Drawtexture().
     
  43. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Unity GUI is the devil. Avoiding it at all costs can only make your game better (and faster!) and your life happier ;)
     
  44. cemC

    cemC

    Joined:
    Dec 23, 2010
    Posts:
    214
    Thats cool.
     
  45. jacksmash2012

    jacksmash2012

    Joined:
    Sep 21, 2010
    Posts:
    27
    I have a question about Vector.MakeTextInLine...

    This is my code:

    Code (csharp):
    1. Vector2[] points = {new Vector2(100f,100f), new Vector2(200f,100f)};
    2. VectorLine line = Vector.MakeLine("Line name", points);
    3. Vector.MakeTextInLine(line, "Text to draw", new Vector2(100f,100f), 15f, .75f, 1.5f, true);
    4. Vector.DrawLine(line);
    5.  
    ....this works fine until I change the uppercase parameter to false. Then I only get two letters that show up. Any ideas?
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jglanfield, lowercase lines aren't implemented yet. You can implement them yourself in the letter definitely file.
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    All the vector text I've seen is always upper-case only; it's mentioned in the docs that lowercase isn't currently included (I didn't know if anyone would want it so it would be worth the time/space), but if it's something people are going to use, I can add that.

    --Eric
     
  48. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Pretty impressed with this, thanks for all the work.

    Just a quick question though. Would it be possible/easy to have an effect like the x-ray demo, except without being able to see through the object. Part of my game has a graphic style to it, and I just want to draw a solid coloured border around black objects. Being able to quickly code it rather than doing it manually in a graphics program would save me a lot of time.

    Not expecting full code, just wondering what I should look at.

    Cheers
     
  49. Werit

    Werit

    Joined:
    Dec 12, 2010
    Posts:
    38
    I'm curious, how do you guys go about managing several VectorLines? My general thought is to have a class which contains members for each one.
     
  50. jacksmash2012

    jacksmash2012

    Joined:
    Sep 21, 2010
    Posts:
    27
    About the lowercase letter thing... it's not necessary. I'm just making a graph using Vectrosity, and I'm trying to figure out the best way to label the axes.
     
Thread Status:
Not open for further replies.