• 沒有找到結果。

Results and Conclusion

DirectX is the name given to a series of API for running and displaying multimedia rich applications. Using it, we can have graphics, video, 3D animation, surround sound and so on. The different API’s available in DirectX are Direct Graphics, Direct Input, Direct Sound, Direct Play and DirectShow. Direct Graphics deals with everything related to graphics. With it we can load 3D meshes, render textures, animate 3D models, light the scene, add particle effects and much more.

It is concentrated more towards 3D making it ideal for rendering 3D graphics, although it will also work just as well doing 2D graphics too.

Direct Sound does everything we could ever want to do with audio.

We can play midi files and wav files and other types of music. We can add special effects such as an echo or flanging. We can also add 3D surround sound effects by telling Direct Sound to apply special 3D algorithms and so on. Again, this is ideal for games.

A complete framework for automatically constructing and rendering of 3D scene shows in the Figure 5.1. Having an ability to slow down or speed up the music to match the special effects. We can see that the fire effects, the tempo of playback and the volume of playback alter with rising or decreasing temperatures smoothly.

This thesis is organized sequentially following the data flow through the pipeline from the application to the image displayed on the monitor.

Each major section of the pipeline is treated by a part of the thesis.

Recent games have dazzled us with their remarkable graphics and awesome effects. It’s those graphical and audio effects that catch most people’s eyes, so graphics and audio are a major component in the projects. Fortunately, most graphics engines (and audio special effects) and the concepts behind them are straightforward and easy to understand.

By applying the basics of drawing graphics and playing sounds, we can re-create the awesome effects we see in games and also create some new effects of our own.

References

1. Blinn, Jim. Jim Blinn's Corner: A Trip Down the Graphics Pipeline.

San Francisco, CA: Morgan Kaufmann Publishers, 1996.

2. Eberly, David H. 3D Game Engine Design: A Practical Approach to Real-Time Computer Graphics. San Francisco, CA: Morgan

Kaufmann Publishers, 2000.

3. Engel, Wolfgang F. Direct3D ShaderX: Vertex and Pixel Tips and Tricks. Plano, TX: Wordware Publishing, 2002.

4. Engel, Wolfgang F., and Amir Geva. Beginning Direct3D Game Programming. Roseville, CA: Prima Tech, 2001.

5. Foley, James D., et al. Computer Graphics: Principles and Practice.

Second ed. in C. Reading, MA: Addison-Wesley, 1995.

6. Gray, Kris. DirectX9 Programmable Graphics Pipeline. Redmond, WA: Microsoft Press®, 2003.

7. Hearn, Donald, and M. Pauline Baker. Computer Graphics. Second ed. Englewood Cliffs, NJ: Prentice-Hall, 1994.

8. Shirley, Peter. Fundamentals of Computer Graphics. Natick, MA:

AK Peters, 2002.

9. Walsh, Peter. The Zen of Direct3D Game Programming. Roseville, CA: Prima Publishing, 2001.

10. Watt, Alan. 3D Computer Graphics. Third ed. Harlow, England;

Reading, MA: Addison-Wesley, 2000.

11. Watt, Alan, and Fabio Policarpo. 3D Games: Real-Time Rendering and Software Technology. Volumes 1 and 2. Reading, MA:

Addison-Wesley, 2003

12. Wendy Jones, Introduction to 3D Game Programming with DirectX 9.0. Wordware Publishing, Inc, 2003.

13. Carl Granberg. Programming an RTS Game with Direct3D, Charles River Media; Pap/Cdr edition, 2006

14. Tom Miller. Managed DirectX 9 Kick Start: Graphics and Game Programming. Sams; 1 edition, 2003

15. Vaughan Young. Programming a Multiplayer FPS in DirectX. Charles River Media; 1 edition, 2004

16. Jim Adams. Programming Role Playing Games with DirectX.

Premier-Trade; 2 Pap/Cdr edition, 2004.

17. Peter Walsh. Advanced 3D Game Programming with DirectX 9.

Wordware Publishing, Inc. 2003

18. Fletcher Dunn. 3D Math Primer for Graphics and Game Development. Wordware Publishing, Inc. 2000

Figure 1.1 The world is a set of graphics layers

Figure 1.2 The set of the 3D objects in the view Camera

3D Models Lights

Backdrop

Board A 3D Scene

3D Graphics Layers A World

Frame Buffers (front + back)

Figure 1.3 System Architecture

Figure 2.1 Components of DirectX

DiDirreeccttSShhoow w DiDirreeccttMMuussiicc DiDirreeccttPPllaay y

DiDirreeccttXX GGrraaphphiiccss

DiDirreecctStSoounundd

DiDirreecct t MMeeddiiaa ObObjjeecctt DiDirreecctItInnppuutt

DiDirreecctt SeSetutupp

Figure 2.2 Direct3D Pipeline

Figure 2.3 Vertex Structure in Detail

Figure 2.4 Primitive Types and Polygons

Figure 2.5 Sample blend weight functions ( )

β x defined for xin [0, 1]

Figure 2.6 Illustration of the effect of blend weight functions

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

B lend W eight Dis tribution Func tions

x

beta(x)

Figure 2.7 Classic transform of the scene

Figure 2.8 The effects of lighting and material

No Ambient

Gray Ambient

Blue Ambient

Diffuse Only

Specular Higher Shinines

Emission

Figure 2.9 Viewport Culling and Clipping

(a) without mipmap (b) with mipmap

Figure 2.10 Mipmap Method

Clamp both S, T

Repeat T but Clamp S

Repeat both S, T

Figure 2.11 Repeating and Clamping

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Scene Depth z

f(z)

Fog Factor Functions

:D3DFOG_LINEAR zs=0 ze=1 :D3DFOG_EXP d=2

:D3DFOG_EXP d=5 :D3DFOG_EXP2 d=2 :D3DFOG_EXP d=5

Figure 2.12 Fog factor functions f z( ) plotted versus scenes depth z And the application

Figure 2.13 A case that breaks the Painter’s algorithm

Figure 2.14 Calculation of z-values.

cold

hot

Figure 2.15 Each fire values determines how hot the fire is at that particular point.

Figure 2.16 The algorithm for calculating the fire.

Figure 3.1 Flowchart of the sound architecture

Figure 3.2 MP3 playback flowchart

1 2 3 4 5 6 7 8 9 10 11 12 0x24 ID humidity temperature voltage vibration 0x00 0x00 0x23

Figure 4.1 Serial Communication Protocol

(a) Tag

(b) Reader

Figure 4.2 Input device

(a) waterfall

(b) furnace

Figure 5.1 Results of the experiment

相關文件