Buy new:
$83.42$83.42
FREE delivery January 9 - 14
Ships from: DeckleEdge LLC Sold by: DeckleEdge LLC
Save with Used - Acceptable
$56.91$56.91
Ships from: Amazon Sold by: Goodbooks Company
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
The CG Tutorial: The Definitive Guide to Programmable Real-Time Graphics
Purchase options and add-ons
- ISBN-100321194969
- ISBN-13978-0321194961
- PublisherAddison-Wesley Professional
- Publication dateJanuary 1, 2003
- LanguageEnglish
- Dimensions7.5 x 1 x 9.5 inches
- Print length384 pages
Editorial Reviews
From the Back Cover
"Cg is the key to unlocking the power of a new generation of programmable graphics hardware. This book is the definitive introduction to Cg, and will be essential for anyone programming high-quality real-time graphics. The Cg Tutorial will teach you to use Cg to create effects never before available for real-time applications."
--Larry Gritz, Author of Advanced RenderMan (Morgan Kaufmann, 2000) "An important and timely book: Pixel-level procedural textures--animated clouds, fire, water, the whole bag of procedural tricks--finally go from the movie screen to the desktop. Access to computation of this power through a C-like language will usher in an exciting new era for the graphics community."
--Ken Perlin, Professor, New York University
Cg (C for graphics) is a complete programming environment for the fast creation of special effects and real-time cinematic quality experiences on multiple platforms. By providing a new level of abstraction, Cg lets developers more directly target OpenGL®, DirectX®, Windows®, Linux, Mac OS X®, and console platforms, such as the Xbox, without having to program directly to the graphics hardware assembly language. Cg was developed by NVIDIA® Corporation in close collaboration with Microsoft® Corporation, and is compatible with both the OpenGL API and Microsoft's HLSL for DirectX 9.0.
The Cg Tutorial explains how to implement both basic and advanced techniques for today's programmable GPU architectures.
Major topics covered include:
- 3D transformations
- Per-vertex and per-pixel lighting
- Skinning and key-frame interpolation
- Environment mapping
- Bump mapping
- Fog
- Performance optimization
- Projective texturing
- Cartoon shading
- Compositing
The accompanying CD-ROM includes the tools needed to run the sample programs in the book.
0321194969B02192003
About the Author
Randima (Randy) Fernando is Manager of Developer Education at NVIDIA.
Mark J. Kilgard is a Senior Software Engineer at NVIDIA.Excerpt. © Reprinted by permission. All rights reserved.
Once upon a time, real-time computer graphics was all about vertices, triangles, and pixels. In fact, it still is. However, the level at which a programmer controls the processing and appearance of these graphics primitives has advanced considerably. Until a few years ago, programmers had to rely on the CPU to process all the transformation and rasterization algorithms needed to produce computer-generated images. Over time, hardware engineers executed these algorithms via specialized, high-performance 3D graphics hardware. Rather than implement the algorithms directly, programmers learned to access the hardware-provided graphics functionality through standard 3D programming interfaces, such as OpenGL (developed by Silicon Graphics SGI) and Direct3D (developed by Microsoft). At first, such costly 3D graphics hardware appeared only in high-priced UNIX workstations and flight simulators. Now, through the miracle of Moore’s Law, the benefits of graphics hardware acceleration have been bestowed on low-cost PCs and game consoles.
Although the performance gained by employing dedicated graphics hardware to execute the brute-force tasks of transforming vertices, rasterizing triangles, and updating pixels far exceeded the performance possible just with CPU programming, real-time 3D programmers gave up a considerable measure of control in exchange for this speed. Developers were limited to using a fixed-function palette of graphics operations that the hardware could handle. Sometimes a skilled and dedicated programmer could coax the graphics programming interface and hardware to accomplish something beyond the ordinary, but this was usually hard, time-consuming work.
While graphics hardware engineers were advancing the real-time performance of their specialized pixel-pushing hardware, off-line computer graphics software packages such as Pixar’s PhotoRealistic RenderMan were changing the look of movies and television with amazing computer-generated special effects. The pre-recorded nature of movies and most television content makes these media well suited for offline rendering. Computer-generated images for film and video are not rendered in real time but instead carefully constructed frame by frame in hours, days, or weeks using standard general-purpose CPUs. The advantage of using general-purpose CPUs is that rather than settle for hard-wired hardware algorithms, programmers and artists can use the CPU to create any effect they might imagine. What these so-called offline rendering systems lack in relative speed, they make up in rendering quality and realism.
The flexibility and generality of offline rendering systems are the key features that have been missing from preceding generations of 3D graphics hardware. In other words, what was lost was programmability.
Realizing this limitation, computer graphics architects have designed a new generation of graphics hardware that permits an unprecedented degree of programmability. Now, many of the programmable shading techniques that are employed so successfully in offline rendering can enter the realm of real-time graphics.
Developers of offline rendering systems created a type of specialized computer language known as a shading language to express the graphics operations required to make surfaces look the way artists intend. A shading language for programmable graphics hardware provides the same sort of functionality but in the context of real-time graphics hardware. Graphics programmers and artists benefit from such a high-level programming language in much the same way that conventional programmers do from C++ or Java. Using a high-level language for graphics hardware automates the process of translating the programmer’s intent into a form that the graphics hardware can execute.
This book is about Cg, the premier language for programmable graphics hardware. NVIDIA developed Cg in close collaboration with Microsoft. Cg is the most portable and productive way for you to unleash the power within programmable graphics hardware. This book is a tutorial to teach you how to write Cg programs.
Our Intended Audience
We tried to write this book in a way that makes it valuable to both novices and advanced readers. If you’re new to the world of programmable graphics, this book should give you a firm foundation on which to build. If you encounter a word or concept that is foreign to you and not sufficiently explained, consult the “Further Reading” section at the end of each chapter.
The main audience for this book is 3D game and application programmers, managers of such projects, real-time 3D artists, and computer graphics students—or anyone else interested in learning about the state of the art in real-time rendering. You do not have to be an experienced programmer to learn Cg from this book, though you should be relatively familiar with programming language concepts. If you are familiar with C or one of its derivatives, such as C++ or Java, Cg will be very approachable. Cg programs are relatively short, often less than a page, so even an artist or novice programmer can get the gist of Cg from this tutorial and learn to write interesting Cg programs.
Computer graphics programming involves math. Understanding basic algebra and trigonometry will help you appreciate several sections. You should also be familiar with the math behind basic computer graphics vertex transformation and lighting models. You do not need to know OpenGL or Direct3D, but familiarity with either programming interface is very helpful. All of the Cg examples described work with either OpenGL or Direct3D unless otherwise noted. Some examples that require advanced Cg functionality may not work on older graphics processors.
The Book’s Structure
Chapter 1 introduces Cg. Each chapter that follows is a short tutorial that presents specific Cg concepts and techniques. The tutorials build upon each other, so we recommend reading the chapters in order.- Chapter 1 lays out the foundations of Cg and real-time programmable graphics hardware.
- Chapter 2 presents the simplest Cg programs.
- Chapter 3 explains parameters, textures, and expressions.
- Chapter 4 shows how to transform vertices.
- Chapter 5 covers the implementation of lighting models with Cg.
- Chapter 6 describes how to animate and morph models with Cg vertex programs.
- Chapter 7 explains environment mapping with Cg.
- Chapter 8 shows how to implement bump mapping.
- Chapter 9 discusses a number of advanced topics: fog, cartoon shading, projected spotlights, shadow mapping, and compositing.
- Chapter 10 explains the set of currently available Cg vertex and fragment profiles, and provides advice for improving the performance of Cg programs.
This book gets you started but does not contain everything you will eventually want to know about Cg. This tutorial complements other documentation (such as the Cg Toolkit User’s Manual: A Developer’s Guide to Programmable Graphics) included with the Cg Toolkit. Please consult the user’s manual and other Cg documentation for further information.
Trying the Examples
We’ve designed the accompanying software framework so that you can get straight to work, even if you don’t know anything about OpenGL, Direct3D, C, or C++. Our goal is to isolate the Cg language and allow you to experiment freely with it. Of course, as you move toward starting a real-world application with Cg, your project will probably require some combination of OpenGL, Direct3D, C, and C++.
The accompanying software framework allows you to try out the various Cg examples in the book without worrying about graphics APIs, C, or C++ code. The latest versions of the applications are free to download via the book’s companion Web site. The software on the accompanying CD works only on the Windows platform, but versions for Linux and Macintosh systems are available online. Appendix A explains how to download the latest versions of Cg and the accompanying tutorial application.
The tutorial application makes it easy for you to tweak the book’s examples, to see how changing a particular Cg example can immediately affect the rendered 3D result. If you can, have a computer that supports Cg nearby to try out the examples. With our software, you just write Cg programs without worrying about the particulars, such as loading 3D models and textures. When you want to know all the gory details, examine the source code, all of which is freely available for download, so you can see how Cg interfaces with C++ and OpenGL or Direct3D. The Cg Toolkit also comes with several simple examples that you can learn from.The end of each chapter includes suggested exercises that you can work on to explore Cg further.
0321194969P02192003
Product details
- Publisher : Addison-Wesley Professional (January 1, 2003)
- Language : English
- Paperback : 384 pages
- ISBN-10 : 0321194969
- ISBN-13 : 978-0321194961
- Item Weight : 1.81 pounds
- Dimensions : 7.5 x 1 x 9.5 inches
- Best Sellers Rank: #2,657,113 in Books (See Top 100 in Books)
- #587 in Computer Graphics
- #1,198 in Graphics & Multimedia Programming
- #5,043 in Computer Graphics & Design
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read book recommendations and more.
Customer reviews
- 5 star4 star3 star2 star1 star5 star39%61%0%0%0%39%
- 5 star4 star3 star2 star1 star4 star39%61%0%0%0%61%
- 5 star4 star3 star2 star1 star3 star39%61%0%0%0%0%
- 5 star4 star3 star2 star1 star2 star39%61%0%0%0%0%
- 5 star4 star3 star2 star1 star1 star39%61%0%0%0%0%
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
There was a problem filtering reviews right now. Please try again later.
- Reviewed in the United States on July 13, 2014Should you want to know about Cg, this is the text to get. It is free on the nVidia Developer web site, but this text makes for an easier digest content.
However...
The text itself is somewhat cheaply produced, and the ink is light, making reading difficult except under very good lighting conditions. The content itself is quite well done.
- Reviewed in the United States on June 13, 2008As the owner of a game company, books like this are a valuable asset in getting our developers who aren't familiar with CG up to speed on the subject.
This book is highly recommended by our development staff, and our developers went out an purchased their own personal copies of the book even though we have it in our office library.
- Reviewed in the United States on September 27, 2007The current generation of GPUs puts a huge amount of rendering power at your fingertips. This book gives a great intro to a range of highly versatile techniques, including bump maps, shadows, complex illumination models, fog, non-realistic rendering, and lots more. You need a little math, but only what's given here. For example, you'll need to know what a dot product is, and the formulas are given. You won't need to know all the extras, like the geometric and trigonometric properties of dot products - those are simply stated where they become useful. Best, the entire discussion is illustrated with simple, legible samples of working code. The cut&paster gets off to a running start. This book really delivers what the title promises: Cg, by means of clear discussion and useful examples.
The book does not deliver what the title does not promise. For example, the authors discuss the effect of finer or coarser tesselation on image quality, but give no idea how to create the geometric models. Because the authors discuss only what goes on inside the GPU, they scarcely mention how to get your shader programs into it, and scarcely mention vertex shaders at all. Those aren't defects in the book, they're choices made by the authors. This book does a lot, but you'll need other references, possibly more than one of them, if you want to build a complete application.
Advanced graphics programmers have probably seen most of this before, and the barest beginners are still struggling with their box's shrink-wrap code samples. If you're ready for the second and third steps of graphics programming, then this could be very helpful. The "gallery" section could be a bit longer and the images a bit bigger, but this is really a how-to book and succeeds nicely in what it set out to do.
-- wiredweird
- Reviewed in the United States on March 28, 2009This is one of the books highly recommended for learning hardware programming. Found it likewise.
- Reviewed in the United States on March 31, 2003This is a very decent introduction to Cg and shaders in general. It starts off by describing the programable pipeline, and then introduces the shaders. The chapters describe how shaders can be developed for most of the common stuff in real-time graphics. But the best aspect of this book is that it does not cater just to the cutting edge(cineFX/DX9) but also demonstrates how the shader can be developed for a baseline hardware system. Performance and cineFX tips are sprinkled throughout the book along with a collected Cg reference section.
Overall a very good way to start learning Cg and real-time programming using shaders.
- Reviewed in the United States on March 14, 2003This is an excellent book for the beginning or advanced Cg and Graphics programmer. This book not only does and excellent job of explaining the insides of Cg but also of laying out the math behind what's going on with the effects.
A must have.
- Reviewed in the United States on September 12, 2003This is the perfect book for an artist who wants to get more technically involved with graphics development and anybody who wants to do graphics programming. Cg means C for graphics. It was specifically created to give programmers and artists greater freedom in graphics output. The code can compile to run on many operating systems including Windows, OS X, and X-box. The authors take you through the details of using the language to develop content. They also include exercises so you can test yourself and of great importance a CD.
- Reviewed in the United States on March 22, 2003Traditional graphics textbooks did not contain programmable real-time shading techniques. This book is a good example to fill in this gap. In my opinion, university can start a new course teaching programmable real-time shading....
Top reviews from other countries
RustyReviewed in Germany on May 6, 20144.0 out of 5 stars Good reference, but...
... the entire content is published on the nvidia developer webpage. I assumed errantly that the book would cover a little more.
Additionally, the use of cg is depricated according to nvidia (though still commonly supported) and the use of the glsl standard recommended instead.