SLI Zone
NVIDIA.com Developer Home

NVIDIA Direct3D SDK 10 Code Samples

In each release of our SDK you will find numerous code samples, complete with carefully commented source code, whitepapers, and videos to help you take advantage of the latest technology from NVIDIA.

This code is released free of charge for use in derivative works, whether academic, commercial, or personal (Full License).

DirectX SDK (June 2010) is required to compile some code samples. Please obtain the DirectX SDK redistributable from Microsoft.


Download the complete Direct3D SDK 10.


Instanced Tessellation For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This example shows how to simulate tessellation using instancing. Adaptive tessellation is implemented as described by Dyken et al in Semi-uniform Adaptive Patch Tessellation

The example uses tessellation to render a displaced subdivision surface rendered with a polynomial approximation to the Catmull Clark surface. Control points of the approximation mesh are precomputed using the algorithm by Loop and Schaefer in Approximating Catmull-Clark Subdivision Surfaces with Bicubic Patches, the algorithm by Loop et al in Approximating Subdivision Surfaces with Gregory Patches for Hardware Tessellation and the algorithm by Myles et al in Fast Parallel Construction of Smooth Surfaces from Meshes with Tri/Quad/Pent Facets.
  Minimum Required GPU

Graphics API Type




Whitepaper
Download


Stencil Routed K-Buffer For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample illustrates a method for capturing 8 layers of fragments with a single geometry pass. The results are similiar to depth peeling (an implementation is included) but since multiple layers are captured at once it is much faster. This is accomplished with sub-sample stencil routing, and therefore requires Direct3D 10's ability to read from an MSAA render target.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Percentage Closer Soft Shadows For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Percentage Closer Soft Shadows (PCSS) is a shadow mapping technique that renders realistic soft shadows with varying penumbra that harden on contact. The Knight model used in this project has kindly been provided by animedia PM at Turbo Squid and can be found here.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Screen Space Ambient Occlusion For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Ambient occlusion is a lighting model that approximates the amount of light reaching a point on a diffuse surface based on its directly visible occluders. We present a novel screen space ambient occlusion algorithm that gives perceptual clues of curvature and spatial proximity and thus is commonly used to add a global illumination look to rendered images. Our approach operates on the depth buffer of the scene being rendered and the associated per-pixel normal buffer. We thank Marko Dabrovic for the Sibenik model.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Skinning with Dual Quaternions For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

"Quaternion skinning" refers to a number of skinning animation techniques that, in contrast to the standard skinning, use quaternions rather than matrices. Such methods have been developed with the purpose to eliminate well-known artifacts inherent to the regular skinning, which uses matrices. This sample demonstrates only one of those techniques, "dual quaternion linear blending."
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Instancing Tests For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

A simple application to allow performance testing of custom meshes using instancing. Allows automated control of instance count, mesh, CPU load, increment, etc. Dumps perofrmance data to a handy file importable into Excel.
  Minimum Required GPU

Graphics API Type




Whitepaper
Download


Parallax Mapping For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Advanced parallax mapping techniques.
  Minimum Required GPU

Graphics API Type





Download


Volume Light For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Volume Light technique can be considered a simple approximation of real world light scattering effect.
  Minimum Required GPU

Graphics API Type




Whitepaper
Download


Skinned Instancing For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample shows the use of instancing and vertex texture fetch on the GeForce 8 Series to implement a crowd of GPU animated characters, all independently animating but drawn with a single draw call.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Lightning For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample shows how to simulate and animate different kinds of lighting effects using DirectX10 features. The structure of a lightning beam is created by using fractal subdivision of line segments, efficiently implemented using geometry shaders and stream out. A geometry shader is then used to create camera facing billboards with a procedurally created color gradient. The atmospheric glow effect is implemented by downsampling and blurring the rendered bolts of lighting using a Gaussian filter kernel with separate extinction coefficients per color channel in order to fake atmospheric scattering.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Smoke For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This demo shows how to simulate and render real-time three dimensional smoke and Fire. Both simulation and rendering are made easier using DirectX 10's new render to 3D texture functionality. The Smoke and Fire also correctly interact with moving objects in thier path and composite seamlessly into the scene.
  Minimum Required GPU

Graphics API Type



Video

Download


Deformable Bodies For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample shows a full physical simulation of non-rigid deformable bodies on the GPU. Simulation, collision detection and response, and rendering are all done on the GPU.
  Minimum Required GPU

Graphics API Type




Whitepaper
Download


Rain For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample shows how to animate and render rain as a particle system entirely on the GPU. Stream out is used to animate the rain particles over time, and the geometry shader is used to extrude rain particles into quads at render time. Rain particles are realistically rendered using precomputed textures (indexed by light direction and viewing direction) which are stored in a texture array. These textures have been created and provided by Kshitiz Garg here.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Fur - Shells and Fins For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample demonstrates a simple way of rendering fur using the shells and fins technique. The geometry shader is used for creating the geometry for fins on silhouette and near silhouette edges. The cat model used in this project has kindly been provided by DGArt at Turbosquid here.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Clipmaps For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Clipmaps are a feature first implemented on SGI workstations that allow mapping extremely high resolution textures to terrains. The original SGI implementation required highly specialized, custom hardware. The advanced features of the NVIDIA® GeForce® 8800 now permit the same algorithm using consumer hardware.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


HDRRendering For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Demonstrates HDR rendering on the GeForce 8800 and DirectX10. The GeForce 8800 supports new features to facilitate next-gen HDR. There are new texture and render target formats, such as R11G11B10F, which has the same memory requirements as standard 32-bit RGBA. The sample also demonstrates anti-aliasing combined with HDR, including high-quality 16x Coverage Sample Anti-Aliasing.
  Minimum Required GPU

Graphics API Type



Video

Download


Cloth Simulation For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample demonstrates how to simulate cloth on the GPU using DirectX 10. The cloth vertex positions are computed in several rendering passes by looping through the vertex and geometry shader stages using the stream output stage to stream the positions out of the geometry stage.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


SolidWireframe For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Render the wireframe of a mesh using filled triangles, coloring only the fragments near the edges of the triangle. This technique produce high quality thick antialised lines on the mesh edges, without any z fighting issues. This technique is a DirectX10 implementation of the SIGGRAPH 2006 sketch "Single-Pass Wireframe Rendering". This technique can be easily added in an existing graphics engine as it only requires one pass and all algorithm is based on the position of the vertices.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Soft Particles For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Particle sprites in games commonly produce artifacts – unnaturally sharp edges – where they intersect the rest of the scene. This sample shows two ways to fade out flat sprites against a 3D scene, softening the artificial edges. Two solutions are implemented: one uses the ability of DirectX10 to read the depth buffer as a texture; the other uses a more conventional second render target to store depth values. - one other rendering Z in a 2nd render target
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


GPUBlendshapes For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This paper presents two methods for computing Blend Shapes on the GPU. The technique produces hybrid, blended meshes by combining a large number of input meshes. GPU generations prior to GeForce 8800 had to use the vertex attributes to send additional data for blend shapes. Because of the limited amount of available attributes, few simultaneous blend shapes meshes were possible. The GeForce 8800 permits a large number of input meshes, with no fixed limit.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Sparkles For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

The Sparkling effect shows how to render sparkles onto the surface of a mesh using sprites. Those sprites are generated with the Geometry Shader, a new graphics pipeline unit in DirectX 10. The distribution of the sparkles onto the mesh is done according to the area they cover. A level-of-detail (LOD) scheme is also implemented to avoid rendering too many sparkles when objects are too far or too small.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


DX10FeatureDemo For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This is a show case of various DX10 features
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Perlin Fire For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample uses an improved Perlin noise algorithm on the GPU. This method renders realistically animated fully procedural fire, with individual uniquely animated flame shapes generated in a pixel shader that uses three-dimensional simplex flow noise or four-dimensional simplex noise. The improved Perlin noise algorithm requires many complex scalar computations, making it a great match for the scalar architecture of the NVIDIA® GeForce® 8800 GPU.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


MetaBalls For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample demonstrates efficient use of DX10 geometry shader to perform isosurface tessellation
  Minimum Required GPU

Graphics API Type



Video

Download


Coverage-Sampled Antialiasing Tutorial For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample demonstrates how to enable Coverage-Sampled Antialiasing (CSAA) in DirectX 10 applications running on NVIDIA GeForce 8 series GPUs and better. CSAA permits the use of high-quality anti-aliasing modes, such as 16x and 8x, for processing and storage costs that are close to conventional 4x or 8x anti-aliasing.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Variance Shadow Mapping For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Variance Shadow Mapping was introduced in 2006 as a way to produce high quality soft shadows using arbitrary filter kernels. This allows for a sizable performance benefit over PCF as the shadow map can be pre-filtered with a separable blur. The Knight model used in this project has kindly been provided by animedia PM at Turbo Squid and can be found here .
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Denoising For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

Image denoising algorithms may be the oldest in image processing. While a wide variety of methods has been invented, the problem of reducing noise is still unsolved. Many methods, independently of their implementation, share the same basic idea – noise reduction can be achieved through image blurring. Blurring can be done locally, as in the Gaussian smoothing model or anisotropic filtering, by calculus of variations or in the frequency domain, such as Weiner filters. However the best approach is still to be found. Among others, neighboring filters – filters that restore a pixel by taking an average of the values of neighboring pixels with a similar color, are of great interest due to simplicity of implementation and good results. A DX10 solution is to store an image in a texture and use pixel shader to implement a kernel. Whereas the same approach could be used in DX9, shader model 4.0 available in DX10 has no limitation on the quantity on instructions, and allows the methods to be implemented in a single pass.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


SoftShadows For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This demo presents two algorithms for soft shadow rendering. The common advantage of the presented algorithms is that, in contrast with standard PCF (Percentage Closer Filtering) algorithms, they do not use pseudo-random samples to sample the shadow map. Hence, partially shadowed areas lack noise typically introduced by PCF algorithms.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download


Texture Arrays (terrain) For a direct link to this sample, right-click and copy the URL (shortcut) of this link icon.

This sample is a simple example using Texture Arrays in DX10. It uses a texture array as a palette of terrain textures to render a terrain mesh with many textures in a single draw call. A similar effect in previous APIs would require a texture atlas or multiple draw calls.
  Minimum Required GPU

Graphics API Type



Video
Whitepaper
Download

Last Update: 1/18/2011
NVPerfHUD 4