So, you are interested in Direct X. Man you’ve got guts! Well, Let’s do it. It all began with man’s imagination…

Your mind is an amazing machine, sensing changes in the environment, and seamlessly piecing it all together to form one. Huge. Big picture. We have an amazing ability to smoothly experience events in reality and see the greater picture -even without thinking about it consciously.

Many technologies contributed to the advanced of modern-day gaming and supporting ideologies. For one, the invention of recorded moving pictures in the 1800’s led to the idea of moving pictures, in rapid succession, creates a phenomenon of perception in the eyes and brain that make it possible for us to experience a fluid motion, or transformation of location. This is considered the Phi Phenomenon and is very real thing.

Alan Turing, and countless physicist and engineers, such as Maxwell Planck, Albert Einstein, Nichola Tesla, Thomas Edison, to name a few; created, invented, and discovered concepts in math physics and engineering to bring you a complex system of high-level input / output subsystems capable of receiving high level instruction. Um… the computer.

Direct X is a hardware interfacing API (Application Programming Interface) that allows software developers to create applications that require hardware acceleration on the Windows platform. Using these tools vastly decreases the time to build and manage applications that would otherwise have a longer build time. To get started, we’ll talk about the core of the Direct X API, the graphics pipeline.

The DirectX Graphics Pipeline

The DirectX workflow that follows raw data to a beautiful image on screen is considered the graphics pipeline, and we’ll talk about this in a second, but let’s first consider a simpler process.

While basic geometrical concepts can be found at this tutorial, let’s rehash a bit. Suppose that I needed to see something on a screen. Maybe a bit further. Suppose I needed to see it move. In 3D. Like twirling and stuff.

What do you think you would use? If you thought math you were right. If you thought peanut butter and jelly sandwiches, it’s going to be OK. No, really! It is!

We know that we can, at the very least, make a dot on the screen: color a pixel differently than the rest, and poof! Instant dot.What is the point? The point is the simplest form of location, stating an axiom that something is here. Period. (One dimension)

In 2D space, a point is represented by what’s called an ordered pair, denoted p(x,y). Equivocally, in 3D space a point is denoted by the 3-tuple p(x, y, z). (Sorry we whipped out the tuple word. we’ll add the simple definitions to Math concepts and post a link to the complex stuff inline to smooth the OCD levels in your curious minds, such as this link to the Tuples definition)

Now, lets make two dots. With two dots, we can define and draw a line (Two dimensions) maybe a simple picture if we’re creative enough.

Ok, three dots with lines make a triangle and we can stop here, since it is here that we can create madness. (Please refrain from kicking me into a bottomless pit after searching your emotions and awaiting your wife’s nod of approval.) Yet again, the simplest, yet most significant thing in computer graphics happens. A small area is made by that triangle. Maybe something to draw pictures on.

Imagine now that we combined many triangles together, and out of those triangles, we made a triangle sculpture of a human face. Awesomely creative, right?

But this is not enough. We can do more! If we redraw this face made of triangles a few times on the screen at different angles, we can make a basic animation of the face turning, and if we can draw it 30 times a second, the turning action will be really smooth. This is the basic concept behind building a 3D game:

  • Storing a really cool looking sculpture of triangles somewhere.
  • Sending it out to a video card that draws it onscreen.
  • Redrawing that picture 30 or 60 (or 120, if you can) times in one second.

…And doing special stuff to that sculpture of triangles to make it more life-like, like drawing a picture of a smiley-face on its triangle sculptured face.This is called the Graphics Pipeline:

Before we look at the DirectX 11 graphics pipeline, let’s look at the DirectX 10 graphics pipeline.

The Breakdown

Input-Assembler Stage

This stage is for you to tell the graphics card what to expect. Consider: You decide to send the graphics card some data. You make an array that looks like this and send it to your graphics card:

{ T, r , o, l, o, l, o, l. 7, 34 ,2 ,1 ,4 ,9.56, 11, 45, t}

Your graphics card doesn’t care anymore. In fact, enjoy your peanut butter and jelly sandwiches. Ok, now let’s use the Input Assembler. Communication is key! You tell your graphics card, Hey! I want to send you some data, but I know data can be confusing, so here’s a description of what I’m sending!

Your description looks something like this:

COORDSXYZ

You send a data structure like

{

0, 0, 0

1, 0, 0

1, 1, 0

0, 1, 0

}

So, your graphics card goes Wow! You are sending me some coordinates that look like a box! Look at this! The Input Assembler Stage tells the graphics card that you are sending a particular type of data, for the simple fact that you could be sending it absolutely anything!

Vertex-Shader Stage

This is one of two of the most important – and note that importance may vary with you goals for your game- stage of your programs pipeline. Here your program handles geometry to pass to the video card and handles important data to pass to the pixel shader, help to accomplish thing such as lighting, or even the warping of the geometry data.

After decoding the data from the input assembler stage, this data is passed to the vertex shader, which processing it and passes it along.

Geometry-Shader Stage

This is actually a higher level concept, which we will touch on later, but if you are super curious, you can head here.

Stream-Output Stage

Later on, you will want to handle other cases in your game, such as reducing latency by varying the load method. Which is also an advanced topic we will discuss somewhat later.

Rasterizer Stage

The rasterizer stage is where all of your data that is been sent to be drawn is rasterized, or turned into pixels on the screen. The proper explanation is that the 3D space that you have been using in your geometry is turned into 2D space to show on the screen.

This as you can imagine is quite important. The miracle of displaying 3D space is really just the finesse of mathematically converting coordinates in 3D space into 2D space at high speed. Ok, very high speed.   

Pixel-Shader Stage

The pixel shader stage allows for the control of the pixels on the screen. Things like bump mapping, normal mapping, light shading, all are features of the pixel shader stage, so you can see the importance. Without the pixel shader you soon discover that actual geometry is limited to how much you can display on the screen.

We’ll leave off here for the beginning concepts of Direct X, but if you want to suggest something to add, leave a comment or suggestion below!

Leave A Comment

Leave a Reply

Your email address will not be published. Required fields are marked *