INTRODUCTION TO 3D GAME PROGRAMMING WITH DIRECTX 11 PDF
Introduction to 3D GAME PROGRAMMING WITH DIRECTX ISBN: The publisher recognizes and respects all marks used by companies. This books (Introduction to 3D Game Programming with Directx 11 [PDF]) Made by Frank D. Luna About Books Mercury Learning. Editorial Reviews. Review. intended for C++ programmers and other intermediate level 3D programmers interested in the intricacies of DirectX, this volume on.
|Language:||English, Spanish, Arabic|
|Genre:||Business & Career|
|ePub File Size:||23.79 MB|
|PDF File Size:||11.20 MB|
|Distribution:||Free* [*Register to download]|
Introduction to 3D Game Programming with DirectX Home · Introduction to 3D Game Programming Beginning DirectX 11 Game Programming. Read more. Introduction to 3D GAME PROGRAMMING WITH DIRECTX 12 examples from the DirectX SDK's CascadedShadowMaps11 sample: static const. Book Example Code in [Introduction to 3D Game Programming With DirectX11 by Frank Luna ].
XAudio2 XAudio2 is a low-level audio API that provides signal processing and mixing foundation for developing high performance audio engines for games . You may want to work with DXGI directly if your application needs to enumerate devices or control how data is presented to an output .
In this article, we will be using DXGI to enumerate the display devices in order to determine the optimal refresh rate of the screen. The following diagram illustrates the different stages of the DirectX 11 rendering pipeline.
Introduction to 3D Game Programming with DirectX 11
The arrow indicates the flow of data from each stage as well as the flow of data from memory resources such as buffers, textures, and constant buffers that are available on the GPU. The rectangular blocks are fixed-function stages and cannot be modified programmatically. The rounded-rectangular blocks indicate programmable stages of the pipeline.
In this stage, the geometry is specified and the layout of the data which is expected by the vertex shader is configured . Vertex Shader Stage The Vertex Shader VS stage is usually responsible for transforming the vertex position from object space into clip space but it can also be used for performing skinning of skeletal animated meshes or per-vertex lighting .
The input to the vertex shader is a single vertex and the minimum output from the vertex shader is a single vertex position in clip-space the transformation to clip-space can also be performed by the tessellation stage or the geometry shader if either is active. Hull Shader Stage The Hull Shader HS stage is an optional shader stage and is responsible for determining how much an input control patch should be tessellated by the tessellation stage . Tessellator Stage The Tessellator Stage is a fixed-function stage that subdivides a patch primitive into smaller primitives according to the tessellation factors specified by the hull shader stage .
Domain Shader Stage The Domain Shader DS stage is an optional shader stage and it computes the final vertex attributes based on the output control points from the hull shader and the interpolation coordinates from the tesselator stage .
The input to the domain shader is a single output point from the tessellator stage and the output is the computed attributes of the tessellated primitive. Geometry Shader Stage The Geometry Shader GS stage is an optional shader stage that takes a single geometric primitive a single vertex for a point primitive, three vertices for a triangle primitive, and two vertices for a line primitive as input and can either discard the primitive, transform the primitive into another primitive type for example a point to a quad or generate additional primitives .
This data can be recirculated back to the rendering pipeline to be processed by another set of shaders . This is useful for spawning or terminating particles in a particle effect. The geometry shader can discard particles that should be terminated or generate new particles if particles should be spawned.
Introduction to DirectX 11
Rasterizer Stage The Rasterizer Stage RS stage is a fixed-function stage which will clip primitives into the view frustum and perform primitive culling if either front-face or back-face culling is enabled . The rasterizer stage will also interpolate the per-vertex attributes across the face of each primitive and pass the interpolated values to the pixel shader. Pixel Shader Stage The Pixel Shader PS stage takes the interpolated per-vertex values from the rasterizer stage and produces one or more per-pixel color values .
The pixel shader is invoked once for each pixel that is covered by a primitive . Output-Merger Stage The Output-Merger OM stage combines the various types of output data pixel shader output values, depth values, and stencil information together with the contents of the currently bound render targets to produce the final pipeline result . In this tutorial I will be using Visual Studio to create a template project that can be used to create subsequent DirectX 11 demos in the future.
Visual Studio also has the ability to compile your HLSL shader code as part of the regular compilation step and you can then load the precompiled shader code directly instead of compiling the shader code at runtime.
This enables your application to load faster especially if you have many shaders. In this article I will show how you can setup your project to make use of shader compilation but I will also show you how you can load and compile your shader at runtime. In this demo, I will not be using any 3rd party dependencies. All included headers and libraries are part of the Windows 8 SDK that comes with Visual Studio however you should make sure that you have applied the latest updates to Visual Studio so that you are working with the newest version of the Windows 8 SDK.
Choose a Name, Location and optionally a Solution name or accept the default for your new project and press the OK button to create the new project.
Press the OK button to create the file and add it to the project. We need at least one CPP source file in the project in order to configure the project correctly. With the main.
With this configuration, both the debug and the release builds will go to the same folder. Doing this will ensure that the current working directory will be correctly set to the location of our executable file so that we can express paths in the application relative to the executable instead of relative to the project folder which usually is a major cause of confusion for beginning programmers.
In my case, I have a separate folder called inc relative to my project folder where I will keep the header files for the project.
These paths are automatically included when we create a new project in Visual Studio Precompiled Header Although not absolutely necessary, I find using precompiled headers useful as it reduces the overall compile time of the project.
For this small project, it may not be necessary to use precompiled headers but for large projects it is definitely useful to know how to setup precompiled headers. The PCH postfix indicates that this file will be used to generate the precompiled header file. This file will be used to create the precompiled header.
Set the Precompiled Header File option to the name of the header file you created in the previous step. Global Header The global header file will contain all of the external non changing include files. You should not include project specific header files in the global header file because they are changing often. If the contents of the global header file change often then we can no longer take advantage of precompiled headers.
This header file contains all of the definitions for creating a Windows based application.
Introduction to 3D Game Programming with DirectX Frank Luna
The d3dcompiler header file is required for loading and compiling HLSL shaders. The DirectXMath header file includes math primitives like vectors, matrices and quaternions as well as the functions to operate on those primitives.
The DirectXColors header defines a set of commonly used colors. You can also specify these libraries in the Additional Dependencies property in the Linker options if you want but putting them here simplifies the project configuration settings.
Adobe Flash Player
Also if you were creating a library project, this file could be included in the global header file of another project to perform automatic linking of the required library dependencies. This function allows us to safely release a COM object even if it has already been released before.
Since we will be releasing COM objects a lot in this application, this function will also allow us to create neater code. Preamble Before we get into the application code, we first need to define some global variables that will be used throughout the demo.
We first need to include the global header file that we created in the previous step. I got really tired of typing out the DirectX namespace every time I wanted to use a vector or a matrix so instead I just import the namespace. The first set of globals define some properties for the application window. The actual window that we will create will be slightly larger than this because these variables actually define the size of the renderable area or client area of the window.
The actual window size including the window frame will be computed before the actual window is created. Before we can create a window instance, we need to create a window class. The window class should be unique for our application so we need to define a unique name for the class as well. Game structure[ edit ] The central component of any game, from a programming standpoint, is the game loop.
The game loop allows the game to run smoothly regardless of a user's input or lack thereof. Most traditional software programs respond to user input and do nothing without it. For example, a word processor formats words and text as a user types. If the user doesn't type anything, the word processor does nothing. Some functions may take a long time to complete, but all are initiated by a user telling the program to do something.
Games, on the other hand, must continue to operate regardless of a user's input. The game loop allows this. For example, games written for DOS and many consoles can dominate and exploit available processing resources without restraint. However, games for a modern PC operating system such as Microsoft Windows must operate within the constraints of the process scheduler.
Some modern games run multiple threads so that, for example, the computation of character AI can be decoupled from the generation of smooth motion within the game. This has the disadvantage of slightly increased overhead, but the game may run more smoothly and efficiently on hyper-threading or multicore processors and on multiprocessor platforms.
With the computer industry's focus on CPUs with more cores that can execute more threads, this is becoming increasingly important. Consoles like the Xbox and PlayStation 3 already have more than one core per processor, and execute more than one thread per core. Hobbyists[ edit ] The only platforms widely available for hobbyists to program are consumer operating systems , such as Android, iOS, Windows, Mac, Linux, etc. This is because development on game consoles requires special development systems that cost thousands of dollars.
Often these must be obtained from the console manufacturer and are only sold or leased to professional game development studios. Lately, Android is the most popular hobbyist platform of choice for mobile developers.The first set of globals define some properties for the application window.
Luna Pages: Chapter 9, Blending: In this chapter, we look at a technique called blending, which allows us to implement a number of special effects like transparency.
However, games for a modern PC operating system such as Microsoft Windows must operate within the constraints of the process scheduler. You can check your reasoning as you tackle a problem using our interactive solutions viewer.
- OPENGL PROGRAMMING GUIDE PDF
- INTRODUCTION TO INFORMATION TECHNOLOGY BOOK PDF
- PROGRAM DO EDYCJI PDF DARMOWY
- SCRATCH PROGRAMMING IN EASY STEPS PDF
- EXPERT C PROGRAMMING DEEP C SECRETS EBOOK
- SAS MACRO PROGRAMMING MADE EASY THIRD EDITION PDF
- PROGRAMMING IN LUA SECOND EDITION PDF
- OBJECT ORIENTED PROGRAMMING WITH ABAP OBJECTS PDF