Directx for dummies

This topic is locked from further discussion.

Avatar image for Gog
Gog

16376

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1 Gog
Member since 2002 • 16376 Posts

I decided to create this topic because I feel that even amongst the regular forumites there is a lot of misunderstanding about directx and what it does. I am in no way an expert in the field but I'd just like to explain the most basic principles.

Directx is an application programming interface (API), it's a tool for developers to ease the process of creating code for applications, in this case, mostly for games.

The Directx API includes several components for 2D graphics, networking and input devices but most people here tend to use the term directx to refer to the 3D graphics component only, Direct3D, which is the most extensive part of the API.

A program in its most basic form is a series of instructions. Those instructions can be very simple or very complex but even the most complex instructions can be broken down into a series of basic instructions. What an API does is offer a series of complex instructions the developer can use without having to code every basic instruction behind it. Let me give you an example:

 consider a simple instruction called addition (+). It takes 2 parameters (2 numbers), adds the 2 numbers and gives you the result:

+ 3,4

result = 7

 now what happens if you'd like to do a multiplication but that instruction (*) doesn't exist? You split it up in instructions that already exist:

 + 3,3

 result = 6

 you take this result and,

 + 6,3

 result = 9

 you take that result and,

 + 9,3

 result = 12

So you can resume 3*4 to 4 additions of 3. What an API does is offer you the multiply (*) instruction to make it easier for you


How does this relate to Directx and 3D graphics?

Well, creating 3D graphics is no simple matter and even drawing a simple cube for example takes a lot of effort. You have to calculate the position of each vertex (8 points that define a cube) and project them on a 2D screen. What an API like directx does is give you the possibility to draw a cube with a single instruction and a few associated parameters like the size, position and rotation angle of that cube. So instead of having to process dozens of instructions, you can just do it with one single instruction and let the API handle the rest.

Having this is very handy but this doesn't speed up your program. The API will stil have to process every instruction, split it up in the most basic parts so that the CPU can handle it. That's where video hardware comes into play. If the complex instructions from the API can be supported in hardware by the video card, there is no more need to split it up into small components, you can just let the video hardware handle it.

In the early 3D days every video card had their own instruction set so developers had to write different code for every other card on the market. That's where directx stepped in. Microsoft defined a standard instruction set and cards supporting those instructions would be directx compliant.

Since then, every new version of directx has extended this instruction set to the point where it is mature like today. Since every basic aspect has been taken care of already, a new version makes less and less difference as a result. For example a new effect X may be supported, which is just a combination of effect A and B that were already available in a previous directx version. The only difference is that there is hardware support now so X wil run faster than when combining A and B.

What I am trying to say is that there isn't anything revolutionary about directx (10). It doesn't automatically make your games look better. It just provides the developer the tools to create more complex graphics at the expense of higher hardware requirements. Thsi also implies that you could make a directx 9 game look as good or better than a directx 10 game, it just takes a little more effort.

Avatar image for DirkVDV01
DirkVDV01

20155

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2 DirkVDV01
Member since 2004 • 20155 Posts
*claps* Very nice, Gog! You might want to consider putting it into the Build an FAQ guide sticky. :)
Avatar image for jfelisario
jfelisario

2753

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#3 jfelisario
Member since 2006 • 2753 Posts
ummm STICKY!!!!!!!
Avatar image for DirkVDV01
DirkVDV01

20155

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#4 DirkVDV01
Member since 2004 • 20155 Posts
ummm STICKY!!!!!!!jfelisario
No!
Avatar image for jfelisario
jfelisario

2753

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#5 jfelisario
Member since 2006 • 2753 Posts

[QUOTE="jfelisario"]ummm STICKY!!!!!!!DirkVDV01
No!

Or put it in an existing sticky? ;) 

Avatar image for jfelisario
jfelisario

2753

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6 jfelisario
Member since 2006 • 2753 Posts
Yup just like to add, just as Gog put it, here's an example of a effect rehashed to work more better in DX10 (meaning there is a previous iteration of it in dx9). Instancing 2.0 support, allowing multiple instances of similar meshes, such as armies, or grass or trees, to be rendered in a single draw cell, reducing the processing time needed for multiple similar objects to that of a single one. Heck it even has 2.0 so you know its an improvement of a previous effect, derived from dx9.
Avatar image for DirkVDV01
DirkVDV01

20155

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#7 DirkVDV01
Member since 2004 • 20155 Posts

[QUOTE="DirkVDV01"][QUOTE="jfelisario"]ummm STICKY!!!!!!!jfelisario

No!

Or put it in an existing sticky? ;)

That's better! :)
Avatar image for TheDarthvader
TheDarthvader

7916

Forum Posts

0

Wiki Points

0

Followers

Reviews: 15

User Lists: 0

#8 TheDarthvader
Member since 2002 • 7916 Posts
what about open GL. Is there a versions of it, or its the same that made Quake 1 and Doom 3.
Avatar image for basersx
basersx

6222

Forum Posts

0

Wiki Points

0

Followers

Reviews: 7

User Lists: 0

#9 basersx
Member since 2005 • 6222 Posts

Thank you for this!!

 

