Archived

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

MatuX

DD in D3D (and vise)

Recommended Posts

MatuX    122
I have been making a graphical isometric engine for more than a month now and now my group wants to port everything to DirectX 8 (ie. no DD). The only reason is that they believe you can''t draw a 3D scene and then a DirectDraw surface (useful for shadows, special effects (like magic, fire, etc.) and lights). If this is true, all my work will be useless and I will be really really sad... (If you still didn''t understand what I mean, take this for example: You have two DD surfaces, a tree and the terrain, and a D3D texture, a magical spell which is a big circle of hyper super puper magic power. If you cast it *behind* a tree, how would you make up the scene so the DD tree is above the D3D magic spell and the D3D magic spell is above the DD terrain? Can you actually make such thing?)

Share this post


Link to post
Share on other sites
TANSTAAFL    1160
up until version 7, direct3d was built on top of directdraw, and so mixing the two was easy.

in version 8, this is no longer so. direct3d is its own subsection, not dependent on directdraw, and in a way mutually exclusive with directdraw. (if anyone has managed to mix directdraw and d3d8, speak up)

this of course, is not to say that you cannot do 2d with it, and in fact it makes many tasks for 2d a lot faster, but the methodology changes.

instead of copying rectangular blocks of pixels from one surface to another, you are texture mapping triangles. to render in recangular blocks, you need two triangles.

instead of color keys, you use alpha testing.

however, some things that were very difficult to do with 2d become incredibly simple with 3d. doing order-independent sprite layering is easy with z buffer. alpha blending is available to you. rotating 2d images is a breeze. changing the color shade of a sprite is a non-problem.

and, if you are doing 2d with direct3d, take this piece of advice: DO NOT LISTEN TO 3D PROGRAMMERS WHEN THEY GIVE YOU ADVICE ON HOW TO DO THINGS ( and they will!) they are totally convinced on how a 3D api is to be used, and it must be done the "one true way" or else you are just wrong wrong wrong.

idiots! i say. infidels!

learn exactly what direct3d does. it transforms points and renders triangles, at the simplest level. z buffers are pixel by pixel "if" statements. alpha blending is simple arithmetic, and lighting is just an application of trigonometry.

if they say the word "frustum" and you AREN''T doing a perspective projection, tell them where they can cram it.

(oh, and buy my book on doing 2d with d3d.. it comes out early next year).

Share this post


Link to post
Share on other sites
MatuX    122
Yeah, I''m already convinced.. All the points you raise are true (oh''Mighty TANSTAAFL ), at the first time I was really sad since I thought my hard work would be useless, but, hell no, after thinking about this, I already developed a fast working texture managment class hierarchy, a DirectX wrapper, hundreds of useful functions and I made my own super puper graphical file format with a Photoshop file format plugin for it, everything is usable with some minor modifications and all the classes are independent of the engine I was making so, there was really no waste of time (for what will be useless, I can say I learned a lot while making it), so, I''m happy )) heh

"(oh, and buy my book on doing 2d with d3d.. it comes out early next year)"
Heh, if you would be a friend of mine, my easy answer would be "Hmmm... Now that you mention it, NO.", but, hell yeah, I bought your great ISO book, of course I will buy this one

Two more advantages on using D3D (or OpenGL) for 2D graphics:
- it uses simple geometry, no need to worry about speed
- good games takes long to be finished, after a year, everyone will have a 3D card on their computers, and since we use 3D hardware, we don''t really need to worry about system specs
- awesome special effects (borrowed) from other source codes, tutorials and Direct3D/OpenGL books!

Share this post


Link to post
Share on other sites
KalvinB    102
I made the switch in Tombstone several months ago to use D3D to render the tiles as quads (Characters where already being rendered months prior). I''m pushing to use actual 3D models for the tiles. Once you get quads going, using models is cake.

I''m sticking with DX7 because some overlays are not powers of 2 so DirectDraw for me is still useful.

Ben

Share this post


Link to post
Share on other sites