beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks
TRANSCRIPT
Beginning Direct3D Game Programming:1. The History of Direct3D
Division of Digital Contents, DongSeo University.April 2016
Long time ago… Before Windows, DOS was the most popular operating
system for the PC. In this chapter, you will learn about:
– The history and earlier versions of DirectX, leading up to the current version.
– The introduction of point sprites and vertex and pixel shaders in DirectX 8.
– The basics of 3D textures.
2
Raster graphics
In computer graphics, a raster graphics image is a dot matrix data structure representing a generally rectangular grid of pixels, or points of color, viewable via a monitor, paper, or other display medium. Raster im-ages are stored in image files with varying formats.
3
Triangle A basic primitive for a mesh. Uniquely define a plane with minimal points. An internal point can be represented relatively easy way.
– Barycentric Coordinate
A polygon must be converted to the collection of trian-gles.
4
Triangle Tessellation A polygon must be converted to the collection of trian-
gles.
5
hole
DirectX Release History
6
7
DirectX 6/7 Until the advent of DirectX 8.0, Direct3D consisted of
two distinct APIs: Retained Mode and Immediate Mode. Retained Mode was built on top of Immediate Mode
and provided additional services, such as frame hierar-chy and animation.
Development of the Retained Mode API has been frozen with the release of DirectX 6.0.
The major changes between Direct3D Immediate Mode versions 6.0 and 7.0 affected the support of hardware-accelerated transformation and lighting.
8
9
DirectX 8 Point sprites (hardware-supported sprite objects) 3D volumetric textures (textures with three dimen-
sions) An improved Direct3DX library (which provided many
useful and highly optimized routines) Vertex and pixel shaders (which interface to program
the graphics processor directly) N-patches (which add an algorithm and vertices to a
model to get a higher tessellated model)
10
Point Sprites Support for point sprites in Direct3D 9 enables the high-
performance rendering of points (particle systems). Point sprites are generalizations of generic points that
enable arbitrary shapes to be rendered as defined by textures.
11
3D Volume Textures
12
D3DX Library Enumerating device configurations Setting up a device Running full-screen or windowed mode uniformly Running resizing operations Calculating vector and matrix operations Simplifying image-file loading and texture creation Drawing simple shapes, sprites, and cube maps
13
Vertex and Pixel Shaders
14
15
Assembly Shaders
16
N-patches
Function In mathematics, a function[1] is a relation between a set
of inputs and a set of permissible outputs with the property that each input is related to exactly one output.
An example is the function that relates each real num-ber x to its square x2.
This function commonly denoted by f(x) = x2
or y = x2
17
Implicit function In mathematics, an implicit equation is a relation of
the form R(x1,..., xn) = 0, where R is a function of several variables.
For example, the implicit equation of the unit circle is x2+y2-1=0
18
The unit circle can be defined implicitly as the set of points (x,y)satisfying x2+y2=1. Around point A, y can be expressed as a function y(x), specifically g1(x)=. No such function exists around point B, where the tangent space is vertical.
19
Parametric function In parametric function, the outputs will be determined
by a function of the parameter(for example 'u'), and the value of the parameter changes within a certain range.
x=f(u), y=g(u) , where 0 <= u <= 1 Above equation can be denoted in this way: (f(u),g(u)) , where 0 <= u <= 1 A parametric function is a general way for representing
a curved line.
20
B-spline with control points/control polygon, and marked component curves
21
Draw a spline with a paper and a pencil
22
To more higher dimension A parametric surface is a surface in the
Euclidean space R3 which is defined by a parametric equation with two parameters
Parametric representation is a very general way to spec-ify a surface.
23
In computer aided design, computer aided manufacturing, and computer graphics, a powerful extension of B-splines is non-uniform ra-tional B-splines (NURBS).
NURBS are essentially B-splines in homogeneous coordinates.24
25
DirectX 9 The overall API has not changed much from DirectX 8.1
to DirectX 9.0. The new version introduced new and very much im-
proved vertex shader and pixel shader standards, including the vs_2_0, vs_2_x, and vs_3_0 vertex shader standards and the ps_2_0, s_2_x, and ps_3_0 pixel shader standards.
To be able to write shaders in the most efficient way, an HLSL (High-Level Shader Language) was introduced in DirectX 9.
A scissor test and line anti-aliasing were introduced. The support of Multiple render targets. The support of up to 24-bit color precision. The DirectX 9.0 SDK provides a programming frame-
work.26
HLSL
27
Scissor test
We can cut off the outside stuff of scissor rectangles.
28
Tessellation
29
Anti-aliasing
Above left: an aliased version of a simple shape; above right: an anti-aliased version of the same shape;
right: The anti-aliased graphic at 5x mag-nification.
30
Multiple Render Targets Multiple Render Targets (MRT)
refers to the ability to render to multiple surfaces (see IDirect3D9Surface) with a single draw call.
31
DirectX 10 Incorporates Microsoft's high-level shader language
4.0. The Direct3D 10 API introduces unified vertex shader
and pixel shader. DirectInput and DirectPlay have been deprecated and
some of their components removed.
32
Dx10 Pipeline
33
Geometry Shader Applications
34
Full control over the whole triangle– All-GPU Material Systems– Better materials
• Hi-quality interpolation and derivatives• Wrinkle models• Cartoon and falloff effects
Geometry/data amplification– Fur/Fins– Procedural geometry/detailing– All-GPU Particle Systems– Data visualization techniques– Wide lines and strokes– …
Geometry ShaderGeometry Shader
Shadow volume generation
Generalized displacement maps Normal mapping
(Direct3D 9)
Generalized displacement maps Displacement Mapping
(Direct3D 10)
Single Pass Render-To-Cubemap
x
y z
uv
Geometry Shader
Shader Model 4.0 Common Shader Core Full integer/bitwise instruction set
– Massively parallel image and data processing– Custom decompression schemes
Buffer Load – CPU-like unfiltered memory ac-cess
Switch statements and subroutines No limits
– More interstage registers, samplers, textures– Unlimited instruction count
DirectX 11 GPGPU support (DirectCompute). Improved multi-threading support to assist video
game developers in developing games that better uti-lize multi-core processors.
Hardware tessellation and Shader Model 5.0 require Direct3D 11 supporting hardware.– Tessellation is implemented on the GPU to calculate a
smoother curved surface from a coarse (less detailed) input patch.
40
References https://en.wikipedia.org/wiki/DirectX
41