Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411488 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 03:39:04 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Vector Graphics/Animation
Pages: [1] 2
Print
Author Topic: Vector Graphics/Animation  (Read 10170 times)
pl▲ygr☺und
Level 0
*



View Profile
« on: August 19, 2008, 03:58:31 PM »

Does anybody know how one does use vector graphics in games without using flash?
I am pretty new to programming and just tabbling around with processing, but it just seems extremly hard to use a vector engine if you want to animate things. bitmaps are sort of easy since you just create the frames, but I never heard of any software apart from flash that allows you to do motion tweening and I don't believe that people just import a bunch of svg files and use the same traditional animation technique.

maybe somebody can answer me this. cheers.
Logged
muku
Level 10
*****


View Profile
« Reply #1 on: August 19, 2008, 04:12:25 PM »

Not really, but I inquired about something similar a while back, and some library called ShivaVG came up that seemed interesting. Here's the thread.

http://forums.tigsource.com/index.php?topic=2213.0
Logged
Bad Sector
Level 3
***


View Profile WWW
« Reply #2 on: August 20, 2008, 03:33:11 AM »

The "easiest" method is to create your characters using convex polygons and use OpenGL to draw these polys. Since your characters are basically 2D polygons made of vertices, you use the same animation methods as for 3D. In fact you can use a 3D application like Blender to make the content (you just ignore one dimension). To animate this, you can use morphing (interpolate the vertices between two frames) or skeletal animation (use bones and transform the vertices using them). Morphing is easier but it requires more memory and the animation is predefined. Also you basically need to create a skeletal animation -> morphing utility since most programs dont support morphing as a method for saving animation (AFAIK at least).

Going the SVG route will be much harder i believe.
Logged

~bs~
pl▲ygr☺und
Level 0
*



View Profile
« Reply #3 on: August 21, 2008, 08:34:55 AM »

Thanks. I also thought about this option, but won't this make the graphics look a little bit blurry since your using 3D Open GL?

there's another question I have regarding graphics.

I don't have much programming experience, but I wanna get the basics down first before I start to learn C++. I only really know a little bit of processing (does processing have it's own 2D graphics api?), which also allows one to define bezier curves, which could be scaled via a varible. does that make it a vector graphic?

How do games like Loco Roco or PixelJunk Eden pull this off, although both games have rather simplystic shapes.

I am a little bit confused by this whole pixel vs. vector thing. especially since I started using processing  Smiley

« Last Edit: August 21, 2008, 09:02:04 AM by pl▲ygr☺und » Logged
muku
Level 10
*****


View Profile
« Reply #4 on: August 21, 2008, 10:46:46 AM »

Thanks. I also thought about this option, but won't this make the graphics look a little bit blurry since your using 3D Open GL?

I'm not sure what you mean by blurry, but no. OpenGL is just as fine for 2D graphics, you can simply set up an orthogonal projections matrix and view your scene "top down", using only the x and y coordinates. If the graphics card supports it, you can even turn on FSAA and have a nice antialiased look.

Quote
I don't have much programming experience, but I wanna get the basics down first before I start to learn C++. I only really know a little bit of processing (does processing have it's own 2D graphics api?), which also allows one to define bezier curves, which could be scaled via a varible. does that make it a vector graphic?

Yes, that qualifies as vector graphics. Roughly, everything that can be rendered independent of actual screen resolution is vector graphics.

I've never used Processing, sorry, so I don't know about the API.
Logged
Ryan
Level 1
*



View Profile
« Reply #5 on: August 21, 2008, 11:10:50 AM »

Processing is a wrapper on top of the Java APIs. In Processing, you choose to have the backend use Java2D, Java3D, or OpenGL (the Processing site is a great resource to find out how to do these things).

Processing's OpenGL is a bit different because it already gives you a 2D plane to work with. You don't really use GL commands yourself while using it, but the Processing API does. (I.E. when you call line(100, 100, 200, 200) processing automatically makes the correct GL calls to draw this line).

If you are using OpenGL straight up, as you would in C or something, you can create a 2D view quite easily.

Code:
glMatrixMode(GL_PROJECTION);
glOrtho(0, width, height, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);

This will create a view where (0, 0) is in the top left-hand corner of your screen, and each pixel represents one point. Hope that helps.

As for the difference between vector graphics and pixel graphics, think of the difference not as a rendering issue, think of them different by how the data is stored. With a bitmap graphic, you can think of the data is being stored in sort of a grid, like graph paper. When drawing this bitmap graphic, you can plot these pixels (color data) onto the screen.

You can think of vector, on the other hand, being stored via geometry data. Say you had your own format called "vec". Here's what could be in a file "line.vec":

Code:
LINE
VERT 100 100
VERT 200 200
END

You parse this file in your code and then render it:

Code:
glBegin(GL_LINES);
    glVertex2f(100.0f, 100.0f);
    glVertex2f(200.0f, 200.0f);
glEnd();

that would draw a line onto the scene. What makes it cool, is you can zoom in and out with the camera (essentially changing the scale factor for each of the points from "1" to another value by doing so) and it'll always look "right". Zoom in on a picture and what do you get? Just big pixels.

Hope it makes things a bit clearer! Beer!
« Last Edit: August 21, 2008, 11:16:21 AM by Ryan » Logged
OryBand
Level 0
***


Screamadelica.


View Profile WWW
« Reply #6 on: August 26, 2008, 06:23:20 AM »

Thanks. I also thought about this option, but won't this make the graphics look a little bit blurry since your using 3D Open GL?

By blurring I think you mean one of two thinks.

The first one is the "blur" you might see on textures of old games using hardware acceleration (OpenGL / DirectX). Like when you look really close up a wall on some old 1st person shooter you see the texture of the wall get blurred. This is not because of OpenGL. This is because the original texture bitmap is in a low resolution, and the blur is a result of OpenGL stretching the texture and fixing the jagged lines. If it wouldn't fix them, it would look a whole lot worse - like huge unordered pixels.


The second one is the "blur" you might get when using Anti-Aliasing. This is an option not just of OpenGL, but also for DirectX and other graphic libraries. Anti-Aliasing is a technique of curving the edges of polygons, in order to make them look less jagged. It also makes everything look a bit more blurrier. This is usually a graphic option you can turn-off in most games. Personally, I don't like it. Smiley

Here is an anti-aliased VS aliased model comparison. The left one is anti-aliased while the right one isn't.

Logged

Never go to bed mad, stay up and fight. - Phyllis Diller
dmoonfire
Level 3
***



View Profile WWW
« Reply #7 on: August 27, 2008, 05:26:23 AM »

That would depend on your textures. If you use pure vector artwork, then you won't get blurring except for the anti-alised lines. If you are using a non-vector texture, you'll get scaling, blurring, or artifacts, unless it matches exactly with the size of the user's resolution. For GS, I just kept with the pure vector artwork to keep it crisp at all levels.
Logged
qubodup
Level 1
*


icons?


View Profile WWW
« Reply #8 on: August 28, 2008, 01:57:47 AM »

*sniff* I wants svg animations Sad

All I know of, but unfortunately didn't properly test yet is Gazelle, which I wrote a short paragraph about once.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #9 on: August 28, 2008, 09:42:50 AM »


here is it a cool vector graphics library from italian coders like me

http://www.amanith.org/screenshots.html

 Gentleman


Using directx\opengl is also a good solution, like i'm doing with my game:
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
Gnarf
Guest
« Reply #10 on: August 28, 2008, 10:01:10 AM »

Yes, Eclipse. Being awesome is also a good solution.
Logged
MekanikDestructiwKommando
Level 3
***


Let's ROCK!


View Profile
« Reply #11 on: August 30, 2008, 04:45:09 AM »

Yes, Eclipse. Being awesome is also a good solution.
nice screenshot..
Logged

Quote
There have always been interactive experiences that go beyond entertainment.  For example, if mafia games are too fun for you, then you can always join the mafia.
OryBand
Level 0
***


Screamadelica.


View Profile WWW
« Reply #12 on: August 30, 2008, 04:50:00 AM »

+1 for Eclipse. Beer!
Logged

Never go to bed mad, stay up and fight. - Phyllis Diller
dmoonfire
Level 3
***



View Profile WWW
« Reply #13 on: August 30, 2008, 09:52:23 AM »

My only complaint about Amanith is that seems a bit closed to me. I like bazaar-style development and getting downloads out of them seemed a bit... difficult. Not to mention, its seems to not really be in a license arena I'm comfortable with (i.e. I can't find the open-sourced version).
Logged
Alec
Level 10
*****



View Profile WWW
« Reply #14 on: August 30, 2008, 09:53:35 AM »

Woah, awesome screen, man.  Beer!
Logged

goshki
Level 4
****



View Profile WWW
« Reply #15 on: August 30, 2008, 10:17:33 AM »


here is it a cool vector graphics library from italian coders like me

http://www.amanith.org/screenshots.html

 Gentleman


Using directx\opengl is also a good solution, like i'm doing with my game:

Is your game, Roboplanet, using AmanithVG or is it a self-made technology? Whatever the case is, it looks stylish indeed.
Logged

Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #16 on: August 30, 2008, 03:24:03 PM »


here is it a cool vector graphics library from italian coders like me

http://www.amanith.org/screenshots.html

 Gentleman


Using directx\opengl is also a good solution, like i'm doing with my game:

Is your game, Roboplanet, using AmanithVG or is it a self-made technology? Whatever the case is, it looks stylish indeed.

oh sorry, the game is called Circle, the robotic race will be one of the three i currently have in mind to use :D

I started it using my own engine in directx, now i've ported everything to xna to do an xbox version, c# is really a lot slower than c++ but it's ok on PC, the real problem is on xbox. I really hope to get my filthy hands over a proper devkit in the future and port my c++ stuff on the xbox...
Oh, it uses polygons, a lot of stuff is procedural, a lot is not Smiley
Logged

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



View Profile WWW
« Reply #17 on: August 31, 2008, 05:42:41 AM »

oh sorry, the game is called Circle

I misinterpreted the screenshot's filename - my bad. Smiley
Logged

OryBand
Level 0
***


Screamadelica.


View Profile WWW
« Reply #18 on: August 31, 2008, 09:06:57 AM »

Eclipse, it looks sweet.

I wish you good luck, mate!

BTW, C# question.. Is the reason's C# is so slow compared to C++ is because of the additional interpretation layer (the JIT)?
« Last Edit: August 31, 2008, 09:15:05 AM by Orestes » Logged

Never go to bed mad, stay up and fight. - Phyllis Diller
muku
Level 10
*****


View Profile
« Reply #19 on: August 31, 2008, 01:38:07 PM »

BTW, C# question.. Is the reason's C# is so slow compared to C++ is because of the additional interpretation layer (the JIT)?

C# is basically a bytecode-interpreted language, and that's what makes it slower than a language that's compiled to machine instructions directly. The JIT does this native compilation at runtime, so it's actually what makes C# faster again. On the whole, C# isn't very slow at all; if you look at the language shootout, C# Mono is (on average) not even by a factor 3 slower than the GNU C++ compiler, and I'd expect the Microsoft implementation to be quite a bit faster still.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic