SLI Zone
NVIDIA.com Developer Home

Last Updated: 10 / 08 / 2008

Real-time Texturing Algorithms and Techniques

Real-time Rendering at NVIDIA

Texture mapping is at times both the easiest and most complex tool in the game developer's arsenal. The following NVIDIA papers, presentations, and tools links will help you make the most of it.

Textured shadow mapping is a deep enough subject for a separate dedicated shadowing page.

Understanding Texture | Procedural Texturing | Tools and Resources

Understanding Texture

Samples from NVIDIA Graphics SDK 10.5:
Parallax Mapping
A sample(with source code) showing advanced parallax mapping techniques.
Fur - Shells and Fins (Whitepaper)
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.
Clipmaps (Whitepaper)
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.
HDR Rendering (Video)
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.
Texture Arrays (Whitepaper)
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.
Compress YCoCg-DXT (Whitepaper)
This example demonstrates how a pixel shader can be used to compress a dynamically rendered color map into a texture, using both the DXT1 and YCoCg-DXT5 texture formats.
Compress Normal-DXT (Whitepaper)
This example demonstrates how a pixel shader can be used to compress a dynamically rendered normal map into a texture, using both the DXT5 and LATC texture formats.
Render to 3D Texture (Whitepaper)
This sample demonstrates the use of framebuffer objects to render to a 3D texture. It does a simple wave simulation on the 3D texture, and displays it by ray marching
Simple Texture Array (Whitepaper)
Demonstrates the use of the OpenGL GL_EXT_texture_array extension.
HDR (Whitepaper)
HDR demonstrates the use of new image formats for use in high-dynamic range rendering.
Samples from NVIDIA Graphics SDK 9.52:
Fast Third Order Filtering (Whitepaper)
Demonstrates a fast and efficient technique to perform cubic texture filtering. This technique is described in this GPU Gems 2 chapter.
PBO Texture Performance (User Guide)
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.
Simple Vertex Texture (Video)
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.
16-bit Floating Point Blending and Filtering (Video)
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.
Vertex Texture Fetch Water (Whitepaper)
This sample demonstrates a technique for simulating and rendering water. The water is simulated via Verlet integration of the 2D wave equation using a pixel shader. The simulation result is used by a vertex shader via vertex texture fetch (VTF). The water surface is rendered by combining screen-space refraction and reflection textures.
Atlas Comparison Viewer (Whitepaper)
This sample compares texturing from regular textures versus textures from an atlas. Putting multiple textures in at atlas can help reduce draw calls, thus decreasing CPU load. Comparisons are made with respect to both image quality and performance.
Anisotropic Lighting (Whitepaper)
The anisotropic lighting effect shows the vertex program's halfangle vector calculation. It uses HdotN and LdotN per-vertex to look up into a 2D texture to achieve interesting lighting effects.
Detail Normalmaps
Illustrates the use of detailed normalmaps.
Raytraced Refraction
This shader presents a method for adding high-quality details to small objects using a single-bounce ray traced pass. In this example, the polygonal surface is entryd and a refraction vector is calculated. This vector is then intersected with a plane that is defined as being perpendicular to the object's X axis. The intersection point is calculated and used as texture indices for a painted Iris.
The sample permits varying the index of refraction, the depth and density of the lens. Note that the choice of geometry is arbitrary -- the model shown is a sphere, but any polygonal model can be used.
Separate Specular
This simple sample illustrates using the separate specular extension for controlling texture blending. Separate specular offers a small subset of the texture blending flexibility of the register combiners, but it is useful for simple blending operations and works on a broad range of hardware
Bump Mapping
This entry demonstrates tangent space bump mapping using a GLSL vertex and fragment shader. The vertex shader transforms the light and half-angle vectors into tangent space and the fragment shader uses the normal fetched from a normal map to do per-pixel bump mapping on a sphere.
The entry also demonstrates a bump mapping technique called parallax bump mapping where the height map is used to offset the texture coordinates used to fetch from the diffuse and normal maps to produce the illusion of more depth in the bumps.
Thinfilm
This sample shows a thin film interference effect. Specular and diffuse lighting are computed per-vertex in a GLSL vertex shader, along with a view depth parameter, which is computed using the view vector, surface normal, and the depth of the thin film on the surface of the object. The view depth is then perturbed in an ad-hoc manner per-fragment by the underlying decal texture, and is then used to lookup into a 1D texture containing the precomputed destructive interference for red / green / blue wavelengths given a particular view depth. This interference value is then used to modulate the specular lighting component of the standard lighting equation.
Vertex Shader Water
This sample gives the appearance that the viewer is surrounded by a large grid of vertices (because of the free rotation), but switching to wireframe or increasing the frustum angle makes it apparent that the vertices are a static mesh with the height, normal, and texture coordinates being calculated onthe-fly based on the direction and height of the viewer. This technique allows for very GPU-friendly water animations because the static mesh can be precomputed. The vertices are displaced using sine waves, and in this example a loop is used to sum five sine waves to achieve realistic effects.
Cull Fragment Simple
This sample illustrates using the cull fragment texture shader. Automatic object space texture coordinate generation is used to provide texture coordinates representing relative distance to clipping planes. Based upon distance to the two planes, a fragment is rejected or accepted for further processing. This is similar to an alpha test but instead of using alpha, the (s,t,r,q) texture coordinates determine if a fragment should be eliminated from further processing. The texture shader program used is very simple.
Bumpy Shiny Patc
A very simple example of "classic" texture shaders.
Cull Fragment Complex
This sample illustrates using the cull fragment texture shader in conjunction with a vertex program to perform complex cull fragment operations. In this example a vertex program is used to compute custom texture coordinates representing distance from a point (or minimum distance from a set of points). These texture coordinates are then used to reject or accept a fragment during rasterization. The vertex program is also used to compute a simple diffuse lighting term.
HDR Paint (Video)
This example demonstrates the use of floating point textures and render-to-texture to implement interactive high dynamic range painting. It uses fragment prorams to implement several different display and brush modes. The application is resolution-independent - all rendering is performed to an offscreen floating point pbuffer, which can then be displayed at any size or position. Each brush stroke is rendered as a single textured quad. Floating point blending is implemented in the shader using two pbuffers which are alternated between each brush stroke. One is used as the source buffer and the other is the destination. The modified area is copied back from the destination to the source for the next frame.
Offset Bump Mapping
This entry illustrates Tangent Space offset BumpMapping in action.
PBuffer to Texture Rectangle
This demonstrates how to use OpenGL's NV_texture_rectangle extension. It renders to a pbuffer then does a fast glCopyTexSubImage2D() to copy it.
Simple Float Pbuffer
This entry illustrates a simple float Pbuffer in OpenGL.
Texture Shader with Offset Texture 2D
Texture Shader with a rippling offset
The Game of "Life"
This entry uses a vertex program, a texture shader, and 3 different register combiner setups to play the famous Conway's Game of Life entirely on the GPU. It also uses pbuffers for off-screen rendering, and demonstrates the use of a simple alpha test trick to gain some performance.
Simple P-Buffer
This entry demonstrates how to use amn OpenGL p-buffer for off-screen rendering.
Simple Render Texture
This OpenGL sample renders a the scene to a texture and then maps the texture to a rectangle
Simple Texture Rectangle
This OpenGL sample displays a simple textured rectangle
GPU Gems 2 online:
Chapter 2. Terrain Rendering Using GPU-Based Geometry Clipmaps
Chapter 8. Per-Pixel Displacement Mapping with Distance Functions
Chapter 11. Approximate Bidirectional Texture Functions
Chapter 12. Tile-Based Texture Mapping
Chapter 18. Using Vertex Texture Displacement for Realistic Water Rendering
Chapter 20. Fast Third-Order Texture Filtering
Chapter 24. Using Lookup Tables to Accelerate Color Transformations
Chapter 27. Advanced High-Quality Filtering
Chapter 28. Mipmap-Level Measurement
GPU Gems online:
Chapter 19. Image-Based Lighting
Chapter 20. Texture Bombing
Chapter 22. Color Controls
Chapter 24. High-Quality Filtering
Chapter 25. Fast Filter-Width Estimates with Texture Maps
Chapter 26. The OpenEXR Image File Format
GDC 2006: When Shaders and Textures Collide
This GDC Art-Track Presentation given by Kevin Bjorke covers a few fine points of handling shader inputs with textures and the optimal ways to manage your normal maps, MIPmaps, and the texture-creation pipeline.

Procedural Texturing

Gems etc

Texturing Tools and Resources

Texture Tools 2
Photshop
Atlas Tools
Melody
Shader Lib
Transforming Textures

Want to Learn More? NVIDIA Documentation Home Page




nvidiadeveloper Twitterfeed
Popular References
Free Books Online