Maybe this will make many of these kids see that an 8600GTS is NOT going to run Crysis "6 to 10" times faster than the same speed 7900GS!!!

Read this line he wrote - "It just provides the developer the tools to create more complex graphics at the expense of higher hardware requirements."

So that means the 8600GTS should run a game like Crysis in DX10 SLOWER than a 7900GS running Crysis in DX9!  Because it takes more hardware power to utilize DX10!

 

Avatar image for codezer0
codezer0

15898

Forum Posts

0

Wiki Points

0

Followers

Reviews: 44

User Lists: 0

#10 codezer0
Member since 2004 • 15898 Posts

what about open GL. Is there a versions of it, or its the same that made Quake 1 and Doom 3.TheDarthvader
No, there have been revisions of it over time. The latest build of the OpenGL API is currently 2.1.

The first cards to start hardware-supporting OpenGL 2.0 are with the nVidia 6800's (that I know of). 2.1 from what I've read and understood, signifies a lot of code cleanup that was done post-2.0, but with not enough new features to warrant calling it 3.0 yet. 

Avatar image for mouthforbathory
mouthforbathory

2114

Forum Posts

0

Wiki Points

0

Followers

Reviews: 5

User Lists: 0

#11 mouthforbathory
Member since 2006 • 2114 Posts
I still don't really know, the Direct X 10 API is supposed to be more efficient than DX9, therefor second to second, a game running in DX9 would have a slower framerate than a game in DX10 if you're running the same game on the same hardware, just different API.
Avatar image for Gog
Gog

16376

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#12 Gog
Member since 2002 • 16376 Posts

I still don't really know, the Direct X 10 API is supposed to be more efficient than DX9, therefor second to second, a game running in DX9 would have a slower framerate than a game in DX10 if you're running the same game on the same hardware, just different API.mouthforbathory

Since you can't run directx 10 on a directx 9 card everything is a guess. Have you ever seen a performance improvement with previous directx versions on the same hardware? 

My thoughts exactly.

Avatar image for supergamer1289
supergamer1289

2825

Forum Posts

0

Wiki Points

0

Followers

Reviews: 9

User Lists: 0

#13 supergamer1289
Member since 2005 • 2825 Posts
Sticky FTW
Avatar image for 0utc4st
0utc4st

3839

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#14 0utc4st
Member since 2003 • 3839 Posts

Yes its true DX9 is capable of some of the stuff that's in DX10 its just that it would be such a performance hit it would never run on DX9 hardware.

Avatar image for basersx
basersx

6222

Forum Posts

0

Wiki Points

0

Followers

Reviews: 7

User Lists: 0

#15 basersx
Member since 2005 • 6222 Posts

[QUOTE="mouthforbathory"]I still don't really know, the Direct X 10 API is supposed to be more efficient than DX9, therefor second to second, a game running in DX9 would have a slower framerate than a game in DX10 if you're running the same game on the same hardware, just different API.Gog

Since you can't run directx 10 on a directx 9 card everything is a guess. Have you ever seen a performance improvement with previous directx versions on the same hardware? 

My thoughts exactly.

Exactly!  I think NOLF 2 was one of the first DX9 games.  It did not run 6 to 10 times faster on those first DX9 cards than it did on the DX8 cards.  I don't remember ANY DX9 games running a lot faster on DX9 cards compared to the speed the ran are similar DX8 cards.

Avatar image for Baselerd
Baselerd

5104

Forum Posts

0

Wiki Points

0

Followers

Reviews: 14

User Lists: 0

#16 Baselerd
Member since 2003 • 5104 Posts

I still don't really know, the Direct X 10 API is supposed to be more efficient than DX9, therefor second to second, a game running in DX9 would have a slower framerate than a game in DX10 if you're running the same game on the same hardware, just different API.mouthforbathory

DirectX10 has unified shader support, so all of the shaders can be used for every shader function. So yes it is much more efficient. Think of a shader as an independant unit that performs a function in graphics processing (like a vertex shader, it calculates objects in 3d space) Now there are no vertex shaders, just shaders. They can all do everything, so each function has much more hardware calculating it.

On a side note, one thing I know DX10 added was the ability to add motion blur on single objects, rather than full-screen blur. As said in the OP, this technically is possible in dx9 also.

Avatar image for jfelisario
jfelisario

2753

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#17 jfelisario
Member since 2006 • 2753 Posts

[QUOTE="mouthforbathory"]I still don't really know, the Direct X 10 API is supposed to be more efficient than DX9, therefor second to second, a game running in DX9 would have a slower framerate than a game in DX10 if you're running the same game on the same hardware, just different API.Baselerd

DirectX10 has unified shader support, so all of the shaders can be used for every shader function. So yes it is much more efficient. Think of a shader as an independant unit that performs a function in graphics processing (like a vertex shader, it calculates objects in 3d space) Now there are no vertex shaders, just shaders. They can all do everything, so each function has much more hardware calculating it.

On a side note, one thing I know DX10 added was the ability to add motion blur on single objects, rather than full-screen blur. As said in the OP, this technically is possible in dx9 also.

 

The DirectX 10 API makes better use of it, but its not to say that the 8800's aren't using their stream processors as they should in DX9, they still are unified processors regardless of the DirectX.Â