Jump to content
  • Advertisement

Archived

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

CondorWitte

Help! Is DX8 THAT slow on 2D gfx ? Or am I?

This topic is 6504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy. I have tried about every approach in doing 2D gfx using the IDirect3D8 interface (including D3DX8), but I cannot get any decent speeds (framerate) for any 2D gfx other than Cubic Pow2 sprites up to 256x256 pixels. I tried CopyRects(), ID3DXSprite, two-triangle-meshes, but it just won''t go beyond +/- 45 FPS (PIII-500, Matrox Marvel G400 16Mb, 256Mb RAM, Intel SE440BX2 mainboard). This is when ''blitting'' a single 640x480 bitmap/texture/sprite to the screen. I have installed both the debug- and retail versions; i can switch between these two for D3D & DAudio in the Control Panel. They''re both set to retail. D3D8 is fantastic as far as 3D gfx is concerned, but the lack of 2D speed would render it completely useless...I must be doing something wrong. Please help me out. ;o) Thanx in advance, and greetings, CondorWitte

Share this post


Link to post
Share on other sites
Advertisement
Well first things first. All d3d textures (aka sprites in this situation) need to be a power of 2. If it is not a power of 2 then the computer will automaticaly scale up the bitmap to the nearest power of 2, which causes slow downs. And if you haven''t noticed yet 640 is not a power of two and 480 is not a power of two.

As far as the 256x256 texture size, Your matrox card most likely supports hardware acceleration for textures up to that size, so when ever you go larger your using software emulation to make those textures available to you.

Here are a couple of resolutions to your problem:

#1. Keep your texture''s down to a max of 256x256.

#2. There are many ways to texture a polygon, strapping a texture onto the 4 corners of a textured quad are only one option. You can also tile a 32x32 texture on the surface this will effectivly be the same as creating a 32x32 tile in the old 2d games.

#3. Take your large 640x480 image and break it down in to 256x256 sections and then place them on multiple polygons.

#4. Also if your video card allows you you may want to turn off V-SYNC. This will cause the frames on your game to lock at the refresh rate of your monitor (which in your case could be 45 hertz).

If you use these options you should notice a significant increase in preformance.

Share this post


Link to post
Share on other sites
Thanx for your help, but I'll try to explain why I'm not that happy with the offers you propose:

1. Since most games (and presentations, etc.) are played on 800x600 resolution, 256x256 sprites/bitmaps/billboards are simply too small. (Compared to DX7 speed)

2. Perfect solution, but it only works on tilebased games, which is about 10-25% of the usage of the whole engine, and it doesn't solve the problems regarding cutscenes, menus, etc.

3. This is the biggest problem: the Pow2 limit. It results in either bad layout (everything cubical), very unefficient usage of VRAM (imagine 2D animations...) or an increase in production times of about a factor 10. The main reason DX8 was released (besides great new stuff like a shader language), was the improved simplicity and faster/easier development cycles.

4. My refreshrate is 76Hz, and my core loop is indeed locked to that. DX7 however has no problem there at all :-)

Anyway, thanx a lot for spending some time to help me out, but it becomes clearer and clearer that the best thing for me to do is forget about DX8 and wait for better times (DX9?)

Greetings, CondorWitte

Edited by - CondorWitte on November 30, 2000 9:14:32 PM

Share this post


Link to post
Share on other sites
Yes i think 2D done with 3D is slow as hell

direct pixel manipulations will allways be faster, think about it: even a polygon with a 2D texture takes some power to render (with no use if we see it from top) and then 2D games have a LOTs of sprites that CAN NOT be in Video RAM and worst cant be updated so fast (every frame) without big speed loose in 3D....

So 2D is still usefully for 2D ...just some ppl dont get it...

i also keep my DirectX7 maximum interfaces (for my 2D RTS)

if they dont do smthing for 2D soon games are going to permanently move on Consoles or win95 or Linux or my ASM OS (when is ready...)

Hope they hear us.....(*yeah right)

Share this post


Link to post
Share on other sites
As a side note even in direct draw you can gain preformance by keeping your bitmaps at a size which is a power of 2. The computer can not process the information correctly if it''s not and what happens is that the computer will automaticaly scale the bitmap up to the closest power of 2 before blitting it to the screen. When you pre-calculate this transition it saves you alot in processing time EVEN IF THE BITMAP IS LARGER!

Most 3d games currently do not support over 256x256 textures, the only ones I currently know of are Unreal, and Lithtech which use s3 texture compression which as of yet is not supported on every video card. The companies use textureing techniques like tiling, and streaching along with mip-mapping and similar with their 256x256 textures to ease the noticible pixelation.

As far as the 2d animations you speak of, it''s easily done with a short change of UV coordinates. In a texture bitmap much like quake''s "skins".


