Direct3D Rendering Cookbook

Direct3D Rendering Cookbook

Justin Stenning

Language: English

Pages: 430

ISBN: 1849697108

Format: PDF / Kindle (mobi) / ePub


50 practical recipes to guide you through the advanced rendering techniques in Direct3D to help bring your 3D graphics project to life

About This Book

  • Learn and implement the advanced rendering techniques in Direct3D 11.2 and bring your 3D graphics project to life
  • Study the source code and digital assets with a small rendering framework and explore the features of Direct3D 11.2
  • A practical, example-driven, technical cookbook with numerous illustrations and example images to help demonstrate the techniques described

Who This Book Is For

Direct3D Rendering Cookbook is for C# .NET developers who want to learn the advanced rendering techniques made possible with DirectX 11.2. It is expected that the reader has at least a cursory knowledge of graphics programming, and although some knowledge of Direct3D 10+ is helpful, it is not necessary. An understanding of vector and matrix algebra is required.

What You Will Learn

  • Set up a Direct3D application and perform real-time 3D rendering with C# and SharpDX
  • Learn techniques for debugging your Direct3D application
  • Render a 3D environment with lights, shapes, and materials
  • Explore character animation using bones and vertex skinning
  • Create additional surface detail using tessellation with displacement mapping and displacement decals
  • Implement image post-processing tasks within compute shaders
  • Use real-time deferred rendering techniques to implement improved shading for lighting and shadows
  • Learn to Program the graphics pipeline with shaders using HLSL implemented by Shader Model 5

In Detail

The latest 3D graphics cards bring us amazing visuals in the latest games, from Indie to AAA titles. This is made possible on Microsoft® platforms including PC, Xbox consoles, and mobile devices thanks to Direct3D– a component of the DirectX API dedicated to exposing 3D graphics hardware to programmers. Microsoft DirectX is the graphics technology powering all of today's hottest games. The latest version— DirectX 11—features tessellation for film-like geometric detail, compute shaders for custom graphics effects, and improved multithreading for better hardware utilization. With it comes a number of fundamental game changing improvements to the way in which we render 3D graphics.

Direct3D Rendering Cookbook provides detailed .NET examples covering a wide range of advanced 3D rendering techniques available in Direct3D 11.2. With this book, you will learn how to use the new Visual Studio 2012 graphics content pipeline, how to perform character animation, how to use advanced hardware tessellation techniques, how to implement displacement mapping, perform image post-processing, and how to use compute shaders for general-purpose computing on GPUs.

After covering a few introductory topics about Direct3D 11.2 and working with the API using C# and SharpDX, we quickly ramp up to the implementation of a range of advanced rendering techniques, building upon the projects we create and the skills we learn in each subsequent chapter. Topics covered include using the new Visual Studio 2012 graphics content pipeline and graphics debugger, texture sampling, normal mapping, lighting and materials, loading meshes, character animation (vertex skinning), hardware tessellation, displacement mapping, using compute shaders for post-process effects, deferred rendering, and finally bringing all of this to Windows Store Apps for PC and mobile. After completing the recipes within Direct3D Rendering Cookbook, you will have an in-depth understanding of a range of advanced Direct3D rendering topics.

Cultural Contact and the Making of European Art since the Age of Exploration (Bettie Allison Rand Lectures in Art History)

DragonWorld: Amazing Dragons, Advice and Inspiration from the Artists of DeviantART

The Sense of Semblance: Philosophical Analyses of Holocaust Art

Aestheticism in Art

 

 

 

 

 

 

 

 

 

 

 

 

projection matrices, and finally starts our rendering loop. We have initialized a world matrix using an identity matrix which effectively means that we are not translating, rotating, or scaling any of the objects in this scene. In Direct3D, the traditional coordinate system is left-handed, with the camera view looking down the Z+ axis with X+ to the right, and Y+ as up. The view matrix is created with the camera position and where it is looking at and which direction is up. Here, we are placing

compiled mesh object is included in Ch03_03LoadMesh\Male_base_mesh.cmo. This can then be included in the project. Once this is done, select Copy if newer as the copy for the output directory option. Mesh Renderer Now that we have our compiled mesh, we need to create a mesh renderer. Follow the steps given in the Creating a Direct3D renderer class recipe in Chapter 2, Rendering with Direct3D, to create our MeshRenderer class. Add the following private member fields and public

(PerMaterialBuffer != null && subMeshesForMaterial.Length > 0) { ... update material buffer } // For each sub-mesh foreach (var subMesh in subMeshesForMaterial) { ... render each sub-mesh } } We update the material buffer and assign any textures if PerMaterialBuffer is assigned. If the first texture view is not null, we will set the HasTexture property of the PerMaterial buffer to true.// update the PerMaterialBuffer constant buffer var material = new ConstantBuffers.PerMaterial() { Ambient

vertex. Depending on the method of construction, this height map can have a midpoint that allows the vertex to be lowered/raised, or the map may only support displacement in one direction. A displacement map will generally use the same UV coordinates as the diffuse texture and normal map. We will make changes to our existing tessellation shaders and incorporate displacement mapping to the solution to improve the surface detail of the final render. Getting ready In this recipe, we

texels from the group-shared memory. The following code snippet highlights the process: // 1. Sample the texel for current thread and place in group // shared memory ... // 2. Wait for all threads in group to complete sampling GroupMemoryBarrierWithGroupSync(); // 3. Apply kernel to current texel, reading neighboring texels // from group shared memory. Write result to output UAV ... To deal with the threads at the edge of the thread group, we need to load an additional FILTERRADIUS*2 texels

Download sample

Download