-
Notifications
You must be signed in to change notification settings - Fork 15
Home
This repo contains Direct3D 9, Direct3D 10, a few Direct3D 11, and DirectSound samples that originally shipped in the legacy DirectX SDK. These are all Windows desktop applications for Windows 7 Service Pack 1 or later.
They have been cleaned up to build using the Windows 10 SDK, and DO NOT require the DirectX SDK to build. They make use of the Microsoft.DXSDK.D3DX NuGet package for the legacy D3DX9/D3DX10/D3DX11 libraries. Projects for Visual Studio 2019 are provided.
The DXUT here supports Direct3D 9 and Direct3D 10. The DXUT11 here supports Direct3D 9 and Direct3D 11. Both have been modified to use a locally built dxerr instead of dxerr.lib. For more information, see this blog post.
- Microsoft Docs
- Where is the DirectX SDK (2021 Edition)?
- DirectX SDK Samples Catalog
- The Zombie DirectX SDK
For fully cleaned up and modernized versions of DXUT11, Effects11, Direct3D 11 samples/tutorials, and other legacy DirectX SDK samples see DXUT, FX11, and directx-sdk-samples. Those samples do not make use of the legacy D3DX libraries.
This project is 'archived'. These legacy samples are provided 'as is' for reference and developer education.
Multisampling attempts to reduce aliasing by mimicking a higher resolution display; multiple sample points are used to determine each pixel's color. This sample shows how the various multisampling techniques supported by your video card affect the scene's rendering. Although multisampling effectively combats aliasing, under particular situations it can introduce visual artifacts of its own. As illustrated by the sample, centroid sampling seeks to eliminate one common type of multisampling artifact. Support for centroid sampling is supported under Pixel Shader 2.0.
This sample shows a simple example of the High-Level Shader Language (HLSL) using the effect interface.
This sample shows how an ID3DXEffect object can be compiled when the project is built and loaded directly as a binary file at runtime.
The sample is a demonstration of a database-driven application configuration system. Device capabilities exposed by drivers are not always correct or provide acceptable performance. A configuration database stores a list of devices and custom, application-defined overrides to apply for each of the devices. This allows developers to fine-tune what features to use with any device to the greatest extent.
This sample showcases the user interface features of the Direct3D 9 sample framework. The sample framework provides UI controls that applications can readily use. The supported controls include buttons, radio buttons, check boxes, combo boxes, edit boxes, sliders, and edit boxes with Input Method Editor (IME) functionality.
This sample shows a technique for creating a depth-of-field effect with Direct3D 9, in which objects are only in focus at a given distance from the camera, and are out of focus at other distances.
This sample shows two features in the Direct3D 9 Extension effect framework: parameter blocks and parameter sharing. Parameter blocks group multiple Setxxx() calls and associate them with an effect handle, allowing an application to easily set those parameters contained in the block with a single API call. Parameter sharing lets parameters in multiple effect objects stay synchronized, so that when an application updates a parameter in one effect object, the corresponding parameter in all other effect objects are updated.
Minimal starting point for new Direct3D 9 applications
This sample demonstrates cubic environment-mapping with floating-point cube textures and high dynamic range lighting. DirectX 9.0's new floating-point textures can store color values higher than 1.0, which can make lighting effects more realistic on the environment-mapped geometry when the material absorbs part of the light. Note that not all cards support all features for the environment-mapping and high dynamic range lighting techniques.
High dynamic range lighting effects require the ability to work with color values beyond the 0 to 255 range, usually by storing high range color data in textures. Floating point texture formats are the natural choice for HDR applications, but may not be available on all target systems. This sample shows how high dynamic range data can be encoded into integer formats for compatibility across a wide range of devices.
This sample demonstrates some high dynamic range lighting effects using floating point textures. Integer texture formats have a limited range of discrete values, which results in lost color information under dynamic lighting conditions; conversely, floating point formats can store very small or very large color values, including values beyond the displayable 0.0 to 1.0 range. This flexibility allows for dynamic lighting effects, such as blue-shifting under low lighting and blooming under intense lighting. This sample also employs a simple light adaptation model, under which the camera is momentarily over-exposed or under-exposed to changing light conditions.
This sample, contributed by Jack Hoxley (a Microsoft Most Valuable Professional), demonstrates the numerous steps that occur "behind the scenes" in a High Dynamic Range rendering pipeline. Intended as an educational sample to complement existing examples, this implementation's difference is that it shows the results of all the intermediary stages and allows the user to change the parameters and get immediate feedback via the GUI.
This sample shows some of the effects that can be achieved using vertex shaders written in Microsoft Direct3D 9's High-Level Shader Language (HLSL). HLSL shaders have C-like syntax and constructs, such as functions, expressions, statements, and data types. A vertex shader looks very similar to a C function, and is executed by the 3D device once per every vertex processed to affect the properties of the vertex. Note that not all cards may support all the various features vertex shaders.
This sample demonstrates the new instancing feature available in DirectX 9.0c and shows alternate ways of achieving results similar to hardware instancing.
This sample donated by ATI Technologies (www.ati.com) builds upon the PRTDemo Sample and adds preprocessing of the scene to create a volume of radiance samples stored in an octree. This technique allows a PRT object to use the local lighting environment as it moves through a scene. This sample includes a default data set for user experimentation but can be changed to use your own data sets.
This sample demonstrates a simple usage of Local-deformable precomputed radiance transfer (LDPRT). This implementation does not require an offline simulator for calculating PRT coefficients; instead, the coefficients are calculated from a 'thickness' texture. This allows an artist to create and tweak sub-surface scattering PRT data in an intuitive way.
This sample shows how an ID3DXMesh object can be created from mesh data stored in a Wavefront Object file ( .obj). It's convenient to use X-Files (.x) when working with ID3DXMesh objects since D3DX can create and fill an ID3DXMesh object directly from an .x file; however, it's also easy to initialize an ID3DXMesh object with data gathered from any file format or memory resource.
This sample demonstrates mesh animation with multiple animation sets using HLSL skinning and D3DX's animation controller. It shows how an application can render 3D animation by utilizing D3DX's animation support. D3DX has APIs that handles the loading of the animatable mesh, as well as the blending of multiple animations. The animation controller supports animation tracks for this purpose, and allows transitioning from one animation to another smoothly.
The OptimizedMesh sample illustrates how to load and optimize a file-based mesh using the D3DX mesh utility functions. For more info on D3DX, refer to the DirectX SDK documentation.
This sample donated by ATI Technologies (www.ati.com) presents the parallax occlusion mapping algorithm which employs per-pixel ray-tracing for dynamic lighting of surfaces in real-time on the GPU. The method uses a high precision algorithm for approximating view-dependent surface extrusion for a given height field to simulate motion parallax and perspective-correct depth. Additionally, the method allows generation of soft shadows in real-time for surface occlusions. This sample includes an automatic level-of-detail system for in-shader complexity scaling.
This samples illustrates picking using Direct3D 9.
This sample shows how to do a motion blur effect using floating point textures and multiple render targets. The first pass renders the scene to the first render target and writes the velocity of each pixel to the second render target. Then it renders a full screen quad and uses a pixel shader to look up the velocity of that pixel and blurs the pixel based on the velocity.
This sample demonstrates some interesting image-processing effects that can be achieved interactively. Traditionally, image-processing takes a significant amount of processor power on the host CPU, and is usually done offline. With pixel shaders, these effects can now be performed on the 3D hardware more efficiently, allowing them to be applied in real-time.
PRTCmdLine is a command line example tool that uses a D3DDEVTYPE_NULLREF Direct3D 9 device and an 'XML' options file to run the PRT simulator. The output can be viewed in a PRT application such as the PRTDemo sample.
This sample features several scenes which compare precomputed radiance transfer (PRT) implementations against the standard lighting equations.
This sample demonstrates one popular shadow technique called shadow mapping. A shadow map, in the form of a floating-point texture, is written with depth information of the scene as if the camera is looking out from the light. Then, the shadow map is project onto the scene during rendering. The depth values in the scene are compared with those in the shadow map. If they do not match for a particular pixel, then that pixel is in shadow. This approach allows very efficient real-time shadow casting.
The sample demonstrates one common technique for rendering real-time shadows called shadow volumes. The shadows in the sample work by extruding faces of the occluding geometry that are facing away from light to form a volume that represents the shadowed area in 3D space and utilizing the stencil buffer of the 3D device. Stencil buffer is a buffer that can be updated as geometry is rendered, and then used as a mask for rendering additional geometry. Common stencil effects include mirrors, shadows (an advanced technique), and dissolves.
Basic starting point for new Direct3D 9 samples
The SkinnedMesh sample shows how to use D3DX to load and display a skinned mesh.
This sample shows an example implementation of the ID3DXEffectStateManager interface. This inteface can be used to implement custom state-change handling for the D3DX Effects system.
The Text3D sample shows how to draw 2D text and 3D text in a 3D scene. This is most useful for display stats, in game menus, etc.
This sample produces a linear gray scale test pattern in both 8 and 10 bit color and displays it on multiple monitors to enable direct comparison.
This is one of 3 sample applications shown during the Advanced Real-Time Rendering in 3D Graphics and Games course at SIGGraph 2007. The Direct3D 10 sample shows a particle system that interacts with its environment. The system is managed entirely by the GPU.
This Direct3D 10 sample shows a simple example of the High-Level Shader Language (HLSL) using the effect interface. This sample also includes a Direct3D 9 fallback
The ContentStreaming sample demonstrates streaming content in the background for applications that need to display more data than can fit in video or system ram at any given time. This sample supports both Direct3D 9 and Direct3D 10.
This Direct3D 10 sample shows an example of rendering to all 6 faces of a cube map in one pass.
DDS texture loading without using the D3DX helper functions.
Includes the fixes from this blog post
This sample shows how to create more volumetric-looking particles using a deferred rendering approach.
This Direct3D 10.1 sample, courtesy of AMD, shows how to use depth of field with MSAA on Direct3D 10.1 hardware.
This Direct3D 10 sample shows the use of predicated Direct3D 10 calls to avoid drawing occluded geometry.
One of the downsides to using multiple effects in a single application is that many effect variables need to be set for each effect. It is often the case that many of these variables are common between effects. Without a method for sharing variables or shaders between effects, many rendundant set calls will need to be made setting data that is exactly the same for each effect. Effect pools are meant to solve this problem. This sample demonstrates the use of effect pools on Direct3D 9 and Direct3D 10.
Minimal starting point for new Direct3D 10 applications. This sample also includes a Direct3D 9 fallback
This Direct3D 10 sample shows how to implement Direct3D 9 level fixed-function functionality in Direct3D 10
This is one of 3 sample applications shown during the Advanced Real-Time Rendering in 3D Graphics and Games course at SIGGraph 2007. The Direct3D 10 sample shows a flocking algorithm managed entirely by the GPU.
This Direct3D 10 sample shows the creation of a spectrogram from a wav file using the GPU.
This sample, contributed by AMD, presents an innovative technique for achieving High Definition Ambient Occlusion (HDAO). It utilizes Direct3D 10.1 APIs and hardware, making use of the new shader model 4.1 gather4 instruction, to greatly accelerate the performance of this technique.
High dynamic range lighting effects require the ability to work with color values beyond the 0 to 255 range, usually by storing high range color data in textures. Floating point texture formats are the natural choice for HDR applications, but they may not be available on all target systems. This Direct3D 10 sample shows how high dynamic range data can be encoded into integer formats for compatibility across a wide range of devices. This sample also includes a Direct3D 9 fallback.
This Direct3D 10 sample shows a simple example of the High-Level Shader Language (HLSL) without using the effect interface.
This Direct3D 10 sample shows an example of using instancing to render a complex scene using few draw calls.
This sample shows how an ID3DX10Mesh object can be created from mesh data stored in a Wavefront Object file (.obj). This sample is an adaption of the Direct3D 9 sample MeshFromOBJ, which demonstrates best practices when porting to Direct3D 10 from Direct3D 9. The sample code has been constructed to facilitate side by side comparisons between versions to assist with learning.
This Direct3D 10 sample demonstrates using a combination of fin extrusion in the geometry shader and anisotropic texture filtering to create the illusion of motion blur.
This sample shows how to handle multiple monitors in Direct3D 10.
Multi-Stream rendering for Direct3D10 and Direct3D9 codepaths
This is one of 3 sample applications shown during the Advanced Real-Time Rendering in 3D Graphics and Games course at SIGGraph 2007. The Direct3D 10 sample shows N-Body particles system managed entirely by the GPU.
This Direct3D 10 sample shows a particles system managed entirely by the GPU.
This samples illustrates picking using Direct3D 10.
This Direct3D 10 sample shows how to use the geometry shader to create new geometry on the fly.
This Direct3D 10 sample shows various procedural materials created through shaders.
This sample shows how to render terrain using cone-step mapping in the pixel shader.
This Direct3D 10 sample shows how to implement shadow volume using the Geometry Shader. This sample also includes a Direct3D 9 fallback
Basic starting point for new Direct3D 10 samples. This sample also includes a Direct3D 9 fallback
The Skinning10 sample demonstrates 4 different methods of indexing bone transformation matrices for GPU skinning. In addition, it demonstrates how stream out without a Geometry Shader can be used to cut down vertex processing cost when skinned model will used for mutiple rendering passes.
This Direct3D 10 sample eliminates artifacts commonly seen when 2D particles intersect 3D geometry by reading the depth buffer and clipping particles against it smoothly. On a Direct3D 10.1 card, it also shows how to do the same technique against an MSAA enabled depth buffer.
This Direct3D 10 sample shows facial animation using sparse morph targets, wrinkle maps, and LDPRT lighting.
This Direct3D 10 sample demonstrates Charles Loop's and Scott Schaefer's Approximate Catmull-Clark subdivision surface technique running on D3D10 hardware.
This sample, contributed by AMD, presents a technique for achieving MSAA quality rendering for primitives that require transparency. It utilizes Direct3D 10.1 APIs and hardware to make use of the new fixed MSAA sample patterns, and the export of the coverage mask from the pixel shader.
See directx-sdk-samples for fully modernized version of Direct3D 11 samples.
This Direct3D 11 sample shows a simple example of using the High-Level Shader Language (HLSL).
This sample, contributed by AMD, presents a Direct3D 11 Shader Model 5.0 accelerated technique that uses non-stationary, dynamic-weight matrices for unique per-sample filter weights (these don't necessarily represent a seperable filter) for a contact hardening shadow effect
DDS texture loading without using the D3DX helper functions.
Includes the fixes from this blog post
This sample, contributed by AMD, presents a technique for applying tessellation with displacement mapping using decals. Given an arbitrary mesh, the sample uses a ray cast to find the location of where a ray from the eye point intersects the mesh. A decal is placed at the intersection and the mesh is rendered with tessellation so that the triangle density is high enough for accurate displacement mapping. One possible use for this technique is to represent realistic looking 3D damage on objects.
This sample, contributed by AMD, demonstrates the use of detail tessellation for improving the quality of material surfaces in real-time rendering applications.
Minimal starting point for new Direct3D 11 applications. This sample also includes a Direct3D 9 fallback
This sample, contributed by AMD, presents a technique for achieving smooth surfaces from the position and normal data of a low density mesh.
Basic starting point for new Direct3D 11 samples. This sample also includes a Direct3D 9 fallback
This Direct3D 11 sample demonstrates how to use the WM_TOUCH messages in an RTS style game.
MFC-based DirectSound samples last shipped in November 2007.
Games and new projects should strongly prefer to use XAudio2 instead of legacy DirectSound.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Visual Studio 2019