DirectX - Yesterday, today, tomorrow [transfer]

xiaoxiao2021-03-06  102

DirectX - Yesterday, today, tomorrow [original]

Dragon core X

2004-01-19 Now the type and quantity of the game are almost explosive growth. The level of production of the game is constantly improving. So when you appreciate the beautiful effect in the game, have you ever thought that this has been created? Faded IRECTX! DirectX's words seem to be unfamiliar with the players, and now many game descriptions have "this game needs DirectX ... These" such words, even the acceleration mode option when 3ds max starts, "There are DirectX. So what is DirectX? Now let us unveil the mysterious veil on the face, and it is.

First, the first DirectXDirectX is a set of APIs developed by Microsoft-based platforms, which is high-speed real-time animation rendering, interactive music and environmental sound equation for application development services. Starting from Windows 95, people have begun to contact DirectX2.0, and WindowsNT4.0 is DirectX3.0A, but there is no version of DirectX4. In Windows98, it is an indispensable core member in the Windows family operating system. DirectX5 is integrated in Windows 98, and DirectX 6 is integrated in Windows 2000. The DirectX 7 is integrated in Windows ME, while Windows XP is born with DirectX 8.1. Microsoft has developed a DirectX standard platform and cooperates with hardware manufacturers and gaming vendors to jointly update the upgrade DirectX standard. Hardware manufacturers have developed better products in accordance with this standard, and game developers develop games according to this standard. That is, regardless of whether the hardware supports some effects, as long as the DirectX standard, the game developer can write it into the game, when this game is running on the hardware, if this hardware makes this effect according to DirectX standard In the hardware driver, the driver is harness its hardware to calculate the result, and the user can enjoy this effect. This is the "hardware device independence", which is the true meaning of DirectX. Typically, Windows is very strict to hardware access, using the usual way, but DirectX has given developer's ability to directly access hardware through "Hardware Abstract Layer (HAL)". HAL not only solves hardware and compatibility issues, but also Developers can use it directly access to some hardware devices of the computer, such as direct memory control, rendering, keyboard, mouse, and control of the control, the direct audio mixing and output capability of the audio device, so therefore, Developers can make full use of hardware acceleration to optimize the performance of the program to a new height. If the target machine does not support the corresponding hardware acceleration, DirectX can also simulate the accelerator to provide a powerful multimedia environment. The DirectX family contains members with Direct3D, DirectDraw, DirectInput, DirectMusic, Directplay, DirectSound, and DirectShow.

Second, DirectX family portraits pass the above introduction, I believe that readers have a probably understanding of DirectX. Let us know them one by one. 1, Direct3D, DirectDraw and DirectGraphics DirectDraw are the veteran of the DirectX family, which provides good support for high-speed 2D rendering, because it has the ability to direct access and fast transfer, so that the 2D graphic's drawing speed is relatively GDI. A qualitative leap, its rendering speed or even hundreds of gaps. When I remember the "Red Alert" and "Diablo", you don't forget the trial of DirectDraw. DirectDraw is close to the ultimate, but with the rapid development of PC graphics technology, people will no longer satisfy the 2D graphics effect, and the pseudo 3D simulation through 2D technology is very lost, which is directly caused. The birth of Direct3D, the early Direct3D technology is not very perfect, there is still a certain gap with respect to 2D technology, until the graphics accelerator card supports hardware 3D special effects, Direct 3D gradually enters the right track, slowly display its performance advantage. Let's review history and see how Direct3D "Growth Process": DirectX6 adds the following new features: • Flexible vertex format of geometry • Vertical buffer storage of geometries • Support multi-texture rendering • Auto texture Manage • Optional depth buffer (using Z Buffer or W Buffer) • Direct3D in Direct3D in DirectX7 in DirectX 7 is added to the Direct3D in DirectX7 by concave convexes and water waves. And light (T & L) Support • Environmental map of cube surface • Geometric rendering • Improved texture rendering • Automatic texture coordinate generation, texture conversion, projection texture, and arbitrary face cut • D3DX practical library • Support Intel MMX architecture, Intel single instruction multiple data Flow (SIMD), SSE® and AMD® 3DNOW® architecture. DirectX's version of 8.0, although it still maintains forward compatibility, its structure has changed, and 3D graphics processing technology is gradually unified in Vertex Shader and Pixel Shader. Vertex Shader is used to describe and modify the geometry of the 3D object, and also used to control light and shadow; Pixel Shader is used to manipulate the color and appearance of the surface of the object. Direct3D and DirectDraw are two, the DirectX family has born a new member ----- DirectGraphics. It also adds a lot of exciting features: • Full integration of DirectDraw and Direct3D simplified program initialization procedures and improve data allocation and management performance, which will reduce memory consumption. At the same time, the integrated graphics application programming interface (API) allows parallel vertex input streams to achieve more flexible rendering. • Programmable vertex handling language allows you to write custom shaders such as deformed and gradient animations, matrix palette, user-defined illuminated models, general environment mapping, programmable geometry, or any other developer defined algorithm. • Programmable pixel handling language allows you to write custom hardware shaders, such as universal texture combination formulas, pixel light (concave map), suitable for image-by-pixel environment maps that implement photos (real)-level mirror effects or any other developer definition Algorithm. • Support multi-sampling rendering allows full view of anti-sample and multiple sampling effects, such as motion blur and depth of field (focus of the lens). • Point Elf allows high performance particle system rendering, such as spark, explosion, rain, snow, and so on.

