Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 11:09:36 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)2D graphics: vector styles
Pages: [1] 2
Print
Author Topic: 2D graphics: vector styles  (Read 7190 times)
Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« on: May 05, 2008, 08:32:17 PM »

Has anyone here had much experience using vector instead of raster images for 2D games? I took a brief look earlier for APIs which might serve for rendering vector images, preferably cross platform, but not knowing quite what I was looking for, I didn't make much progress.

So, my question for those of you who have used vector graphics type things in the past, what sorts of APIs are available on the programming side? Additionally, on the art side, what sorts of tools would you recommend? Inkscape, Illustrator?
Logged

Formerly "I Like Cake."
mewse
Level 6
*



View Profile WWW
« Reply #1 on: May 05, 2008, 09:16:31 PM »

Well, my game engine does retro-style vector graphic games and is fully cross-platform (though I haven't really been maintaining the Linux version very well, since I don't own a Linux machine).  But if you're talking about using Illustrator, then I suspect that "retro" may not be what you want.  Smiley

Screenshot of "The Muncher's Labyrinth":
http://www.vectorstorm.org/wp-content/uploads/2008/01/munchergameplay2.png

Screenshot of "StarShot":
http://www.vectorstorm.org/wp-content/uploads/2008/02/starshotoverlay.png



Downloadable game engine and games:
http://www.vectorstorm.org/
Logged
Zaphos
Guest
« Reply #2 on: May 05, 2008, 09:20:20 PM »

If you're going to use Inkscape, be warned that it crashes and will probably make you sad.  Cry

It seems like the most obvious platform for rendering vector images would be ... flash?
Logged
Ryan
Level 1
*



View Profile
« Reply #3 on: May 05, 2008, 11:08:51 PM »

I have been looking at vector stuff as well, though I haven't really tried anything out yet. Just going to throw a few links up (you probably have seen these, just going to post them just in case). I'll dig deeper over the weekend.

Amanith looks promising, it's built on top of OpenGL.

You have probably heard of Cairo, here is a link that provides resources on how to use it on top of OpenGL context (you could use SDL for that).

Also you could look for SVG libraries that work off of OpenGL, here's one that looks nice: svgl.

All those should be compatible with win32 / osx / linux. If you find anything else keep us updated Smiley

Oh, and as for vector apps, I really do think Adobe Illustrator is the one to go for. Inkscape was unstable for me and I didn't really like the interface too well.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #4 on: May 06, 2008, 12:14:53 AM »

yeah i know the coder of Amanith, is a cool italian demoscenic dude, the lib is awesome.

Also keep in mind that it not only uses OpenGL but also OpenGL|ES, this mean that with a little effort and using an OpenGL|ES implementation it can be compiled on consoles such wii\PSP ect... and it have also a software renderer
« Last Edit: May 06, 2008, 12:21:04 AM by Eclipse » Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
FARTRON
Level 4
****


the last man in space


View Profile WWW
« Reply #5 on: May 06, 2008, 09:42:16 AM »

Processing has an SVG library called candy.
Logged

Everything that was once directly lived has receded into a representation. - debord
Mitchard
Level 1
*


View Profile
« Reply #6 on: May 06, 2008, 09:53:19 AM »

There really aren't any really good vector based programs, but I would have to recommend Flash over Illustrator. It's alot more intuitive.

However, I have to say that unless you're intending to do some fancy line manipulation, there's really no point in using vector graphics in a 2D game. You get less detail, it takes longer to draw and bitmap scaling with mipmaps is just as smooth.
Logged
increpare
Guest
« Reply #7 on: May 06, 2008, 10:52:19 AM »

However, I have to say that unless you're intending to do some fancy line manipulation, there's really no point in using vector graphics in a 2D game. You get less detail, it takes longer to draw and bitmap scaling with mipmaps is just as smooth.
This argument seems to ignore stylistic considerations.
Logged
Mitchard
Level 1
*


View Profile
« Reply #8 on: May 06, 2008, 10:56:01 AM »

That's a very vague response.
Care to elaborate?
Logged
dustin
Level 6
*


View Profile
« Reply #9 on: May 06, 2008, 11:12:22 AM »

slick has an svg renderer and it's cross platform http://slick.cokeandcode.com/

Quote
This argument seems to ignore stylistic considerations.

I think he means you can get the exact same style making them with a vector based program and then rendering them to bitmap form.

