In each release of our SDK you will find hundreds of code samples, effects, whitepapers, and more to help you take advantage of the latest technology from NVIDIA. Check out our SDK Home Page to download the complete SDK, or browse through individual code samples below. You can also click on the video links for a quick preview, or the thumbnail images for a gallery of larger images.
This code is released free of charge for use in derivative works, whether academic, commercial, or personal. (Full License)
|
|
Coverage-Sampled Antialiasing (CSAA) Tutorial
This sample demonstrates how to enable Coverage-Sampled Antialiasing (CSAA) on GeForce 8 series GPUs in DX9. |
|
|
|
Whitepaper
Download
|
|
|
|
Virtual Shadow Depth Cube Textures
This code sample demonstrates a variety of techniques for increasing the performance of omnidirectional shadowmapping effects on DirectX 9 hardware, including an implementation of virtual shadow depth cube texturing as described in ShaderX3 (a technique for efficiently 'unrolling' a cube shadowmap into a hardware-accelerated depth texture, such as D24_X8 on NVIDIA GeForce FX, 6- and 7-series hardware). |
|
|
|
Download
|
|
|
|
Antialiasing with Transparency
This sample demonstrates the GeForce 7 Series per-primitive super-sample and multi-sample modes for antialiasing primitives with transparent fragments. The problem with using alphatest to virtually simulate geometry is a hard edge that is produced where the test occurs. The conventional solution for dealing with this problem is to use alpha blending. Using a GeForce 7 Series GPU, you can enable super-sampling or multi-sampling per-primitive, yielding much higher image quality along the alpha tested edges. |
|
|
|
Whitepaper
Video
Download
|
|
|
SLI Best Practices
This sample demonstrates the proper way to detect SLI-configured systems, as well as how to achieve maximum performance benefit from SLI. |
|
|
|
Whitepaper
Download
|
|
|
Post Processing Effects with Anti Aliasing
This example demonstrates how to combine post-processing effects with multisample
antialiasing in OpenGL. Current texture hardware is not capable of reading directly
from a multisampled buffer, so it is not possible to use render-to-texture in this case.
Instead, we render to the back buffer, and then use glCopyTexImage to copy from the
back buffer to a texture. The copy performs the necessary downsampling automatically.
This example also shows how to use the Transparency Antialiasing mode of the ARB multisample
extension to provide higher quality, order independent transparency for geometry
such as trees. This mode converts the alpha value of the pixel into a 16-level (dithered)
coverage mask, which is logically ANDed with the raster-generated coverage mask. |
|
|
|
Download
|
|
|
Simple Framebuffer Object
This simple code example shows how to use the framebuffer object (FBO) extension to perform rendering to texture in OpenGL. The code renders a wireframe teapot to an off-screen frame buffer object, binds this as a texture and then displays it to the window on a textured quad.The FBO extension has the advantages that it is window system independent and does not require a separate OpenGL context for each render target.
See the GL_EXT_framebuffer_object spec for more details. |
|
|
|
Download
|
|
|
|
NVDeviceID
A simple example to identify NVIDIA's product families through the use of Direct3D adapter identifier. Select the userguide link below to access an updated list of NVIDIA device ids. |
|
|
|
User Guide
Download
|
|
|
Vendor/Device ID Sample Example
A simple sample to show how to retrieve vendor and device ID's for the primary display device. Select the userguide link below to access an updated list of NVIDIA device ids. |
|
|
|
Utility
User Guide
Download
|
|
|
|
Image Histogram
This example implements an image histogram using occlusion queries. For a histogram with n entries this method takes n passes. It renders the scene to a texture, and then for each bucket in the histogram renders a quad with the scene texture, using a fragment program that discards pixels outside the range of interest. Occlusion query is used to count how many pixels remain, and were therefore inside the range. |
|
|
|
Download
|
|
|
GPU Video Effects
This sample uses the GPU to render post-processing effects with source images and video. It takes advantage of the nv_image_processing framework, Cg, and GLSL for to implement several video filters, including guassian blur, edge detection overlay, wobble, TV-noise, radial blur, and night vision. |
|
|
|
User Guide
Download
|
|
|
Discrete Cosine Transform
This example shows how to implement the forward and inverse discrete cosine transform (DCT) using fragment programs. The DCT operates on 8x8 pixel blocks and is used as the basis for JPEG compression. The code can perform the forward DCT followed by the inverse DCT at around 160 frames per second for a 512 x 512 monochrome image on a GeForce 6800. This could be extended into a complete hardware accelerated JPEG viewer by performing the rest of the JPEG algorithm (entropy decompression etc.) on the CPU and adding resampling and color space conversion to the GPU code. |
|
|
|
Download
|
|
|
|
Dynamic Ambient Occlusion
This sample demonstrates a new technique for computing diffuse light transfer and shows how it can be used to compute global illumination for animated scenes. The technique efficiently calculates ambient occlusion and indirect lighting data on the fly for each rendered frame. It does not have the limitations of precomputed radiance transfer (PRT) or precomputed ambient occlusion techniques, which are limited to rigid objects that do not move relative to one another. It works by treating polygon meshes as a set of surface elements that can emit, transmit, or reflect light and that can shadow each other. This method is efficient because it works without calculating the visibility of one element to another. Instead, it uses a much simpler and faster technique that uses shadowing to account for occluding (blocking) geometry. |
|
|
|
Whitepaper
Video
Download
|
|
|
Antialiasing with Post-Processing
In this sample, an antialiased backbuffer is read as the source image for a post-processing effect which creates a green glow. The IDirect3DDevice9::StretchRect() function is used to copy the antialiased image to a render-target texture for post-processing. This technique yields better results than simply rendering the scene to an off screen render target.
|
|
|
|
Whitepaper
Video
Download
|
|
|
GPU Cloth
This sample demonstrates how to use Shader Model 3.0 to simulate and render cloth on the GPU. The cloth vertex positions are computed through several pixel shaders and saved into a texture. A vertex shader then reads these positions using Vertex Texture Fetch (VTF) to render the cloth. |
|
|
|
User Guide
Whitepaper
Video
Download
|
|
|
Snow Accumulation
This sample shows a technique for procedurally adding snow to a non snow scene. |
|
|
|
Whitepaper
Download
|
|
|
GPU Filter for Photoshop(tm)
This code example implements a Photoshop™ filter plugin that performs its key pixel operations using GLSL shaders. Docs are included to guide developers who desire to use GLSL in Photoshop on their own. This code sample requires the use of Adobe's Photoshop CS API toolkit, which is available to registered developers directly from Adobe Systems. If you just want to use the filter without compiling the source, move the enclosed GPUFilter.8bf to your local Photoshop Plugins\Filters folder. |
|
|
|
Whitepaper
Download
|
|
|
QuerySample
Shows how to check for availability and use of the various query types supported in DirectX9. This sample queries for and displays results for queries of type: event, occlusion, timestamp, timestamp frequency, timestamp disjoint, and if running with the debug runtime, resource and vertex stats.
|
|
|
|
User Guide
Download
|
|
|
|
Glow
This demo presents a technique that is very similar to the glow effect developed for Buena Vista Interactive's "Tron 2.0." The glow is created by post-processing the rendered scene in a series of render-to-texture operations, where the alpha channel contains the strength of the glow sources at each pixel. The technique is compatible with full-scene anti-aliasing, which you can activate through the demo's GUI. |
|
|
|
Whitepaper
Download
|
|
|
Stencil Shadow Volume Extrusion
In this sample, vertex shaders are used to extrude polygon objects into stencil shadow volumes. This avoids the CPU cost of computing shadow volumes and updating the shadow volume vertex buffers. It requires more memory to store additional face vertices and zero-area triangles for the automatic shadow volume extrusion. |
|
|
|
Download
|
|
|
Mandelbrot
PS.3.0 shaders and fp32 render target textures are used to compute the Mandelbrot set fractal on the GPU. This demonstrates ps.3.0 branching and the accuracy of fp32 rendering. Zoom in to the set by left-clicking, and zoom out by right-clicking. The demo can also render the Julia set for the point at the center of the current Mandelbrot view. |
|
|
|
Whitepaper
Download
|
|
|
HDR with 2x FP16 MRTs
This sample shows how to exploit the floating power texturing power and shader model 3.0 of the GeForce 6 and 7 series on HDR applications. Bilinear and anisotropic fp16 texture filtering and vertex texture fetch (VTF) are used to speed up some of the different steps of the HDR rendering process such as image downsampling, blurring or luminance adaptation. Additionally, on the 6 series, by using two G16R16F render targets and MRT, you can achieve an additional speed up (20 to 30%).
(All HDR maps are courtesy of Paul Debevec www.debevec.org). |
|
|
|
User Guide
Download
|
|
|
DXSAS Sample Implementation 0.8
This sample demonstrates how to implement a DirectX Semantics and Annotations (DXSAS) ScriptExecute parser in an engine. Full support for the standard annotations and semantics is provided. The user interface lets you apply multiple scene and model effects simultaneously, so the you can see hundreds of different effect combinations. All effect files were developed using FX Composer. |
|
|
|
User Guide
Download
|
|
|
Video Filter
This sample demonstrates how apply shader effects onto two videos and composite them together using pixel shaders. Shaders are then used to perform YUV2RGB color conversion, color correction, and effects like sepia, blur, sharpen, luminance edge detection, fade, and radial blur. |
|
|
|
Whitepaper
Video
Download
|
|
|
PBO Texture Performance
Explores various ways to use OpenGL pixel buffer objects (PBOs). This code sample can also be used to see the maximum bus-transfer rates for textures to and from the GPU. |
|
|
|
User Guide
Video
Download
|
|
|
|
Multiple Draw Buffers
This simple example illustrates the use of the ATI_draw_buffers extension to render to multiple draw buffers simultaneously. Instead of outputing a single color value, a fragment program can now output up to 4 different color values to 4 separate buffers. This feature is supported on all GeForce 6 series GPUs. It is known as "Multiple Render Targets" in Direct3D. |
|
|
|
Download
|
|
|
GPGPU Disease
This sample creates a disturbing dynamic disease effect. It simulates a phenomenon known as chemical reaction-diffusion, by solving the governing partial differential equations in a fragment program. The result is an endless variety of changing patterns that are then used to generate bump and texture maps which are applied to a mesh with various shaders. |
|
|
|
User Guide
Download
|
|
|
GPGPU Fluid
This code sample demonstrates fast, realistic fluid dynamics simulation on the GPU. The sample solves the Navier-Stokes equations for incompressible fluid flow using a technique originally presented at SIGGRAPH 1999 by Jos Stam. The sample allows the user to draw arbitrary obstacles and flow viscous or inviscid fluid around them. |
|
|
|
User Guide
Whitepaper
Download
|
|
|
Simple Soft Shadows
This sample demonstrates how branching in fragment programs can be used to optimize soft shadow rendering in OpenGL. This technique could also be applied to accelerate other filtering algorithms to increase performance significantly on GPUs that support Shader Model 3.0. |
|
|
|
Whitepaper
Video
Download
|
|
|
Soft Shadows
This sample shows how to use conditional branching to compute filtered soft shadows efficiently. This technique could also be applied to accelerate other filtering algorithms to increase performance significantly on GPUs that support Shader Model 3.0. |
|
|
|
User Guide
Whitepaper
Video
Download
|
|
|
|
HDR Deferred Shading
This sample shows high dynamic range (HDR) lighting combined with deferred shading. Deferred shading is a technique where the components of the lighting equation (surface attributes like the normal, position, albedo, etc.) are rendered into multiple screensized render targets (MRTs). Lighting is then done using geometrically simple passes over these MRT buffers, fetching the components of the lighting equation and outputting lighting results. This results in less shaded depth complexity, less geometry processing, better batching, and a cleaner rendering pipeline. The high dynamic range comes from the lighting passes being accumulated using fp16 blending into a floating point render target, after which tone mapping and a bloom effect are done using fp16 filtering to get the HDR results into the displayable 0..1 range. |
|
|
|
User Guide
Video
Download
|
|
|
Simple NV_fragment_program2
This simple example demonstrates the use of the NV_fragment_program2 extension, including looping and branching in fragment programs, and fast normalization of fp16 vectors using the "NRM" instruction. The example uses this functionality to implement multiple per-pixel lights in a single pass. NV_fragment_program2 is only available on GeForce 6 series GPUs. |
|
|
|
Video
Download
|
|
|
16-bit Floating Point Blending and Filtering
This simple example demonstrates 16-bit floating point blending and texture filtering. It repeatedly renders an OpenEXR-format image to a 16-bit floating point p-buffer with additive blending, and then uses a fragment program to display the results to the screen. The exposure multiplier value can be increased and decreased using the '+' and '-' keys. |
|
|
|
Video
Download
|
|
|
Simple Vertex Texture
This simple example demonstrates the use of the NV_vertex_program3 extension to perform texture look-ups in a vertex program. It uses this feature to perform simple displacement mapping. The example also shows how to implement bilinear filtering of vertex texture fetches. |
|
|
|
Video
Download
|
|
|
Instancing
This sample uses Microsoft's Direct3D9 Instancing Group to render thousands of meshes on the screen with only a handful of draw calls. This significantly reduces the CPU overhead of submitting many separate draw calls and is a great technique for rendering trees, rocks, grass, RTS units and other groups of similar (but necessarily identical) objects. |
|
|
|
Whitepaper
Video
Download
|
|
|
High Dynamic Range Rendering
This example demonstrates how to implement simple high-dynamic range rendering in OpenGL on both GeForce FX and GeForce 6 series GPUs. It loads environment map images in the Radiance ".hdr" format and uses these to light simple 3D objects. On GeForce FX series GPUs it uses two "HILO" format cubemaps (16-bit integer). On GeForce 6 series GPUs it uses 16-bit floating point cube maps with texture filtering. The example also implements a glow post-processing effect using a separarable Gaussian blur. |
|
|
|
Video
Download
|
|