Three-dimensional game DirectX notes

Three-dimensional game DirectX notes

Preface

Today I read the notes I wrote in the past, so I simply migrated some of them to the blog. Remember it too.

notes

Chapter 0: Introduction

1. Online game programming:

Server: network programming, artificial intelligence, database, information security

Client: 2D game programming, 3D game programming, art design, music design

Other necessary processes: game script planning, game project management, document editing, etc.

2. The advantages of DirectX: feature-rich underlying API, wider application than OpenGL, lower level than unity, and stronger function extensions.

3. Learning content: mathematical knowledge of graphics, 3D technology (lighting, texture, alpha blending, etc.), necessary technology for 3D games (three-dimensional mesh model, animated mesh model, etc.)

Chapter 1: Object-oriented game programming principles

1. The basic process of game development: The initialization process of the game is mainly the caching of game content; the game realization process is mainly realized through alternate cycles of user operation, game logic process, and game content rendering.

Chapter 2: Basics of Windows Programming

1. The message mechanism of Windows: Describe the operating state of the program or changes in the environment through events; notify the application of the occurrence of an event through messages, and then call the corresponding program to respond. (Multi-byte character set)

2. The process of generating Windows forms: WinMain() function, designing and registering window class WNDCLASS, creating window createwindow(), displaying and updating window showwindow(), message loop MSG (getmessage, peekmessage), unregistering window class UnRegisterClass()

3. Window procedure: keyboard message WM_KEYWON, mouse message WM_MOUSEMOVE, time message

Chapter 3: Introduction to DirectX

1. Drawing pipeline: 3D object model, world transformation, viewfinder transformation, back blanking, lighting, cropping, perspective projection, viewport transformation, rasterization, 2D pictures (local coordinates, world coordinates, projection coordinates, observation coordinates)

2. Viewport transformation: zoom, pan

3 code package: Main module<-MyD3D<-D3DUT

MyD3D class: CreateDevice function (create window and get interface), initialize function (normal initialization), FrameMove function, Render function, release function (memory release), getDevice function (return interface)

Chapter 4: Basic Space Transformation

1. Left-handed coordinate system: add a Z axis pointing to the inside on the basis of the plane rectangular coordinate system.

2 Dot product is often used to judge the vertical problem between vectors. The cross product is often used to calculate the plane normal vector.

3. Matrix transformation: rotation

Chapter 5: Graphics drawing based on vertex buffer

1. Graphics rendering based on vertex buffer (IDirect3DVertexBuffer9 vertex buffer interface class)

Vertex structure settings

Create vertex buffer: CreateVertexBuffer() method

(FVF free vertex format: three-dimensional vertex, color vertex, texture vertex)

Access cache content: lock, unlock

Data stream input source specification: SetStreamSource (number, pointer, offset)

Vertex format settings: SetFVF coordinates, normals, diffuse reflection, specular reflection, texture coordinates.

Vertex buffer drawing: DrawPrimitive: type, starting point, number

2Graphic drawing based on index cache

Create a vertex index buffer: CreateIndexBuffer

Access cached content

Specify input source

Draw DrawIndexedPrimitive function

3. Graphics drawing based on color vertices

Create a color vertex buffer: CreateVertexBuffer (colorvertex)

Access to the vertex buffer lock, unlock

Rendering color vertex buffer: Flat (the first vertex is the color of the entire primitive), Gouraud (linear interpolation algorithm), Phong three shading modes

4Graphic drawing based on texture vertices

Create VertexBuffer (texturevertex)

LOCK

Texture cache: D3DXCreateTextureFromFile

Drawing of texture vertices SetTexture

Texture filter (sampling): nearest point sampling, linear texture filtering, anisotropic texture filtering, multi-stage progressive filtering

Chapter 6: Fusion Technology

1. Fusion technology: Combine unrasterized colors with rasterized colors. If the kettle is displayed on the table

Chapter 7: Lighting and Materials

1. Light source (point light source, directional light, spotlight)

2 Illumination (diffuse light, specular light, ambient light): diffuse, specular, ambient

3 material

Chapter 8: Animated Mesh Model and 3D Mesh Model

1. Export the XFile file with bones

Supplement: design camera, terrain, particle system. And grid and pick.

to sum up

It is the foundation of the game engine. The 3D part is connected with 3D modeling.

Update address: GitHub

For more content, please pay attention to: CSDN , GitHub , Nuggets

Guess you like

Origin blog.csdn.net/weixin_42875245/article/details/109309371