NVIDIA Shader Library

With a wide range of shaders including skin, natural effects, metals, post processing effects, and much more, the NVIDIA Shader Library exists to help developers easily find and integrate great shaders into their projects.

All the shaders in this library are provided free of charge for use in derivative works, whether academic, commercial, or personal (Full License).

shadow PCSS

post complements

scene deferred

GeForce 6

GeForce 6

GeForce 6

material shadow DirectX10 textured

image processing color conversion illustration DirectX10 textured

material image processing rendering DirectX10 textured

Perceptually-correct soft shadows. For more information, please see the "Percentage-Closer Soft Shadows" talk from GDC 2005. The talk is available at (1 technique/s)

Color space conversion -- takes the existing scene, and polarizes the colors along the color wheel -- colors that are close to the "Guide Color" become more like the guide, while colors closer to its complementary color in that direction. Parameters allow control of how tightly colors "bunch up" and permits the user to turn the effect so that desaturated colors are less affected. In the sample image, an orange tone was chosen -- skin tones are reddish and those have migrated towards the orange guide, while colors near blue (complement of orange) have become bluer. (1 technique/s)

A simple defered-rendering example -- an initial pass renders color, surface normals, and view vectors into multiple render targets (textures). A second pass combines the data in these textures with lighting info to create a final shaded image.(1 technique/s)

This postprocess uses the values rendered by the previous part of the scene, and re-interprets their values as a 2D displacement map, which it applies to another image. The standard way to use this would be to have all objects export their normals. (1 technique/s)

A "godrays" effect done as a single pass. Make sure the input texture has alpha! It works best on a simple planar card, but go ahead and experiment with all sorts of geometry. The size of the glow is kept constant in screen space by adjustng the rays according to the partial derivates of UV in screenspace x and y -- that is, using ddx(UV) and ddy(UV) (1 technique/s)

This material shows and compares results from four popular and advanced schemes for emulating displaement mapping. They are: Relief Mapping, Parallax Mapping, Normal Mapping, and Relief Mapping with Shadows. Original File by Fabio Policarpo. (4 technique/s)

"Toksvig-factor" anti-aliased bump mapping -- eliminate "buzzy" hilights along bump edges. Note use of 16-bit textures (g16r16) for precision with performance A description of the technique can be found at (2 technique/s)

Create a transparent "envelope" around any existing model. While implemented as a "post process" effect, this effect is just a second pass on the geometry -- no render-to-texture is needed. Great cheap effect for glows (or deep-sea egg pods) (1 technique/s)

Amazing inflating teapots! A plastic "balloon" surface (lit from either a point or directional source). Twiddle the "inflate" parameter to change the shape.(1 technique/s)

Application of "Image Enhancement by Unsharp Masking the Depth Buffer" from Siggraph 2006. This version applies the depth enhancement to an existing scene. The scene can be rendered very simply -- in fact it looks great on "flat" render effects like "FlatTexture" but can work with any sort of rendering. The user should choose Near and Far depth values to cover the ranges of depth found in the scene. See the original paper at heres (1 technique/s)

A simple defered-rendering example. Some channels are currently un-used, while the "ViewSampler" could be considered redundant (you COULD calculate it on the fly, if texture-bandwidth limited)(1 technique/s)

A simplified UV-space-diffusion effect for use on character skin. See the chapter in GPU Gems 3 for the full nine yards! This shader further-extends the techniques from "scene_uvd_skin" and "scene_uv_diffusion" by adding shadows. The light and shadow here are unwrapped into a UV-space texture, diffused in surface coordinates and re-applied to the geometry in 3D, mixed with yet more 3D lighting to give both the crisp "immediacy" of the skin surface along with the soft, subsurface-diffused tones of skin's natural translucence. This effect is easy to apply to existing models without requiring any new art assets.(1 technique/s)

An .FX Paint Program. Scene geometry is ignored. Draw with the left mouse button. To clear screen, just make the brush big and paint everything. Resizing the window will mess up your drawing. Brush strokes will change in size and opacity over time, set "FadeTime" to a high value for more even (though less expressive) strokes. (1 technique/s)

This shader assumes the input model is a multi-segment unit square in XY with center at the origin. It distorts this unit square into a disk-like "ring" for use in sword battles etc. (1 technique/s)