It honestly takes a diffrent type of thinking to enter the wonderful world of 3d. You have to think about the entire project, the hardware it''s running on. You often "cheat" alot more than you would in direct draw. For instance the starwars demo I just finished we textured a 1000 polygon AT-AT with a single 256x256 texture. The world sphere surrounding our terrain was a 128x256 bitmap, and the terrain texture it self was a 32x32 bitmap which was tiled. It looks wonderful. Doing 2d in D3d is possible but you realy need to know alot more about the computer than you would in 2d. The power of 2 thing is just one example, there are plenty of other considerations you need to think about, how many polygons can you have on screen..do you want to draw all the polygons which aren''t on the screen or do you implement some type of culling, it''s all a bunch of trade off''s.

You can still use direct draw to do what you wish and get away with using odd sized bitmaps with out an extremly noticible speed decrease. However I''m guessing that the transition to d3d was more of a learning experiance for you than it was to get an entire game done. In which case I would stop thinking ddraw and start trying to pick up d3d.

Share this post


Link to post
Share on other sites
As far as your ''upscaling'' theory regarding DirectDraw concerns: I have never heard/read about this, and to be honest - I don''t think you''re right there. If the Gfx-chip would scale up any image to a power of 2 before blitting, it would scale up to a power of 2 first, then down again to the desired size. Besides the fact that this is a complete waste of cycles, sooner or later some artifacts should show up when blitting images over a matching background. I think a straightforward blit just writes (copies) lines to the display memory.

A 2D animation that fits in a 256x256 texture cannot be as cool as one that fits into 4096x4096.

Although 3D programming+mathematics are a lot more complex and processing-intensive as their 2D counterparts are, the way of thinking is quite identical; every wasted CPU/GPU cycle is a bad thing, and to avoid them requires extensive knowledge of the inner workings of the system.

To achieve great performance when blitting 2D surfaces, the bounding box for and object that is blitted over a matching background should be as small as possible. So, if you should do this efficiently, all object should be about cubical. This would be a ridiculous limit for the gfx designers. The other option is throwing away 10-50 % of video memory...

The world of 3D is -to me- only wonderful if I can use 2D elements whereever needed (for technical or aesthetical reasons). Using more difficult 3D approaches to get a lesser result doesn''t seem like such a wonderful development to me ;-)

So, before I start insulting the good folks at Microsoft, I think I''ll dive into the DX7 SDK to get me a nice 2D/3D compromised engine. If I''m right, everything will be taken care of in DX9. If I''m wrong, I''m sure they''ll have their documentation adjusted by then to learn people like me how to do things right.

Greetings, CondorWitte.

Share this post


Link to post
Share on other sites
Trust me (well, on every computer I''ve used ). Using 3D for 2D stuff is way faster than just 2D, especially if using alpha, scaling and/or rotation as these are effectively free.

The power of 2 limitation is due to the hardware. If you''ve ever written a software renderer, you''ll know it''s a lot simpler to deal with fixed powers of two, thus the hardware does this - less logic means more efficient rendering.

To do bigger sprites, just use multiple textures, i.e 640 = 2*256 + 128. If you moved over to consoles such as the Playstation, you''ll find exactly the same limitations, except you will have far less video RAM. All textures on the playstation are 256x256.

Share this post


Link to post
Share on other sites
I agree,

using 3d Hardware for 2D is MUCH faster than doing it yourself in software if Alpha Blending and rotation is needed.After all you have a dedicated chip doing it for you.

However, it is also true that this Using 3D for 2D is not ideal in many instances.Microsofts offivial line of "If you want 2D use Dx7" does seem a bit of a cop out.This is especially true if you want to access the new dx8 features and still use 2D.

Saying that though, for the majority of applications you can use 3d for 2d and will actually get imprved frame rates.

just my 2 cents

Share this post


Link to post
Share on other sites
I was reading this thread and have a couple of questions. I just started learning 3D, so I don''t know a lot. If you can do alpha blending and rotation on a 3d object with a 2d texture, why couldn''t the hardware do alpha blending and rotation on just a 2d texture? Doesn''t it have to do that when doing 3d? Also, if 3d is built on top of, and uses 2d, it doesn''t make sence that 3d would be faster than 2d. Maybe I just don''t really understand 3d that well, or maybe I just don''t understand 2d either. Also, a little off topic, but isn''t the X-Box going to be using DX8? And, since most of the console games are 3d, it would make sence to make a API that focuses on 3d. Just some thoughts that popped in my head. Thanks for your time!

"I kinda think, therefore, I kinda... am?"

Share this post


Link to post
Share on other sites
Okay, so what this thread actually points out, is that a single engine (wrapper) for both ends of the rope is no good.

DX8 simply WILL NOT MIX with DX 1-7. Fair enough.

Let''s make two then (After all, the pure 3D stuff got a lot easier in DX8). I just hope the ''classical'' one can be dropped at the arrival of DX9, without everything being textured mesh.

Greetings, CondorWitte.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!