• 3-D spatial texture allows range attenuation, achieving pixel-based illumination and space atmospheric effects, or even more complex geometry applications. • Supports high dimensional maps to enhance its appearance and simplify content mapping from the 3-D content from the main 3-D creation tool. • Advanced technology includes 3D content creation tool plugins for outputting a Direct3D skin grid, using Direct3D a variety of different technologies, multi-resolution level detail (LOD) geometry, as well as high-dimensional surface data. • The index vertex is mixed to extend the support of geometric mixing, allowing matrices to be used to vertex mixing by specifying a matrix index. • Expanding the Direct3DX utility contains a lot of new functions. The Direct3DX utility is a auxiliary layer on Direct3D for simplifying the general work of the 3-D graphic developer. It includes a Montuper, supports the operation of the grid, as well as the function of assembling the vertices and pixel shaders. DirectX has a major kernel structure change every upgrade, which will bring us huge visual impact. DirectX7 core T & L engines are simply abandoned. Therefore, for graphic chip developers, game developers, and users, DirectX 9 is indeed a "unique superior graphics technology". DirectX 9 "with a number of exciting new features": Direct3D graphics rendering tube

• Vertex Shader 2.0 and Pixel Shader 2.0 In DirectX9, Vertex Shader and Pixel Shader are upgraded to 2.0, they all support 64 or even 128-bit floating point color accuracy. The floating-point color increases in dynamic and accuracy to the image quality leap, so you can easily achieve the movie level in DirectX9! Contrast parameters for DirectX8 and DirectX9:

Vertex Shader 2.0 introduces processes, increasing conditional jump, loop, and subroutines. The Vertex program can now consist up to 1024 instructions (previously only 128 instructions), increased instructions bring more complex and powerful performance, new operations such as sinusoids, cosine, and other powerful functions greatly simplified code Write and can express more complex results. Vertex Shader 1.0 VertexShader 2.0 Powerful Programmable Pixel Shader is a true essence that implements a movie quality level. Pixel Shader 2.0 can support advanced programming languages ​​and assembly languages, and developers can also embed their assembly code into higher programs. The previous version of the Pixel Shader language is limited to only 6 material and 28 instructions, and the 2.0 version increases this upper limit to the maximum 16 material and 160 instructions, and has added a lot of enhanced operations and operations. .

Pixel Shader 1.4

Pixel Shader 2.0

In addition, various Shader tools, such as NVIDIA's CG language and ATI's render, make real-time graphical rendering, rapid speed, NVIDIA and ATI official DEMO are enough to explain this. Some interface definitions have also been improved in DirectX9, Vertex Shader and Pixel Shader provide an interface separately, and provide a common graphic interface, such as the drawing of the line segment, etc., which further mitigates the burden on the developer. • Floating-point color and 32-bit frame buffer formats currently most of the color representations (such as RGB) use 8-bit integers to represent red, green, blue, perhaps this is enough for display, but in operation seems far not enough. Due to the unparalleled part of the integer, when they pass the extremely complex mathematical operation of Pixel Shader, it will result in a large error, which can cause color obvious distortion. DirectX9 supports several floating point color formats, making it greatly improved. At the same time, DirectX9 supports accurate to 32-bit frame buffer formats per pixel, which can show the number of current brightness grades, which makes images look more clear and natural. In addition, DirectX9 also provides support for Displace Maps, and improved equipment simulation, and has no unexpectedly, and DirectX9 SDK has further extended the Direct3DX practical library, which improves development efficiency. 2, DirectSound, DirectMusic and DirectX Audio In DirectX DirectSound and DirectMusic can collect DirectX Audio. A good game is not a sound, DirectX Audio is responsible for the sound control in the game. Not only the game, there are many places that need high quality sound effects, we have their shadows, and we often see whether to use DirectSound support in the setup panel of some playing software. DirectX Audio does not only simply play back to the sound. It provides a complete system that dynamically manipulates the control track and channel using hardware acceleration. If you want to use DirectMusic and DirectSound in your program, you can get the following features: • Read and play, such as MIDI, Wave, and DirectMusic Producer Run Time, etc. • Multiple sound resources are simultaneously played. • High-precision time control of the played sound rail. • You can dynamically change playback and rhythm, and even dynamically control some MIDI events in real time. • Using the DLS synthesizer (DirectX Audio comes with a wave form synthesizer), your program ensures that the same MIDI sound is heard on different computers. Your program can play unscrupulous restrictions, each trial of the sound of the instrument, using DirectX Audio, you can even create a unique instrument sound category and publish it. • Do 3D the sound and create a 3D environment sound. • You can easily achieve, for example, change, echo, and other sound effects. • The number of MIDI tracks that can be used can be used. DirectX Audio broke through only 16 MIDI tracks that can only be used, which makes it possible to play at the same time, and this quantity is only limited by your voice hardware synthesizer. • Play the sound segment (segments) on different Audiopaths, and the effect can be achieved in each sound. • Implement MIDI data and stream ("thru") between different ports (port). • Capture the sound data from the microphone or other input device.

If you use DirectMusic Producer or a source file in the similar program, you can also do more control during the playback of the sound, such as dynamically selecting different sound variables (variants) or switching different and tyrants. • Accurately replay music. • Using the Variations Playing Sound (Wave) • Audiopaths Use Map Performance Channels to produce a completely different playback effect on different parts of CHANNEL. • Dynamically create a new music fragment, which does not require a special algorithm, just need your compile skills. • Dynamically combine the existing music clips. • In the time of sound playback, the program can obtain information of various types of sound effects that exist in the special section. These features apply to programs that are often only used only the main auda. If the program only implements some basic simple features, developers have designed DirectX Audio to be very easy to use, and it is very suitable for beginners. DirectX Audio is also scalable. A good program can use virtual functions (Virtual) inherited to design new classes, for example: • Supports new sound format files. • The track can contain various types of data. • Tools for processing information - Compare to the side, you can intercept record implementation transformation, or place the lyrics to be displayed into the sound clip file. • Customize the sequencer (SEQUENCER). • Customize Synthesizer. • Effect filter. Effects filters. It is worth mentioning that DirectMP3 and DirectCD two functional modules are added to DirectX9, which makes mainstream audio playback can also be better combined with its calling programs through DirectX. 3, DirectInput In DirectX's big family, DirectInput is in charge of "behavioral control". DirectInput can directly access the hardware directly to retrieve data directly from the input buffer, resulting in a faster speed than responding to Windows messages. In addition, DirectInput also provides good support against Force Feedback.

4, the development of the DirectPlay network underlying program is always a thing of the headache, while DirectPlay seems to take into account two aspects of speed and ease of use, and software such as speed and efficiency requires higher speed and efficiency software. DirectPlay for game optimization design is clearly a better choice. DirectPlay provides an extra layer that makes your game and the bottom of the network. And, your game can use the DirectPlay API very simple and use DirectPlay to manage network communication. DirectPlay provides the characteristics that makes multiplayer games have been simplified in development. These include: • Creating and administering point-to-point, customer / service sessions (session) • Manage User and Groups (Group) • Managing messages sent between members on different network platforms • Make the game Interaction in the lobby • User users can perform voice interaction