UV-space lighting diffusion, as pioneered by George Borshukov in the "Matrix" films. We also use a specal "TexBlender" value, as used in the NVIDIA "Human Head" demo, to control the mix of surface detail in tandem with textured subsurface scattering. Be sure that your object UV coordinates fit within the range 0-1 and have no repeats or overlaps. (1 technique/s)

Phong-shaded, metal- and plastic-style surfaces with a mirror term. Plastic or dielectic surfaces have varying reflectivity according to the angle at which a surface is viewed -- this variation is often called "fresnel" reflectance. (2 technique/s)

Clip low and high colors so that the resulting image is within a narrower range, e.g. for TV signals. Two Techniques are provided -- one clips the colors that go outside the specified range between Min and Max, while the other stretches or compresses the total color space to conform to the indicated range. (2 technique/s)

A phong-shaded plastic-style surface lit from either a point or directional source. Textured, untextured, quadratic falloff or not (4 technique/s)

A phong-shaded metallic surface lit from either a point or directional source. Textured, untextured, quadratic falloff or not (4 technique/s)

This surface is DULL. A matte, lambert surface lit from either a point or directional source (You can attach either a point light OR a directional source to it). Four techniques are provided: permutations of textured/untextured and quadratic-falloff/constant lighting (4 technique/s)

A phong-shaded plastic-style surface lit from a point source. Textured, untextured, quadratic falloff or not (4 technique/s)

This .fx file uses 3d checker patterns to illustrate a number of important coordinate systems and shading vectors. #define USER_COLORS if you want to use parameters instead of the fixed macro colors. (8 technique/s)

This effect file uses colors to illustrate a number of shading vectors -- that is, values that are typically important in shading. This effect can often help find bogus parts of models, or be used to explore the contents of a model. (15 technique/s)

Simple edge lighting effect -- the color of the surface shifts when viewed on-edge. Optionally, the light color can also be effected -- the result of both is to create an illusion of the surface being covered by some sort of smooth barely-visible fuzz. (1 technique/s)

Shading via multitexture. Two textures are interpolated over the surface, and their product results in the final specular BDRF. The initial textures supplied approximate a Cook-Torrance model using one set of possible parameters, but different textures can be used to emulate a wide variety of isotropic BRDF models. Try painting some of your own! (2 technique/s)

A simple combination of vertex and pixel shaders with velvety edge effects. Great for any model that needs that "feeling of softness." (4 technique/s)

Shading via multitexture. In this case, a texture is used to vary the underlying surface color based upon both the view angle and the angle at which ligh strikes the surface. The initial data driving this shading model came from Ford Motor Company, which directly measured "Mystique" and other lustrous car paints in their lab. The associated default texture is a hand-enhanced variant on the original Ford paint -- try painting your own! (2 technique/s)

"Grisaille" is a style of drawing based on a style of sculture relief where the figures are "flattened" against a larger flat surface. This effect allows the user to tweak the "flatness" of the shading against the surface of the screen, as if the 3D scene were carved in (animating) relief. (2 technique/s)

Uses a texture map as a high-speed lookup, so that complex anisotropic highlights can be displayed in real time. This new version of the effect generates its own anisotropy map, and is compatible with both FX Composer and EffectEdit. (1 technique/s)

A sort of defered toon shading, which renders the light-dark transition as a soft, rounded line. This technique inspired by a method used in Studio Ghibli's "Howl's Moving Castle." Typically, you should render objects using an un-shaded effect (that is, pure color and/or texture -- no lighting, or lighting with a strong ambient light) (1 technique/s)

A lambertian-like surface with light "bleed-through" -- appropriate for soft translucent materials like skin. The "subColor" represents the tinting acquired by light diffused below the surface. Set the "Rolloff" angle to the cosine of the angle used for additional lighting "wraparound" -- the diffuse effect propogates based on the angle of LightDirection versus SurfaceNormal. Versions are provided for shading in pixel or vertex shaders, textured or untextured. (4 technique/s)

Just pass image through as monochrome -- multiply it by the relative intensities defined by the parameters "Red," Green," and "Blue." (1 technique/s)

This is much like a Photoshop(tm) "color mixer" layer -- the intensities of each input red, green, and blue channels are graded against the colors indicated in the paramter list, then remixed.(1 technique/s)

HLSL noise implementation for an animated vertex program. This is based on Ken Perlins original code: heres (1 technique/s)

Similar to the classic "RenderMan Companion" wood shader, though for realtime performance we use a noise texture rather than calls to a numeric noise() function. This texture can be loaded from disk, or dynamically created on the spot by DirectX9 using the HLSL virtual machine and setting the macro "PROCEDURAL_TEXTURE". This new version is updated to support varying shininess for light and dark bands in the wood. (1 technique/s)