Also I don't understand inkscape never ever crashes for me on osx
Logged
Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« Reply #10 on: May 06, 2008, 11:25:06 AM »

First of all, thanks for the info, everyone!

But if you're talking about using Illustrator, then I suspect that "retro" may not be what you want.  Smiley

Yeah, that's not really what I was looking for, but I still dig the bloomy neon line look. Keep up the good work.

If you're going to use Inkscape, be warned that it crashes and will probably make you sad.  Cry

Good call, I hate crashy applications and will stay away from Inkscape.

Quote
It seems like the most obvious platform for rendering vector images would be ... flash?

I've never used Flash. Pardon my ignorance, but doesn't the Flash development stuff go for $600 or something?

Amanith looks promising, it's built on top of OpenGL.

I took a look at that and it seems to have a really good feature set. However, as far as I can tell it is a commercial library subject to an undisclosed licensing fee, so I'm not sure that it's really the best idea for free games.

Quote
You have probably heard of Cairo, here is a link that provides resources on how to use it on top of OpenGL context (you could use SDL for that).

Cairo looks reasonably sharp, the only issue I would have is that to use it on top of OpenGL with any kind of animation you would need to create new textures every frame, since you're just rendering your vector images to an OpenGL texture and then rendering that to the screen.

However, I have to say that unless you're intending to do some fancy line manipulation, there's really no point in using vector graphics in a 2D game. You get less detail, it takes longer to draw and bitmap scaling with mipmaps is just as smooth.

Well, the two advantages I'd hope to get from using a vector-based approach to graphics are resolution independence and smooth animation using interpolated vertex positions. Neither of those are really available with traditional raster graphics.
Logged

Formerly "I Like Cake."
Gnarf
Guest
« Reply #11 on: May 06, 2008, 12:03:22 PM »

So that VectorStorm thing looks awesome.

I've mentioned ShivaVG in some other thread too. Still haven't tried it.

Quote
It seems like the most obvious platform for rendering vector images would be ... flash?

I've never used Flash. Pardon my ignorance, but doesn't the Flash development stuff go for $600 or something?
Not if you're in Europe it doesn't. Adobe sure do hate Europe pretty bad.

And there's some open source stuff. No idea if any of it is any good.
Logged
increpare
Guest
« Reply #12 on: May 06, 2008, 02:06:19 PM »

That's a very vague response.
Care to elaborate?
Sure, though I'm not sure I entirely agree with what I said.  I understand that you said that most things you can do with vector graphics you can do with raster graphics, just render the wassits to bitmaps.  But that's certainly not always the easiest/most efficient way to going about things.  And there are plenty of things that one can very efficiently with vector-based games that I think are quite a bit too elementary to be counted as "fancy line manipulation".  More personally, and to my point, if I had an idea for writing a game in my head, and if it involved vector graphics in my head, I wouldn't really consider going for a raster-based approach unless things were obviously going to get really hairy with vectors.  That is to the, there is such a thing as a vector-style (the retro vector style might be one (sub)example).  Because, maybe, wanting to do things in a vectory style rather implies wanting to do all of the fany line manipulation effects. I'm not sure, really.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #13 on: May 06, 2008, 02:20:28 PM »