5. DirectShow is another important member of DirectX, DirectShow provides high quality media capture and playback capabilities under Windows platform, supports many formats: ASF, MPG, AVI, MP3, and WAV. DirectShow supports video capture using WDM devices or old video devices. When there is a hardware support environment, it will automatically select whether to use hardware acceleration when using video or audio. DirectShow simplifies media playback, format conversion, and capture tasks. At the same time, it also provides direct stream access control when the application needs to customize the underlying streaming solution. You can write DVD players, video editing programs, AVI to ASF converters, MP3 players, and digital video capture programs, etc. with DirectShow. Third, .NET architecture challenge ----- Managed DirectX I don't know that everyone has found no, it seems that it seems quietly to have a small plate in its document after installed DirectX9 SDK, which is Managed DirectX. So what is this mysterious guy? .NET Framework's first shot of the Microsoft .NET strategy, ASP.NET, Web Service et al. Also accompanied the popularity of .NET technology. Everyone already knows that DirectX is COM technology, and COM technology is mainly serving local machine. DirectX on the local machine can try to use the performance of the hardware to the limit, but it is not able to display it in the .NET network era. Some power? The answer is definitely "no". Now, DirectX has become part of the Windows core API, and Microsoft means that there will be more Win32API, and the future Windows API may be integrated into .NET Framework, then where DirectX is going? It turned out that it has already changed its face, and the .NET Framework has reached a "tacit understanding", which is the origin of Managed DirectX. Managed DirectX is essentially a lightweight package for DirectX, and Microsoft released Microsoft DirectX 9.0 SDK Update in early October 2003, which focuses on the Managed DirectX section. On the one hand, it can be tightly integrated with .NET Framework, other languages ​​in the .NET platform (such as C #); the other side has further simplified the DirectX program, making DirectX to the direction development of RAD. Big step, after all, ASP.NET, Winform These things are running on the network. So we can imagine how much exciting thing will be on the web page in the future.

Fourth, the development environment support and configuration before DirectX development, we need to download and install the corresponding version of DirectX SDK, which can be free from Microsoft's official site, the latest DirectX 9.0 SDK Update (Summer 2003) is approximately 185MB, Related DirectX9 SDK for Pocket PC, DirectX9 Meltdown, DirectX9 SDK Extras, etc., downloaded related pages are

http://msdn.microsoft.com/directX

. After downloading the corresponding SDK, we can start using it for DirectX development. 1. Configuration in Microsoft Visual Studio 6.0 / .NET / .NET 2003 Because DirectX is Microsoft's product, in the Visual Studio series, DirectX development needs to be simple, below, under the latest Microsoft Visual Studio .NET 2003 Take an example. Step 1: Configure include and library directories, set the included file (Include) Settings Library file (lib) Step 2: Add the reservoir required to add the link to the menu operation shown below, add the corresponding library file, such as DxGuid. LIB, D3D9.LIB, D3DX9.LIB, etc., different programs require different library files, but DxGuid.lib is required. Other Measures: After setting the include and library file path, we can also use the link to achieve the link to achieve the corresponding library file in the program header. #pragma comment (lib, "dxguid.lib") # Pragma Comment (lib, "d3d9.lib") ........ 2, Borland C Builder 5/6 / x configuration is unfortunate, from DirectX8 .0 SDK, Microsoft no longer provides library files supported by the Borland compiler. Borland C Builder is a very excellent RAD development tool that is sighed to develop the convenience on the desktop application, then it is unable to develop DirectX in C Builder? This seems a bit unfortunate. But Borland has its own trick, since the standard DirectX SDK does not provide Borland version of the library file, then I will do it! The method is as follows: First, in the bin subdirectory in the C Builder installation directory, we can find a file called Implib.exe; secondly, open the MSDOS command line window, type: IMPLIB [library text name] [Source DLL File Name], you can make a library file required for the corresponding link. For example: exporting the D3D9.LIB required to compile from D3D9.DLL and saves the generated D3D9.LIB to the root directory of the C drive. Implib C: /D3D9.LIB C: /Windows/system32/d3d9.dll This we get the required lib file, then mix it with the .h file provided in the original SDK, you can use it in C Builder Dreamx Dreamx has been developed, this method is tested in C Builder X and Directx9 SDK Update (Summer 2003) environments. (It doesn't seem to need DXGUID.LIB compilation in the above environment.

V. DirectX's future DirectX's basic model architecture: DirectX9 DirectX10 In existing DirectX 8 and DirectX 9, programmable vertex coloring and pixel rendering are two units separated, that is, GPU manufacturers need to be in GPU Divide two areas to store Vertex Shader arrays and Pixel Shader map pipeline, then can you integrate these two? can! That is DirectX 10! As shown, Vertex Shader and Pixel Shader expected to DirectX 10 will be incorporated into an Integrated Shader unit. 5. Conclusion As the history of DirectX, the history of DirectX, which is shown in this article, and its step-by-step improving footprint, DirectX does have a crucial position in media technology, which is a generation of media technology development catalyst. It is foreseeable that future DirectX will bring us unprecedented, more shocking audiovisual impact, let us wait and see! Transfer from:

http://www.cstc.net.cn

Author:

Dragon core x

转载请注明原文地址:https://www.9cbs.com/read-103938.html

New Post(0)