Skip to content

justinstenning/Direct3D-Rendering-Cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Direct3D Rendering Cookbook - companion source code

This repository contains the up-to-date companion source code for my book Direct3D Rendering Cookbook published in January 2014 by Packt Publishing.

Direct3D Rendering Cookbook cover image

Any questions or issues can be posted in the issues

Update 2017-03-27: this repository has been updated to work with SharpDX 3.1.1. You can find the previous version of the source code that is used in the book here.

Build Instructions

To build all projects:

  1. open the relevant solution,
  2. restore NuGet packages (right click solution in solution explorer and select Restore NuGet Packages)
  3. right-click the root node within the Solution Explorer and select Rebuild Solution.

NOTE: If you get an error on Windows 10 and Visual Studio 2015 while trying to create the Direct3D device in debug mode, you may need to enable the DirectX Developer Runtime https://blogs.msdn.microsoft.com/chuckw/2015/08/05/where-is-the-directx-sdk-2015-edition/ or by running the command:

Dism /online /add-capability /capabilityname:Tools.Graphics.DirectX~~~~0.0.1.0

NOTE 2: If for some reason the MeshContentTask build target does not function correctly for you, the compiled assets are available separately from OneDrive, they just need to be copied to the correct build output location. You know if the MeshContentTask is not working when the *.fbx files do not get converted to *.cmo in your build output directory.


  • All desktop recipes (compatible with VS2012, VS2013 and VS2015): .\D3DRendering.sln

  • All Windows Store apps recipes (VS2013 only): .\D3DRendering.vs2013.WinRT.sln

  • D3DCompiler redistributable .\External


Shared projects:

  • Desktop apps

    .\Common\Common.csproj

  • Windows Store apps

    .\Common.WinRT\Common.WinRT.csproj


Chapter 1: Getting Started with Direct3D

  • Building a Direct3D 11 application with C# and SharpDX

    .\Ch01_01EmptyProject\

  • Initializing Direct3D 11.1 device and swap chain

    .\Ch01_02Direct3D11_1\

  • Debugging your Direct3D application

    .\Ch01_03Debugging\



Chapter 2: Rendering with Direct3D

  • Building a simple rendering framework

    .\Common\Common.csproj

  • Rendering primitives

    .\Ch02_01RenderingPrimitives\

  • Adding texture

    .\Ch02_02AddingTexture\


Chapter 3: Rendering Meshes

  • Cube and Sphere

    .\Ch03_01CubeAndSphere\

  • Material and Lighting

    .\Ch03_02MaterialAndLighting\

  • Material and Lighting with cube mapping

    .\Ch03_02WithCubeMapping\

  • Load mesh from file

    .\Ch03_03LoadMesh\


Chapter 4: Animating Meshes with Vertex Skinning

  • Vertex Skinning

    .\Ch04_01VertexSkinning\

  • Bone Animation

    .\Ch04_02Animate\


Chapter 5: Applying Hardware Tessellation

  • Tessellation basics

    .\Ch05_01TessellationPrimitives\

  • Tessellation of a mesh

    .\Ch05_02TessellatedMesh\


Chapter 6: Adding Surface Detail with Normal and Displacement Mapping

  • Displacement Mapping

    .\Ch06_01DisplacementMapping\

    .\Ch06_01DisplacementMapping_TangentSpace\

  • Displacement Decals

    .\Ch06_02DisplacementDecals\


Chapter 7: Performing Image Processing Techniques

  • Image processing (compute shaders)

    .\Ch07_01ImageProcessing\


Chapter 8: Incorporating Physics and Simulations

  • Physics (with BulletSharp)

    .\Ch08_01Physics\

  • Particles (compute shaders with append\consume buffers)

    .\Ch08_02Particles\


Chapter 9: Rendering on Multiple Threads and Deferred Contexts

  • Multithreaded rendering - benchmark

    .\Ch09_01Benchmark\

  • Multithreaded Dynamic Cube Environment Map

    .\Ch09_02DynamicCubeMapping\

  • Multithreaded Dual Paraboloid Environment Mapping

    .\Ch09_03DualParaboloidMapping\


Chapter 10: Implementing Deferred Rendering

  • Deferred rendering

    .\Ch10_01DeferredRendering\

    • NOTE: the textures for the CryTek Sponza scene can be downloaded from the CryTek CryENGINE 3 downloads page or directly here. These should then be placed into the directory: .\Ch10_01DeferredRendering\textures

      The project will also compile and render without these textures


Chapter 11: Integrating Direct3D with XAML and Windows 8.1

  • Direct3D CoreWindow Windows Store app

    .\Ch11_01HelloCoreWindow\

  • Direct3D SwapChainPanel Windows Store app

    .\Ch11_02HelloSwapChainPanel\

  • Loading resources asynchronously

    .\Ch11_03CreatingResourcesAsync\

    • NOTE: If you do not see the model, clean and rebuild the project again. This is because the .cmo file does not yet exist the first time you build. Cleaning and building again will correctly add the model to the Windows Store apps' AppX package.