Update--version 2.2 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's Pro-only and can be hard to work with. Enter Vectrosity, which I hope addresses this lack and goes far beyond, too.
Drawing lines can be as simple as this:
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.
Last edited by Eric5h5; 07-13-2011 at 01:19 PM.
That's fantastic, I can't wait to have a play with it!
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
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
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.
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.
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....
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....
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.
very very awesome. Looking forward to tinkering with it much.
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.Originally Posted by JTownThis 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).
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.
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....
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.