beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

42
Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics [email protected] Division of Digital Contents, DongSeo University. April 2016

Upload: jintaek-seo

Post on 13-Apr-2017

73 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Beginning Direct3D Game Programming:1. The History of Direct3D

[email protected]

Division of Digital Contents, DongSeo University.April 2016

Page 2: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 3: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 4: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 5: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Triangle Tessellation A polygon must be converted to the collection of trian-

gles.

5

hole

Page 6: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

DirectX Release History

6

Page 7: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

7

Page 8: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 9: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

9

Page 10: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 11: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 12: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

3D Volume Textures

12

Page 13: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 14: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Vertex and Pixel Shaders

14

Page 15: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

15

Page 16: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Assembly Shaders

16

Page 17: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 18: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 19: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 20: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 21: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

B-spline with control points/control polygon, and marked component curves

21

Page 22: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Draw a spline with a paper and a pencil

22

Page 23: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 24: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 25: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

25

Page 26: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 27: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

HLSL

27

Page 28: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Scissor test

We can cut off the outside stuff of scissor rectangles.

28

Page 29: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Tessellation

29

Page 30: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 31: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Multiple Render Targets Multiple Render Targets (MRT)

refers to the ability to render to multiple surfaces (see IDirect3D9Surface) with a single draw call.

31

Page 33: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Dx10 Pipeline

33

Page 34: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 35: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Shadow volume generation

Page 36: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Generalized displacement maps Normal mapping

(Direct3D 9)

Page 37: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Generalized displacement maps Displacement Mapping

(Direct3D 10)

Page 38: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

Single Pass Render-To-Cubemap

x

y z

uv

Geometry Shader

Page 39: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 40: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

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

Page 41: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks

References https://en.wikipedia.org/wiki/DirectX

41

Page 42: Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_jintaeks