A noisy halftoning pattern, based on noisy pre-calculated an indexed out of a 3D volume texture. (1 technique/s)

Simple Point-lit Plastic using the (Phong) "lit()" function and with quadratic light falloff. This shader can be used for most any clean, simple, NON-METALLIC surface. Three techniques are shown: Two pixel-shaded versions, with or without a texture, or a lower-quality vertex-shaded version with a texture. (3 technique/s)

A helpful tool for artists to optimize their texture sizes, so that textures created by artists wont be too small (looking bad) or too big (wasting artist time on texture detail that will never be seen). HOW TO USE UVDETECTIVE: (1) Look for regions where desired texture reso is dominant. (2) Set desired size in the "Reso" parameter. (3) In the "TexRez" techniques (6 technique/s)

Simple tone mapping shader with exposure and gamma controls. This is an HDR example, so it requires a GPU capable of supporting the FP16 formats used in typical HDR formats such as OpenEXR.heres (1 technique/s)

Place a gradient background into the scene. The colors are animatable and the interpolation of the gradient occurs in HSV color space, rather than RB, to provide more-consistent luminance changes (1 technique/s)

Reduce color space - each RGB channel will be reduced to no more than "nColors" tones (1 technique/s)

Renders the scene to an offscreen texture then re-renders it to the screen, with pulsing, changing, on-screen texture coordinates. Clicking the mouse in the screen will also change the effect slightly. (1 technique/s)

Combines two different methods of edge detection to make a more-robust line drawing. (4 technique/s)

Shadow-map for all geometry thats overlaid on white and composited. This trick provides simple shadowing across multiple materials without editing their shaders. The downsides are incorrect shadowing of with transparency and objects that are lit by multiple lights (1 technique/s)

Convert the current scene to monochrome with "sepia" toning(1 technique/s)

3D meshcage effect, created by procedural texturing. Texture is pre-calculated by HLSL. Wires are aligned to world coordinates in this sample. $Date: 2008/06/25 $(1 technique/s)

3D Checkerboard effect, created by procedural texturing. Texture is pre-calculated, using the HLSL virtual machine (VM). To see a purely analytic alternative that gives good anti-aliasing at all scales, see "checker3d_math.fx" As an "extra," the check pattern is also applied to the specular value, to make the variation between materials stronger.(1 technique/s)

3D Checker showing anti-aliasing using ddx/ddy. This result is PURELY numeric, so slower than using texture-based AA. It is, however, able to anti-alias regardless of the view scale. For a fast texture-based version, see "checker3d.fx" (1 technique/s)

A surface using "blinn" shading, which is especially appropriate for some metal finishes and sometimes even for materials like skin. (1 technique/s)

A surface using "blinn" shading, which is especially appropriate for some true finishes and sometimes even for materials like skin. (1 technique/s)

Brick pattern, with controls, using texture-based patterning. The lighting here is PURELY lambert and from a directional source, so it's done in the vertex shader. (1 technique/s)

A wet-glossy surface, a little smoke & mirrors to make things ultra-shiny. Glossiness is controlled not only by the usual power function, but also by applying a set of gloss controls that cause a sharp falloff across a specified range. The falloff will occur in the highlight range [glossBot-glossTop] and the amount of falloff is specified by "glossDrop." Setting "glossDrop" to 1.0 nullifies the effect. (2 technique/s)

A surface using classic "gooch" shading, popular in CAD (1 technique/s)

A surface using classic "gooch" shading, popular in CAD (1 technique/s)

Align as a quad to screen according to the original tex coords -- as a sprite, best applied to simple quads with 0-1 tex coords. Then apply "Numbers.dds" as a stream of number textures to create an apparent numeric ocunter, driven by the vertex shader.(1 technique/s)

This effect is intended to look like pen crosshatching -- it was inspired by the British Museums Durer exhibit of 2003. Some of Durer's most famous drawings were made in two colors of ink on medium-colored paper. The diffuse shape rendering was drawn in cross-hatches in a dark ink (2 technique/s)

Bumpy, fresnel-shiny, plastic/dielectric, textured, with two quadratic-falloff point lights(1 technique/s)

Depth as color - the values Hither' and 'Yon' (Near and Far) must be set explicitly. The result will be an image where the depth will be coded as a blend between foreground and background colors. The "rolloff" parameter can be used to bias values toward the front or back. (1 technique/s)

Day/Night Earth Shader -- Apply to a Sphere! This example uses two textures for the same surface and modulates between them for the light/dark lighting transitions, rather than ramping-off to black. (1 technique/s)

Simple sinusoidal vertex animation on a phong-shaded plastic surface. The highlight is done in VERTEX shading -- not as a texture. Textured/Untextured versions are supplied Do not let your kids play with this shader, you will not get your computer back for a while. (2 technique/s)

Make a 3D volume of color by intersecting a projected rgb texture by its own alpha, where the alpha is projected at right angles. To see the effect. move an object around in XYZ space and it will move in and out of the "nebula" colors. (1 technique/s)

Simple color correction controls using a color matrix, as seen in the NVIDIA "Toys" demo. Controls are much like those on your TV: Brightness, Contrast, etc. (1 technique/s)

Ignore selection geometry, but use its orientation to rotate the colors of a texture mapped to a full-screen quad. In FX Composer, assign this effect to any node, and then spin the node to rotate the color matrix of the overall image. (1 technique/s)

Use a noise texture to distort the render target, creating an appearance not unlike seeing through rippled glass (1 technique/s)

Apply grayscale values to color curve texture -- the color ramp texture can be from read from a file or be created procedurally, just #define CURVE_FILE to use a file. Different techniques provide gradients against each of the R, G, B channels or against an overall grayscale. (4 technique/s)

Key based on the RGB-space distance from a specified color(1 technique/s)

Render-to-Texture (RTT) glow example - glow is overlaid on top of the current scene. The render target is a fixed size. Blur is done in two separable passes: a horizontal pass and then a vertical pass. (2 technique/s)

An imaging effect that looked like viewing through ice-frosted glass. (1 technique/s)

Very similar to "post_frost" but faster at the expense of some sampling choices. (1 technique/s)

Texture-based remap of color space. Color ramp textures can be easily generated by Photoshop and the PS "Curves" command. The technique is described in "GPU Gems" in the section on color control. (1 technique/s)

Gooch style diffuse texturing, per-vertex, based on a point light source See "goochy_gloss" for a pixel-shaded alternative. Gooch shading ranges from a warm tone near the light direction to a cool tone on the opposite side of a model. While non-photorealistic, this approach is useful for revealing overall shape of a form, especially when modelling. (1 technique/s)

Gooch style diffuse shading, calculated PER-PIXEL against a directional light source, and with optional texture-mapping. This version also contains a glossy hilight with threshholding to create a strong impression of surface smoothness. Gooch shading ranges from a warm tone near the light direction to a cool tone on the opposite side of a model. While non-photorealistic, this approach is useful for revealing overall shape of a form, especially when modelling. (2 technique/s)

Simple Point-lit Plastic using the (Phong) "lit()" function and with quadratic light falloff. This shader can be used for most any clean, simple, NON-METALLIC surface. Three techniques are shown: Two pixel-shaded versions, with or without a texture, or a lower-quality vertex-shaded version with a texture. (3 technique/s)

Gooch style diffuse shading, calculated per-vertex against a directional light source. See "goochy_gloss" for a pixel-shaded alternative. Gooch shading ranges from a warm tone near the light direction to a cool tone on the opposite side of a model. While non-photorealistic, this approach is useful for revealing overall shape of a form, especially when modelling. (1 technique/s)

Emulates CMYK printing -- where the print passes are misaligned!!! Note that you might not see much effect on any channel except K' if you apply this effect to a gray object(1 technique/s)

An image effect that's intended to look like the movie-film printing effect called "bleach bypass," where a normal step of processing is skipped to cause unique color- and contrast effects. The "Blend Opacity" slider lets you dial-in the strength of this effect. (1 technique/s)

Typical set of blend modes -- overlay a file texture. By setting the appropriate #define values and recompiling, these shaders also support "Advanced" blend modes like those found in the layers of Adobe Photoshop (TM). Advanced "blend" ranges are available, based on VM-generated textures. For best results,use a card capable of FP-pixel texture support. (38 technique/s)

Simple Point-lit Plastic using the (Phong) "lit()" function and with quadratic light falloff. This shader can be used for most any clean, simple, NON-METALLIC surface. Three techniques are shown: Two pixel-shaded versions, with or without a texture, or a lower-quality vertex-shaded version with a texture. (3 technique/s)