the problem with doing vectors with actual vertices is that a) you end up with an ungodly amount of them if you have alot of complex smooth curves and that can add up pretty fast even for modern cards and b) you need multisampling extensions for antialiasing (you can do antialiased LINES on any card, but for anti-aliased polygons, which you need for doing shapes without a stroke you're gonna need hardware AA). Not rendering to texture so that you have the ability to manipulate the lines is  a bit silly because to do it fast, you're going to have to have the vertices in a vertex buffer anyway, so you will only be able to change it with a vertex shader and on cards that support vertex shaders you can render to the texture with either a fragment shader or framebuffer anyway.

Edit: (that is concerning rendering complex vector objects from svg files or something of course)
« Last Edit: May 06, 2008, 02:28:33 PM by toastie » Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
raigan
Level 5
*****


View Profile
« Reply #14 on: May 06, 2008, 04:17:48 PM »

We're using vectors/geometry and so far it's been a much bigger pain than we anticipated.

I think which approach is faster (bitmap vs vector) depends a LOT on the style and implementation. Personally I think sprites look great until you need to scale/rotate them, at which point they start to get ugly. They also rule out skinned/morphing type graphics (i.e non-rigid movement).

One thing you should think about is whether you're going to be able to take advantage of the flexibility of vector-based graphics: can your physics/collision/animation system handle non-rigid shapes?

Using 2D geometry is actually annoyingly complicated, far from a solved problem -- for instance, there's no easy (fast and simple) way to triangulate a concave polygon.

I'm wary of using generic/SVG-type vector renderers simply because they're probably designed with far different considerations than what a typical game will need. It really depends on what you need -- if you want to be able to author svg files and use them in game, then a library might be worth it. If all you want to do is draw some polygons, then you might be better off implementing it yourself.

Flash is a bit pricey, but writing a comparable animation editor will definitely  cost a LOT more. Then again, as with the rendering lib, it depends on whether you need all of that power/flexibility or just a simple subset of functionality.


Logged
ichi
Level 0
**


View Profile
« Reply #15 on: May 06, 2008, 06:19:40 PM »

I love Vectors  Kiss

I can't recommend Illustrator enough, although some people can get freakishly comfortable drawing in Flash (especially tablet users), so you should give both of them a try.
I'm making all the graphics for my current game in Illustator, but alas, I can't show it off just yet.
Logged
Zaphos
Guest
« Reply #16 on: May 06, 2008, 07:22:35 PM »

I've never used Flash. Pardon my ignorance, but doesn't the Flash development stuff go for $600 or something?
Well there's flex, which is free.  I've not really used it much, though, so I don't know how much you can do with it.
There's also a $200 student license, if you're a student.  ... which is, well, at least less than $600 ...

Well, the two advantages I'd hope to get from using a vector-based approach to graphics are resolution independence and smooth animation using interpolated vertex positions. Neither of those are really available with traditional raster graphics.
He was suggesting mipmaps for resolution independence -- essentially making your art at a higher res than you need to display.  That will be less space efficient, although if you have clean vector-esque art and use PNGs for storage, perhaps not too much so.
You can get vertex interpolation to some extent by putting the raster graphics as texture on a mesh, and moving the underlying mesh vertices.

I think which approach is faster (bitmap vs vector) depends a LOT on the style and implementation. Personally I think sprites look great until you need to scale/rotate them, at which point they start to get ugly. They also rule out skinned/morphing type graphics (i.e non-rigid movement).
If the resolution of the art is high enough, scaling and rotating are fine.  For example I think Aquaria does a lot of scaling and rotating of bitmaps, and still looks amazing.  It also does some non-rigid movement to good effect (like wave effects).  Very complex non-rigid motion is also possible with sprites; actually Mr Cake kindly linked me a nice paper on that very topic a while back -- 2D Shape Deformation Using Nonlinear Least Squares Optimization.


Using 2D geometry is actually annoyingly complicated, far from a solved problem -- for instance, there's no easy (fast and simple) way to triangulate a concave polygon.
What about this flipcode article with source? (edit: actually looking at that, I'm not really sure what they mean by efficient, it looks like they're just ear clipping; the 'Fast Polygon Triangulation based on Seidel's Algorithm' graphics gem is probably better.  Although the ear clipping one might be fast enough for some applications anyway, as long as there aren't many vertices ...)
Also, for many applications it should not be necessary to generate a new triangulation, so this may not be a problem at all.

I think it's a solved problem for the most part; the solutions just might not be as easy or accessible as you'd like.
« Last Edit: May 06, 2008, 08:02:14 PM by Zaphos » Logged
bateleur
Level 10
*****



View Profile
« Reply #17 on: May 07, 2008, 12:53:06 AM »

I'm making all the graphics for my current game in Illustator, but alas, I can't show it off just yet.

What file format do you use for import into the game?

I'm an experienced Illustrator user (as an art tool) but it would never have occurred to me that I could import Illustrator artwork into a game directly.

Illustrator is way more powerful than Flash (though it too is quite expensive), but there's no way I'm going to write a PostScript parser for my games!
Logged

increpare
Guest
« Reply #18 on: May 07, 2008, 02:34:37 AM »

Using 2D geometry is actually annoyingly complicated, far from a solved problem
Rather hard to avoid though when you're outputting to a monitor Wink  (I know you're probably talking about 2d affine/projective geometry probably, but whatever)
Logged
raigan
Level 5
*****


View Profile
« Reply #19 on: May 07, 2008, 05:59:25 AM »

I just meant that, compared to a simpler sprite-based system (where you're just dealing with the position/orientation/scale of quads) there is more "engineering" involved.



Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic