Direct3d Shopping
Direct3D
Articles about
Direct3d
Website Links For
Direct3d
 

Information About

Direct3d




Direct3D is a and the Video Card on the user's computer does not support that feature, Direct3D will not Emulate it. The API does define a '' Reference Rasterizer '' (or REF device), which emulates a generic graphics card, although it's too slow to be used in any application to emulate Pixel Shaders and is usually ignored.

Direct3D's main competitor is OpenGL . There are numerous features and issues that proponents for either API disagree over, see Comparison Of Direct3D And OpenGL for a summary.


ARCHITECTURE


Direct3D is Microsoft DirectX API subsystem component. The aim of Direct3D is to abstract the communication between a graphics application and the graphics hardware drivers. It is presented like a thin abstract layer at a level comparable to GDI (see attached diagram). With a COM based architecture, the main difference between GDI and Direct3D is that Direct3D is directly connected to display drivers and gets better results at rendering than GDI.

Direct3D is an ''Immediate mode'' graphics API. It provides a low-level interface to every video card 3D function ('' Transformations, Clipping, Lighting '', ''materials'', ''textures'', '' Depth Buffering '' and so on). It also had an higher level ''Retained mode'' component, that has now been discontinued.

Direct3D immediate mode presents three main abstractions: ''devices'', ''resources'' and ''swap chains'' (see attached diagram). ''Devices'' are responsible for rendering the 3D scene. They provide an interface with different options of renderization. For example, Mono device provides white and black renderization and the RGB device uses colours to render. There are four types of devices:
  • HAL (''hardware abstract layer'') device: if it supports hardware acceleration, the Direct3D code can run at hardware speeds.


  • Reference device: it is necessary to install previously the Direct3D SDK to use this device type, as this allows it to simulate those new features that aren’t yet supported by the graphics hardware.

  • Null reference device: it does nothing but returns a black screen. This device is used when the SDK is not installed and a reference device is requested.

  •   url http://wwwmicrosoftcom/downloads/detailsaspxFamilyID=57d03491-6c49-4429-bff7-130408b5f410&DisplayLang=en
      title Software Rasterizer for DirectX 90 SDK



Every device contains at least one ''swap chain''. A ''swap chain'' is made up of one or more back Buffer surfaces (rectangular collection of Pixel data and its attribures such as colour, depth/stencil, alpha or texture). In the Back Buffer is where the render will occur.

Moreover, devices contain a collection of ''resources'' too. ''Resources'' are specific data used during rendering. Each resource has four attributes:
  • Type: it describes what kind of resource is: surface, volume, texture, cube texture, volume texture, surface texture, index buffer or vertex buffer.

  •   url http://wwwtoymakerinfo/Games/html/d3d_resourceshtml#MemoryPool
      title Direct3D Resources - Memory Pool


  • Format: it describes the layout of the resource’s data in memory, mainly pixel data. For example, ''D3DFMT_R8G8B8'' format value means a 24 bits Colour Depth (8 bits for red, 8 bits for green and 8 bits for blue).

  • Usage: it describes, with a collection of Flag bits, how the resource will be used by the application. These flags are used to know which resources are used in dynamic or in static access pattern. Static resource values don’t change after being loaded, whereas dynamic resource values are repeatedly modified.



PIPELINE


  url http://wwwxmissioncom/~legalize/book/preview/poster/pipeline-90png
  title Direct3D 90 pipeline diagram


  url http://msdn2microsoftcom/en-us/library/bb205123aspx
  title Direct3D 10 pipeline stages


#Input Assembler: Supplies the data to the pipeline.
# Vertex Shader : Performs single vertex operations such as transformations, skinning or lighting.
# Geometry Shader : Processes entire primitives (triangles, lines or vertex) and, sometimes, their edge-adjacent primitives. Given a primitive, this stage discards it, or generates one or more new primitives.
#Stream Output: Stores on memory previous stage results. It is useful to recirculate data back into the pipeline.
#Rasterizer: Rasterizes primitives into pixels, clipping what is not visible.
# Pixel Shader : Pixel operations such as colour.
#Output Merger: Merges various types of output data ( Pixel Shader values, depth/stencil...) to build the final result.

It is possible to configure all the pipeline stages, making it very flexible and adaptable.



EXAMPLE

Drawing a triangle in Direct3D:

// A 3-vertex polygon definition
D3DLVERTEX v {Link without Title} ;
// Vertex established
v {Link without Title} =D3DLVERTEX( D3DVECTOR(0.f, 5.f, 10.f), 0x00FF0000, 0, 0, 0 );
// Vertex established
v {Link without Title} =D3DLVERTEX( D3DVECTOR(0.f, 5.f, 10.f), 0x0000FF00, 0, 0, 0 );
// Vertex established
v {Link without Title} =D3DLVERTEX( D3DVECTOR(0.f, 5.f, 10.f), 0x000000FF, 0, 0, 0 );
// Function call to draw the triangle
pDevice->DrawPrimitive( D3DPT_TRIANGLELIST, D3DFVF_LVERTEX, v, 3, 0 );


Drawing a triangle in Direct3D 9


struct Vertex { float x, y, z; D3DCOLOR color; };
Vertex triangle {Link without Title} = {
{ 0.f, 5.f, 10.f, 0x00FF0000 },
{ 0.f, 5.f, 10.f, 0x0000FF00 },
{ 0.f, 5.f, 10.f, 0x000000FF }
};
// set Flexible Vertex Format
  url http://wwwgamedevnet/reference/articles/article1028asp
  title Direct3D 60 introduces multitextures


  url http://msdnmicrosoftcom/archive/defaultaspurl=/archive/en-us/directx9_c/directx/graphics/reference/ddsfilereference/ddsfileformatasp
  title Direct3D 7 introduces DirectDraw Surface (dds) format


  url http://wwwgamedevnet/reference/articles/article1247asp
  title Direct3D takes over DirectDraw


  url http://wwwmicrosoftcom/presspass/press/2003/Jan03/01-22DirectXHLSLPRmspx
  title HLSL in Direct3D 90


  url http://msdn2microsoftcom/en-us/xna/aa937781aspx
  title DirectX 10 SDK available since February 2007


  url http://wwwtomshardwarecom/2006/11/08/what_direct3d_10_is_all_about/page6html
  title Direct3D 10 Additional Improvements


  url http://wwwtheinquirernet/article=41577
  title Vole shoots foot with 101 upgrade
  publisher theinquirernet
  last Ferretfirst=Willy
  accessdate 2007-08-20
  "http://wwwinformationdelightinfo/information/entry/2007-08-09" class="copylinks">2007-08-09