Archived

This topic is now archived and is closed to further replies.

Xorcist

2D through 3D (the big debate)

Recommended Posts

Okay I''d been debating this for a while now with an acquaintance of mine and figured maybe some more experience individuals would like to added their two cents to it. Basically we are dicussing the ability of 3D APIs to handle 2D graphics (OpenGL and DirectX in particular). He says doing any sort of 2D (with or without included 3D aspects) will severly cut the performance of the graphics card. I say there is no difference between a 2D polygon and a 3D polygon and there should be no horrible side effects if there were a large amount of 2D graphics being shown on the screen (with or without included 3D aspects). This might be a topic better suited to the Graphics Theory forum, but maybe some people here can clear this up for us. Any resources on the net you can point us to would be greatly appreciated.

Share this post


Link to post
Share on other sites
There are situations where certain 2D techniques will slash the performace of the graphics card. These techniques usually involve locking the back buffer and accessing it directly (rather than through API methods), since locking the back buffer can interfere with the various asynchronous background graphics processes occuring on the graphics card, it causes them to function less efficiently.

However if you are using 2D polygons, rendered through the API, then these polygons are actually faster than 3D polygons for the simple reason that they don''t need to be transformed from world space to screen space since the vertices of a 2D polygon are already defined in screen space.

Share this post


Link to post
Share on other sites
As long as you stick to the same API, it shouldnt matter which option you take, 2D(eg Win32) or 3D(eg DirectX).

If you use several APIs or direct access (eg DirectDraw Locks) then it will go slowly.

Often the 2D driver software hasnt been tuned to support things like Polygons as they arnt common 2D primitives - thus the 3D option may go faster.



Share this post


Link to post
Share on other sites
So for instance if I were to use billboards to represent 2D characters it wouldn''t create a huge drop in performance because those billboards are basically nothing more than polygons that are oriented to always face the camera. What if I were to animate those billboards? Would that change anything?

Share this post


Link to post
Share on other sites
quote:
Original post by Xorcist
So for instance if I were to use billboards to represent 2D characters it wouldn''t create a huge drop in performance because those billboards are basically nothing more than polygons that are oriented to always face the camera. What if I were to animate those billboards? Would that change anything?


have you ever played any n64 games? alot of their major games used
3D worlds with 2D sprites... the first one that comes to mind is Mario Kart 64. all the tracks were 3D, but all the sprites were 2D.
paper mario (obviously) was predominantly 2D.

ask yourself this:
why in in the world would it be any slower?
think about it.. instead of having THOUSANDS of triangles joined together with
complex arrangements, you have hundreds of triangles arranged on
a 2D plane. logic says that 2D would be even faster


-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
Okay so things are looking good...

How feasable do you guys think it would be to create a game engine in OpenGL along the lines of Strider 2. Which prodominantly uses 2D for all the sprites and full blown models for the levels (and some bosses). My friend frowns upon the idea and says I''m in for more trouble than it''s worth (and it''s going to run like crap), but I have a more positive outlook on it and think it has a lot of potential (though notabley a lot of work for one person). I''ve already picked up and am reading through OpenGL Game Programming and The OpenGL SuperBible.

Any advice or references that might be helpful would be appreciated. Thanks.

Share this post


Link to post
Share on other sites
#1) your friend doesnt know what he''s talking about.
#2) it''s 100% feasible and would be alot easier than implementing
3D skeletal animation (textured billboards that is).

my advise- forget about your friend and show him how it''s done.

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
Actually it can be slower - if there is no 3D accelerator card doing the actual work (but if the API is useing such a card, then it wouldn''t effect performance in the slightest)

Without an accelerator card, the API has to use software rendering techniques...and software rendering a texture mapped triangle (or quad) is much slower then just bliting them...heck you could even write your own 2D software routines and have it be faster then useing an API without a 3D card.

Share this post


Link to post
Share on other sites
quote:
Original post by MSW
Actually it can be slower - if there is no 3D accelerator card doing the actual work (but if the API is useing such a card, then it wouldn''t effect performance in the slightest)

Without an accelerator card, the API has to use software rendering techniques...and software rendering a texture mapped triangle (or quad) is much slower then just bliting them...heck you could even write your own 2D software routines and have it be faster then useing an API without a 3D card.


it can be slower than 3D? without an accelerator card, those thousands
of polys are going to take longer than the hundreds of polys no matter
if you''re doing hardware or software rendering.

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
Having done 2D in D3D (7 and 8) as well as OpenGL, I''d go with OpenGL. It''s rediculously easy and OpenGL works a heck of a lot faster on older hardware. In fact, the DX8 version of my app won''t even run on a laptop that runs the OpenGL version (which is identical) at a solid 30fps at 800x600.

On newer hardware (GeForce) both DX8 and OpenGL work equally well. I can''t say really if one is better because the performance is currently capped by the performance of my GeForce 2 MX. Both run at ~350fps even when I went from a 700Mhz Duron to a 1.2Ghz Duron.

As for a performance boost from 2D to 3D, I was using DirectDraw for a project and it would barely hit 1fps in tile loaded areas. I switched to Direct3D 7 and the same area on the same PC (200Mhz 32MB ram, Voodoo 3 3500) ran at around 11fps.

In terms of DirectX 7 on older hardware, I don''t OpenGL would offer much of a boost over it if any. Maybe DX9 will fix DX8 in this area but I highly doubt it.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post


Link to post
Share on other sites
There are also some very neat (visually appealing) techniques that were designed for 3D - and hence only available though a 3D API, much of the time - that are implemented on 3D graphics hardware, that could still be very handy for a 2D game, like alpha blending, or perhaps lighting. The only time where this may be at all slower than not through the 3D API is when there is no 3D hardware to take advantage of.

Peace,
Brendon

Share this post


Link to post
Share on other sites
Cool, thanks for all the great info. I had a pretty good feeling this wasn''t going to be a problem, but the guy was so persistent, and so sure of himself, it made me think twice. Nice to know my initial viewpoint was not flawed. Now I just need to get to work on it.

Share this post


Link to post
Share on other sites