Normally 3D rendering and high-quality, path-based 2D rendering are distinct forms of rendering that cannot easily be mixed. Moreover while the GPU excels at 3D rendering, conventional path rendering systems for PDF, Flash, SVG, HTML 5 Canvas, TrueType, etc. have depended on the CPU for 2D path rendering.
The latest NVIDIA drivers support a new OpenGL extension called NV_path_rendering that changes this. Now CUDA-capable NVIDIA GPUs can fully accelerate path rendering. Check out:
Get a release 275.xx NVIDIA driver (or better yet, the 280.19 beta driver) and try out the demos. Get drivers from (or search for your OS):
NV_path_rendering is supported for Windows XP, Vista, Windows 7, Linux, FreeBSD, and Solaris in both 32-bit and 64-bit OS flavors.
NV_path_rendering allows path objects containing line segments, quadratic and cubic Bezier segments, and partial elliptical arcs to be transformed then filled or stroked entirely on the GPU. The stroking includes all the standard embellishments such as end caps, join styles, and dashing. Unlike conventional path rendering systems where shading is generally limited to solid color, linear gradients, radial gradients, and simple 2D texturing, NV_path_rendering allows arbitrary OpenGL per-fragment shading to be applied to filled or stroked path. So you can use fixed-function, Cg, GLSL, or assembly shaders.
Rendering glyphs from fonts is a first-class feature in all path rendering systems. NV_path_rendering is no different and allows you to create path objects from either standard driver-supported outline fonts (same on every platform where NV_path_rendering is supported) or use system fonts. Instanced path rendering makes it easy to draw sequences of characters, including kerned spacing. There’s support for rendering text directly from Unicode UTF-8 or UTF-16 strings. This makes high-quality font rendering truly portable across operating systems; the same NV_path_rendering font rendering code for Windows just works on the non-Windows platforms.
For a good overview of what NV_path_rendering supports, see the “An Introduction to NV_path_rendering” presentation:
For programmers, the “Getting Started with NV_path_rendering” tutorial shows how easy it is to GPU-accelerate path rendering. See:
The NVprSDK includes the source code for the nvpr_whitepaper example discussed in the “Getting Started” tutorial. Get NVprSDK from:
There’s also a nvpr_hello_world example included in the NVprSDK that really renders “Hello world!” in OpenGL with the first-class text support. The text uses a system-supported sans-serif font, includes stroked outlining for emphasis or offsetting the text from background imagery, underlining, kerned spacing, and the text is drawn the a green-to-blue vertical gradient.
NV_path_rendering mixes seamlessly with the rest of OpenGL. So you can mix path rendering with depth-tested 3D rendering in projective views. Read the “Mixing Path Rendering and 3D” tutorial to learn how to do this. This tutorial also shows how to apply arbitrary OpenGL fragment shading to paths. This isn’t something you can do with conventional path rendering systems. See:
Making path rendering a first-class rendering mode in OpenGL means you can use OpenGL clip planes, scissoring, depth testing, stencil testing, transformations, color/texture coordinate/fog generation, stippling, fragment shading, blending, and multisampling while rendering paths. Path rendering and 3D really are on equal terms now and fully GPU-accelerated. The same matrix transformations, textures, and fragment shaders you use for 3D rendering can be used as-is with path rendering.
Definitely check out the nvpr_tiger3d and nvpr_shaders examples.
If you want to just try out the 14 examples in the NVprSDK, I recommend running the pre-compiled examples found in the NVprDEMOs distribution:
The most interesting demo is the nvpr_svg example. It shows how GPU-accelerated path rendering with NV_path_rendering compares to other path rendering systems in both performance and quality. You can compare NV_path_rendering to Cairo, Skia, Qt, Direct2D (requires Vista and Windows 7), and the OpenVG reference implementation. You’ll find NV_path_rendering is generally much faster.
For non-Windows users on Linux, FreeBSD, or Solaris, you can run these same demos but you’ll have to be a bit more ambitious and build the demos from the NVprSDK but you can play with the same demos.
Most CPU-based path rendering systems have to make approximations in the interest of speed. They often approximate curved path boundaries with line segments, particularly for stroking. They typically conflate opacity computations with transparency. They take short cuts filtering color ramps for gradients or image texturing. All these simplifications and approximations diminish the overall path rendering quality.
However CUDA-capable GPUs are massively parallel architectures that make direct rendering of paths without such approximations. This leads to better overall rendering quality while at much faster rendering rates.
More questions? Try the FAQ:
I hope this helps.