Direct3D - microsoft/DirectX-SDK-Samples GitHub Wiki

Direct3D 9 Samples

These samples all require the legacy D3DX9 and D3DCompiler_43 components provided by the Microsoft.DXSDK.D3DX NuGet package. For more information on the package, see this blog post.

AntiAlias (October 2004)

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.

BasicHLSL (September 2003)

This sample shows a simple example of the High-Level Shader Language (HLSL) using the effect interface.

CompiledEffect (September 2003)

This sample shows how an ID3DXEffect object can be compiled when the project is built and loaded directly as a binary file at runtime.

ConfigSystem (December 2004)

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.

CustomUI (July 2004)

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.

DepthOfField (October 2002)

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.

EffectParam (July 2004)

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.

EmptyProject (July 2004)

Minimal starting point for new Direct3D 9 applications

HDRCubeMap (September 2003)

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.

HDRFormats (July 2004)

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.

HDRLighting (September 2003)

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.

HDRPipeline (December 2005)

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.

HLSLwithoutEffects (September 2003)

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.

Instancing (October 2004)

This sample demonstrates the new instancing feature available in DirectX 9.0c and shows alternate ways of achieving results similar to hardware instancing.

IrradianceVolume (September 2005)

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.

LocalDeformablePRT (December 2004)

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.

MeshFromOBJ (July 2004)

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.

MultiAnimation (September 2003)

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.

OptimizedMesh (July 2004)

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.

ParallaxOcclusionMapping (April 2006)

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.

Pick (December 2005)

This samples illustrates picking using Direct3D 9.

PixelMotionBlur (September 2003)

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.

PostProcess (July 2004)

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 (February 2005)

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.

PRTDemo (December 2004)

This sample features several scenes which compare precomputed radiance transfer (PRT) implementations against the standard lighting equations.

ShadowMap (July 2004)

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.

ShadowVolume (July 2004)

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.

SimpleSample (July 2005)

Basic starting point for new Direct3D 9 samples

SkinnedMesh (July 2004)

The SkinnedMesh sample shows how to use D3DX to load and display a skinned mesh.

StateManager (July 2004)

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.

Text3D (December 2002)

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.