Unity Community


Page 1 of 121 1231151101 ... LastLast
Results 1 to 20 of 2411
  1. Volunteer Moderator
    Posts
    23,699

    Vectrosity - fast and easy line drawing

    Update--version 3.0 available now! Get Vectrosity here.

    -----

    Funny thing is, as Unity's graphics get ever more advanced, certain simple things are actually not that simple. Drawing lines, for example. There's the line renderer, but it has various limitations. There's GL.LINES, but that can be hard to work with and also has many limitations. Enter Vectrosity, which I hope addresses this lack and goes far beyond, too.

    Drawing lines can be as simple as this:

    Code:  
    1. VectorLine.SetLine (Color.yellow, Vector2(0, 0), Vector2(100, 200));

    Or you can even make complete vector-graphics games, like Battle Zone, Tempest, etc., not to mention all kinds of graphs, grids, selection boxes, and anything else to do with lines.



    • Not a shader, works on iOS and Android, doesn't need Unity Pro.
    • "Free" anti-aliasing when used with textures, which means you don't need FSAA to have anti-aliased lines.
    • Can also use textures for making things like glowing lines without full-screen glow effects, dotted or dashed lines, etc.
    • 3D, 2D, and point drawing. Lines can be any number of pixels thick.
    • Can have continuous or discontinuous lines with arbitrary colors and widths for each segment. This way, with discrete lines, many "separate" lines can be drawn with a single draw call.
    • Lines can have end caps, for making arrows, rounded ends, etc.
    • Many functions for easily making boxes, circles, splines, etc.
    • Fast -- lines only have to update when they change, so static lines take no extra CPU time, which means you can potentially have hundreds of thousands of line segments at high framerates. Even if you constantly update lines every frame, it draws 600K-700K line segments/second on a G5 Mac from 2005 (quite a bit more on modern CPUs).
    • 3D vector lines aren't limited to triangles or 4-sided polygons; has a utility for quickly making customized 3D vector shapes from existing meshes, or can automatically make wireframes in code with one function call.
    • Helper scripts for making 3D vector objects behave like standard game objects.
    • Complete documentation (apparently good enough that someone deliberately bought two copies because of it--really), plus a reference guide covering all functions.
    • Complete "Tank Zone" game project is included free, plus dozens of example scripts and demos.
    • Low price, so most anyone can afford it.

    --Eric
    Last edited by Eric5h5; 07-13-2011 at 01:19 PM.
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  2. Location
    California, USA
    Posts
    577
    This is very cool, Eric. I can think of some cool applications for this.

    Bonus points for the Battle Zone clone. I remember when I first discovered that game at Chuck E Cheese.


  3. Posts
    410

    that is so cool

    Hi

    That's so cool, wow great work!


  4. Location
    Derbyshire
    Posts
    67
    That's fantastic, I can't wait to have a play with it!


  5. Location
    The Hague, The Netherlands
    Posts
    389
    This looks pretty sweet!

    A few days ago I was busy with a hobby iphone project where I needed to draw some lines and found out that wasn't so easy with Unity. Ended up with mis using the linerenderer but it doesn't do well with curves.
    This utility would fit perfect in my project, can't wait to use it
    PlayerPrefs Window: Visualise and edit PlayerPrefs right in the editor
    Advanced Breakout Kit: The perfect start of your Breakout game, including fx like bullit-time and screen-shake

    An Alien with a Magnet, a 2D iOS/Android WIP game.

    Follow me on Twitter and Facebook


  6. Location
    Earth
    Posts
    859
    Oh man that is awesome!

    BattleZone was my favorite game at the arcades when I was younger and it's one of those games that one day I hope to remake myself one day just for fun.

    I can't wait to see your clone! Keep up the fantastic work


  7. Location
    Co Donegal, Ireland
    Posts
    1,066
    Magnificent stuff Eric.

    I could have used this so many times in the past and I know I will use it so many times in the future. Can't wait to take it for a test drive.

    Best Regards,
    Matt.


  8. Posts
    87
    Aw man any chance I'll be able to get a fiddle with this before the end of the month? I would love to use it for this month's experimental gameplay entry.

  9. Volunteer Moderator
    Posts
    23,699
    Glad to see there's some interest in this. As for release dates, if it's before the end of the month, I'm afraid it will be just barely....

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  10. Posts
    87
    Ah well I wanted to make the game anyway so y'know.

  11. Volunteer Moderator
    Posts
    23,699

    Demo 2

    Another little demo.

    This one for drawing 2D lines. You can rotate them right and left with the arrow keys, which is just one transform.Rotate call. One kind of nifty feature is the ability to fill in the ugly gaps you get in the joins when drawing thick lines (see below). It's one draw call for the line whether continuous or not, and you can click for quite a while before hitting the limit, which I actually set quite low, relatively speaking....

    --Eric
    Attached Images  
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  12. Location
    The Hague, The Netherlands
    Posts
    389
    The demo works great!

    Probably way too late but it could still be helpful.
    I just remembered something; when I was using XNA in its early beta days there was this Microsoft guy who created also a line drawing utility for XNA in C#. Although it depends heavily on shaders, it could still be of use, you can find it here.
    PlayerPrefs Window: Visualise and edit PlayerPrefs right in the editor
    Advanced Breakout Kit: The perfect start of your Breakout game, including fx like bullit-time and screen-shake

    An Alien with a Magnet, a 2D iOS/Android WIP game.

    Follow me on Twitter and Facebook


  13. Location
    Virginia, USA
    Posts
    436


  14. Posts
    146

    stron work!

    very very awesome. Looking forward to tinkering with it much.


  15. Location
    Dallas, TX
    Posts
    843
    This is awesome. I'd consider using it if it were possible to make it not draw lines not seen (so you couldn't see things through walls).

  16. Volunteer Moderator
    Posts
    23,699
    Quote Originally Posted by JTown
    This is awesome. I'd consider using it if it were possible to make it not draw lines not seen (so you couldn't see things through walls).
    Currently do could do that using a linecast--if the object is behind a collider, turn it off. With Unity 3, I think it might be automatic, if you used occlusion culling. This is because there's a Visibility.Dynamic mode for 3D vector objects.

    Dynamic means the vector object is drawn using the transform of its "parent" object, and if the "parent"'s mesh isn't visible, then the vector object isn't drawn. I found a trick for using OnBecameVisible and OnBecameInvisible for this, which works as expected but adds no extra draw calls. So you get 1 draw call for the vector object but no draw calls for the "parent", if desired. You can still use a standard mesh for the "parent" like in the demo, which does add a draw call of course. In any case, with occlusion culling active, OnBecameInvisible should fire when going behind a wall.

    Alternatively, I was experimenting earlier with a way of drawing vector objects so they are actually in the 3D scene and not a 2D overlay, but that will have to wait for an update since I don't want to keep adding features forever and never release anything.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  17. Posts
    400
    Unity Pro , Asset Server , iPhone Advanced

  18. Volunteer Moderator
    Posts
    23,699

    Demo3

    Demo 3: Scribblecube! A simpler one, but kinda psychedelic if you max out the number of points and zoom in a ways. The actual limit is about 16000 points per line, but that basically looks like a solid blob, which isn't very interesting....

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes


  19. Location
    NE Ohio, USA
    Posts
    7,173

    Re: Demo3

    Quote Originally Posted by Eric5h5
    Demo 3: Scribblecube!
    Looks amazing, but if you look to the outside of the glorb, from near the edge, many of the lines are broken. This ends up making for an interesting sort of laser show, as they reform.

  20. Volunteer Moderator
    Posts
    23,699

    Re: Demo3

    Yep, that's the result of the 3D lines intersecting with the camera's near clip plane. It's a bit odd to see like that since the lines are drawn in 2D.

    --Eric
    SpriteTile: new tile system that works seamlessly with Unity 4.3 sprites
    FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing
    Nifty utilities! Stitch terrains together - runtime model importing - file browser - fractal landscapes

Page 1 of 121 1231151101 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •