Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411594 Posts in 69387 Topics- by 58444 Members - Latest Member: YomiKu_0

May 08, 2024, 03:21:09 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)2D games resolution independence?
Pages: 1 [2] 3
Print
Author Topic: 2D games resolution independence?  (Read 22491 times)
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #20 on: March 13, 2009, 03:26:02 AM »

first of all, I have to use pixel art, vector's are not detailed enough for my taste Grin

Eh? Vectors are as detailed as you make them.

vectors are much harder to do, try to do the monna lisa in vector graphics and then try to load it in a game.
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #21 on: March 13, 2009, 11:49:51 AM »

vectors are much harder to do, try to do the monna lisa in vector graphics and then try to load it in a game.

That's a really bad example. Try to do the Mona Lisa in pixel art and then try to load it in a game. Just as difficult.

1- If you make detailed vectors wouldn't be a PITA to render it? Even a vector editor like inkscape takes minutes to render a moderately detailed vector image.
I can't imagine what it could be like to load tons of game objects, maps etc...

I don't know what PITA means but I guess you're worried about performance. Yes, vectors are heavier. But they're not really that heavy. It depends on how you render them.

A moderately optimized software renderer can easily render tens of thousands of colored polygons a second, thousands when transparent or gradient. Inkscape is not an optimized renderer, it's flexible and feature-rich, meaning it's also a lot slower. It has complex stuff like brushes, outlines, polygon operations, etc. of which you won't need any in a game.

And if you hardware accelerate your rendering, you can pretty much multiply that by ten maybe even a hundred. A highly detailed 2D game corresponds to a low-detail 3D game in performance I imagine, considering the poly count is about the same but for 2D you don't need any fancy shaders and stuff.

2- And still I don't think you can achieve the same detail level. In raster you can simply push pixels. There is no limit.

Actually, technically, with raster there precisely exists a limit - The pixels are the limit. You can't make anything smaller than a pixel. With vectors, you truly have no limit, you can make as small details as you want and they'll show up when you zoom close enough.

I don't know any games that use vectors so I can't give you a good example.
Logged
hexageek
Level 0
***



View Profile
« Reply #22 on: March 13, 2009, 12:04:20 PM »

That's a really bad example. Try to do the Mona Lisa in pixel art and then try to load it in a game. Just as difficult.
what's wrong with it. you can easily load a pixel art monalisa into a game. in the end it's just pixels just like any other image, detail makes no difference.

Quote
I don't know what PITA means but I guess you're worried about performance.
PITA = pain in the ass Smiley

Quote
Yes, vectors are heavier. But they're not really that heavy. It depends on how you render them.
A moderately optimized software renderer can easily render tens of thousands of colored polygons a second, thousands when transparent or gradient. Inkscape is not an optimized renderer, it's flexible and feature-rich, meaning it's also a lot slower. It has complex stuff like brushes, outlines, polygon operations, etc. of which you won't need any in a game.
the complex stuff you're talking about is what I need to achieve the detail. Please take another look at the first image I sent (hidden object) and tell me if I can do it with a simplified vector renderer?

Quote
And if you hardware accelerate your rendering, you can pretty much multiply that by ten maybe even a hundred. A highly detailed 2D game corresponds to a low-detail 3D game in performance I imagine, considering the poly count is about the same but for 2D you don't need any fancy shaders and stuff.
that's another problem. there are only few hardware accelerated vector renderers implemented(openvg implementation I think) and they are not free. I don't feel like paying for a low level graphics api.

Quote
Actually, technically, with raster there precisely exists a limit - The pixels are the limit. You can't make anything smaller than a pixel. With vectors, you truly have no limit, you can make as small details as you want and they'll show up when you zoom close enough.
In the end you have to render it to pixels so if the detail is smaller than a pixel you'll lose it after the render. I don't want to sound redundant but please look at the first image I sent. That level of detail can't be achieved with vectors.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #23 on: March 13, 2009, 12:18:02 PM »

Yeah, I would say the only option would be rendering vector graphics to texture at load time  or starting out with really large assets and rendering them out to smaller texture based on the screen resolution.

Rendering vectors in realtime with hardware triangles would really only work for very simple shapes and will always be slower than rendering texture-mapped quads.

I think that for Team Fortress 2, Valve used alot of vector assets for the HUD elements to make them resolution independent and they render them to texture based on the current screen resolution.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Ina Vegt
Level 1
*


Girl Game Developer


View Profile
« Reply #24 on: March 13, 2009, 02:45:35 PM »

One thing in which vector has an edge over pixel is when you want a 2d skeleton-based graphics engine. That sort of thing gets transformed a lot, and with vector art being relatively viewport independent, it should look much better than the pixel art that has a very fixed size and ratio.
Logged
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #25 on: March 13, 2009, 06:06:16 PM »

the complex stuff you're talking about is what I need to achieve the detail.

No you misunderstood. My point is that all that complexity is dynamic (obviously has to be because you're editing it as you go). With in-game graphics, they're static, pre-determined when creating the graphics and the game doesn't have to recalculate all the brushes and outlines every frame like Inkscape does, only render the vectors that it already has.

that's another problem. there are only few hardware accelerated vector renderers implemented(openvg implementation I think) and they are not free. I don't feel like paying for a low level graphics api.

It's called OpenGL, and it's completely free. Hell you could even just use SFML or something. You don't need a "vector renderer" specifically, just hardware accelerated filled triangles. Anti-aliasing and all that jazz comes almost automatically with just setting a few variables that enable them.

Although you will probably need a custom tool chain, to convert vector graphics into basically flat 3D models for rendering.

In the end you have to render it to pixels so if the detail is smaller than a pixel you'll lose it after the render.

The entire point of it is that the detail is there if needed. Yes, true, on a lower resolution it will get lost. But the advantage is when it doesn't get lost: On higher resolutions than the graphics were designed for, it'll still look good, unlike raster.

I don't want to sound redundant but please look at the first image I sent. That level of detail can't be achieved with vectors.

I just realized where I can find examples. Take a look at this and tell me it's not a photo-realistic picture. You can browse the most popular vector pieces on DA for some really good examples.

Like here's some nice graphics that would fit right into a game.

Vector is not limited to the simple style you've probably gotten used to from Flash games and the like. The only limit is the amount of work you're willing to put into it. While raster is much simpler and easier to draw, it degrades quickly as resolutions increase.

Also something to consider is that high-resolution raster graphics consume enormous amounts of video memory. Vectors really pack a bigger punch in a smaller package.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #26 on: March 13, 2009, 09:54:22 PM »

It's called OpenGL, and it's completely free. Hell you could even just use SFML or something. You don't need a "vector renderer" specifically, just hardware accelerated filled triangles. Anti-aliasing and all that jazz comes almost automatically with just setting a few variables that enable them.

I think the issue here was rendering complex vector shapes in realtime, in which case, rendering them with openGL on the fly is not really practical. Even with modern hardware, you'll quickly exhaust all triangle limits once you have multitudes of complex bezier curves on the screen.
Logged

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



View Profile
« Reply #27 on: March 14, 2009, 01:44:41 AM »

It's called OpenGL, and it's completely free. Hell you could even just use SFML or something. You don't need a "vector renderer" specifically, just hardware accelerated filled triangles. Anti-aliasing and all that jazz comes almost automatically with just setting a few variables that enable them.
do you suggest to write my own vector renderer on top of opengl?

Quote
I just realized where I can find examples. Take a look at this and tell me it's not a photo-realistic picture.
exactly! what do you think will happen when you try to render it (I'm not saying real-time, only in the loading section of the game for example)? And for a game, you have hundreds of objects like this. I truly believe loading screen would take ages but if I'm wrong please point me to the appropriate benchmarks Smiley

also this is kinda limited example. objects are easy to draw in vectors. try drawing a photorealistic soil texture? (that's first thing that came to my mind because I need it in my game)

Quote
Like here's some nice graphics that would fit right into a game.

not detailed enough! you can easily see how simple is the rock and sleeves made of only couple of shades. also shadows are very very simple. the grass is good though.

Quote
Vector is not limited to the simple style you've probably gotten used to from Flash games and the like. The only limit is the amount of work you're willing to put into it. While raster is much simpler and easier to draw, it degrades quickly as resolutions increase.
For a second, I'll forget about the performance and looks of vectors. But, the way huge work effort it needs makes it a very bad candidate (at least for me). I'm an engineer graduated form a technical school and the one thing that I learned there is to always choose the optimum method not the best one. The idea of vectors here is really good (assuming that performance is ok) but the effort to make that detailed images and a vector library to load those images on top of opengl (which is not a simple work, how many shapes I have to define for the dofus?) is just not worth it.

Quote
Also something to consider is that high-resolution raster graphics consume enormous amounts of video memory. Vectors really pack a bigger punch in a smaller package.
I don't understand. After loading the vector image to a texture (rendering), won't it consume the same video memory?
Logged
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #28 on: March 14, 2009, 05:03:03 PM »

I think the issue here was rendering complex vector shapes in realtime, in which case, rendering them with openGL on the fly is not really practical. Even with modern hardware, you'll quickly exhaust all triangle limits once you have multitudes of complex bezier curves on the screen.

I think you're vastly overestimating the number of polys you end up with. My GeForce 8800 GT can render 33.6 billion textured triangles per second. And our vector graphics' triangles aren't even textured, they're filled, goraud-shaded at most.

do you suggest to write my own vector renderer on top of opengl?

What's up with all this "vector renderer" stuff? It's just colored triangles! All you need to do is figure out what program you use to draw them and how to convert them into meshes. (you could even just use a 3D modeling program and make flat models!)

exactly! what do you think will happen when you try to render it (I'm not saying real-time, only in the loading section of the game for example)? And for a game, you have hundreds of objects like this. I truly believe loading screen would take ages but if I'm wrong please point me to the appropriate benchmarks Smiley

Again, I think you overestimate the performance hit. Also, ever heard of LOD? It stands for Level Of Detail and it's a technique you can use to scale the level of detail on the graphic to suit performance based on framerate and viewing distance. OpenGL probably even completely automates it.

With my graphics card, having a hundred objects like that, they could have 336 million triangles each.

One of the beauties of vectors over raster is that they're small, only a fraction of the data needed to represent bitmaps. So, in fact, vector graphics will load even faster than rasters.

also this is kinda limited example. objects are easy to draw in vectors. try drawing a photorealistic soil texture? (that's first thing that came to my mind because I need it in my game)

I'm not a good artist and nobody on DA has seemed to have drawn anything like that so I can't give you an example, but as I've shown you this imaginary limitation of vector art is just an illusion of being used to low-quality Flash graphics. It's hard work yes of course but it is really the only way to maintain high quality with resolution independence.

It may look like vectors are only good for these shiny, gradient graphics but that's not true. It's just that nobody has ventured anywhere else yet.

not detailed enough! you can easily see how simple is the rock and sleeves made of only couple of shades. also shadows are very very simple. the grass is good though.

But the point I'm illustrating is that there's no limit that prevents you from adding the detail you want.

For a second, I'll forget about the performance and looks of vectors. But, the way huge work effort it needs makes it a very bad candidate (at least for me). I'm an engineer graduated form a technical school and the one thing that I learned there is to always choose the optimum method not the best one. The idea of vectors here is really good (assuming that performance is ok) but the effort to make that detailed images and a vector library to load those images on top of opengl (which is not a simple work, how many shapes I have to define for the dofus?) is just not worth it.

Well you asked for resolution independence, I gave you the only way to achieve that. If it's too much work then you're just going to have to compromise and stay resolution-dependent.

I don't understand. After loading the vector image to a texture (rendering), won't it consume the same video memory?

No. The only "texture" you'll use with vectors is the very screen you render onto. Raster graphics are stored in texture memory in addition to that - Vectors are not, they are pure meshes and much smaller in storage.

One last note, you can easily add texture onto a vector picture for additional detail using shaders or procedural textures.
« Last Edit: March 14, 2009, 05:07:15 PM by Core Xii » Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #29 on: March 14, 2009, 05:45:41 PM »

I think you're vastly overestimating the number of polys you end up with. My GeForce 8800 GT can render 33.6 billion textured triangles per second. And our vector graphics' triangles aren't even textured, they're filled, goraud-shaded at most.

I take you've never actually tried to render any kind of decent amount of polygons onto the screen, Core Xii, as there are many things wrong with your assumptions.

The whole triangles per second figure is completely irrelevant, as if you're running a game at 60 frames per second, that figure means nothing. Even with modern graphics cards, you will only be able to render about a hundred thousand polygons AT THE ABSOULTE MAX at that framerate (I'm talking untextured, no-shader polygons, and that figure drops SHARPLY once textures and shaders are involved).

Here are some oldish VBO benchmarks from a couple of years ago:
http://www.sci.utah.edu/~bavoil/opengl/vbo/data_types/

What's up with all this "vector renderer" stuff? It's just colored triangles! All you need to do is figure out what program you use to draw them and how to convert them into meshes.

It certainly is not "just colored triangles". Writing a realtime vector renderer is not as easy as you think. Triangulating bezier shapes, for one, is not such a trivial problem. Aside from that, you will have to support color gradients, proper stroking of shapes, etc. It's not just taking vertex coordinates and dumping them into a VBO.

OpenGL probably even completely automates it.

It doesn't.

With my graphics card, having a hundred objects like that, they could have 336 million triangles each.
But the point I'm illustrating is that there's no limit that prevents you from adding the detail you want.

I'm really not sure what you're basing all of this information on.
« Last Edit: March 14, 2009, 05:58:49 PM by toastie » Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #30 on: March 14, 2009, 07:13:45 PM »

The whole triangles per second figure is completely irrelevant, as if you're running a game at 60 frames per second, that figure means nothing. Even with modern graphics cards, you will only be able to render about a hundred thousand polygons AT THE ABSOULTE MAX at that framerate (I'm talking untextured, no-shader polygons, and that figure drops SHARPLY once textures and shaders are involved).

Even then, are you seriously saying it's not enough?

It certainly is not "just colored triangles". Writing a realtime vector renderer is not as easy as you think. Triangulating bezier shapes, for one, is not such a trivial problem. Aside from that, you will have to support color gradients, proper stroking of shapes, etc. It's not just taking vertex coordinates and dumping them into a VBO.

Yes it is! You don't need all this fancy vector stuff you're thinking about! You can pre-determine all that during content creation! All you have to do is convert it into pure triangles and send it to the GPU!  Hand Shake LeftGrin

Approximating Bezier curves is not the lightest of operations, no. All I can say to that is... So don't use them excessively. The algorithm I have here takes ~50 multiplications per curve and a few additions per point per curve (quadratic, naturally). (actually, I'm surprised it's not heavier than that!)

OpenGL probably even completely automates it.

It doesn't.

Alright, but it's still fairly trivial by just using models of varying levels of detail. You can do this at load-time, even dynamically.



Bottom line is, if you want resolution-independence, vectors are the only way to achieve that. It requires more work, but it also has other advantages like skeletal animation, procedural detail, collision detection, and so on. If you're not willing to try it, then there's nothing more to discuss, because there isn't any other way, period.
« Last Edit: March 14, 2009, 07:19:29 PM by Core Xii » Logged
hexageek
Level 0
***



View Profile
« Reply #31 on: March 14, 2009, 11:43:59 PM »

I can achieve resolution independence with raster artwork (scaling down high-resolution textures)  although with vectors it's much more easy.

What I'm worrying about is the aspect ratio. Vectors have no advantage in this. If I want to support widescreen and 4:3 at the same time I'll have to change my viewport according to it meaning for widescreen I'll have to show more of the level. I don't want it but I there are no other options  Cry
« Last Edit: March 15, 2009, 03:53:59 AM by hexageek » Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #32 on: March 15, 2009, 02:00:46 AM »

2- And still I don't think you can achieve the same detail level. In raster you can simply push pixels. There is no limit.

Actually, technically, with raster there precisely exists a limit - The pixels are the limit. You can't make anything smaller than a pixel. With vectors, you truly have no limit, you can make as small details as you want and they'll show up when you zoom close enough.

I don't know any games that use vectors so I can't give you a good example.

Loco Roco could be one, Patapon i believe it's a mix and a lot of (sucky) flash games are made in vector graphics too.

The limit doing vector graphics are simple to understand: you don't have the same tools, you can't do a watercolor-like painting in vector graphics, you can only do almost flat thing or use some gradients.
Also the main limit is performance, if you have a 1024x1024 pixel grid, if it's all white or if it's have a fractal painted on it it's the same performance wise, talking about vectors, it's not.

Also, as you said very few games use vector graphics, and it's not lazyness.

Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #33 on: March 15, 2009, 02:42:17 AM »

The limits of doing raster graphics are easy to understand. You don't have tools than can arbitrarily scale and blend things without worrying about artefacts. And they are limited in performance, as you cannot even draw a simple white polygon without it costing as much as a complex fractal design. Animations work out poorly in raster graphics, and they are less efficient to store.

But seriously, vector graphics aren't inferior to raster, they are just difference. There is an empirical difference in performance, but that is due to the fact rasters are fundamentally closer to how machines operate. (Flash is also dog slow, but that's a different matter).
You complain it is difficult to draw vectors, but this is not true, it's just difficult to draw raster like things. The converse also applies. I've seen many beautiful and/or good Flash games. For the record, Flash does let you paint onto the canvas, just is solid blocks of color.

Not many games use vector graphics, for two reasons, imho. 1) Performance. 2) Lack of good libraries (not tools). Outside of Flash, there's little which actually attacks it properly. Also 3) they use a blend of both, but people categorize the game as raster; how many games use vector like behaviour for particle effects, shadows or even just 3d meshes.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #34 on: March 15, 2009, 03:10:44 AM »

still answering "use vectors" to how makes 2d games with several resolutions support it nonsense. Is like saying "use 3d landscapes" to someone asking how to do parallax scrolling layers.
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
hexageek
Level 0
***



View Profile
« Reply #35 on: March 15, 2009, 04:07:30 AM »

I've just tried WoG with different resolutions.

*the game works native on 4:3
*for 5:4 (1280x1024) it pans the viewport with 32px black border thus it becomes 4:3
*for 16:10 (widescreen) there is no panning. it changes the viewport (makes it wider).

that looks like the solution whether I use vector or raster artwork.

@core xii
http://elemento11.deviantart.com/art/Just-a-Dream-113730653
http://pbario.deviantart.com/art/Pirate-attack-114247588
http://anez-erynlis.deviantart.com/art/Underwater-city-113657592
http://snowskadi.deviantart.com/art/233-83503802
http://snowskadi.deviantart.com/art/Gorod-90073303
http://snowskadi.deviantart.com/art/249-75482010
you simply can't do these in vectors and these images are exactly on the same level of detail and art that I'm looking for my game.
Logged
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #36 on: March 15, 2009, 06:04:28 AM »

I can achieve resolution independence with raster artwork (scaling down high-resolution textures)

No, you cannot. Downscaling works for smaller resolutions but not larger ones. That is the main issue here. Upscaling raster looks bad.

still answering "use vectors" to how makes 2d games with several resolutions support it nonsense.

The question here was not to support "several" resolutions, but rather complete independence of resolutions whatsoever. Vectors are the only way to achieve that.

@core xii
[...]
you simply can't do these in vectors and these images are exactly on the same level of detail and art that I'm looking for my game.

You can, it's just very, very hard.

But really I don't see what's the point of discussing this further; If you want resolution independence, like I've said, vector is the only way to achieve that. If you don't want to use vectors, then you can't have resolution independence. Simple as that.
Logged
hexageek
Level 0
***



View Profile
« Reply #37 on: March 15, 2009, 06:17:21 AM »

As I said before, I'll never upscale. I'll make artwork according to the highest-resolution that I want my game to support and I'll downscale from this. I guess I should say semi-independent then Smiley

Thanks for your input though it's been very informational.

Quote
But really I don't see what's the point of discussing this further; If you want resolution independence, like I've said, vector is the only way to achieve that. If you don't want to use vectors, then you can't have resolution independence. Simple as that.
well the start of this conversation was your statement about the detail of vector images and I'm not convinced about it :D I don't care if it's possible in theory, I need practical solutions.
« Last Edit: March 15, 2009, 06:21:37 AM by hexageek » Logged
Will Vale
Level 4
****



View Profile WWW
« Reply #38 on: March 16, 2009, 01:42:49 AM »

The whole triangles per second figure is completely irrelevant, as if you're running a game at 60 frames per second, that figure means nothing. Even with modern graphics cards, you will only be able to render about a hundred thousand polygons AT THE ABSOULTE MAX at that framerate (I'm talking untextured, no-shader polygons, and that figure drops SHARPLY once textures and shaders are involved).

Here are some oldish VBO benchmarks from a couple of years ago:
http://www.sci.utah.edu/~bavoil/opengl/vbo/data_types/

The Win32 build of the benchmark made available on that page seems pretty fishy to me - if I get 60fps with one triangle, and 60fps with 1M triangles, I think they might be using vysnc which means the numbers aren't really meaningful.

I seem to recall that we could push around around 300K triangles per frame at 60Hz in Powerdrome on Xbox 1 (basically a GeForce 3) and I suspect modern cards can do a bit better than that Smiley If I can find the time I'll try and find some supporting evidence, but on first examination the DXSDK samples (on 8800GT) display some pretty good real-world triangle rates, albeit not for very interesting triangles.

Cheers,

Will
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #39 on: March 16, 2009, 07:27:59 AM »

Yeah, I don't know the exact numbers for the cards these days (and they will be very different based on your OS/rendering pipeline anyway), but I was just trying to average things out with what I understand older cards can do, which you'll probably want to support if you're doing a 2D game anyway.

My point was that the number is in the thousands, not millions.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Pages: 1 [2] 3
Print
Jump to:  

Theme orange-lt created by panic