Vous voulez voir cette page en français ? Cliquez ici.


or
Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics
 
See larger image
 

The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics [Paperback]

Randima Fernando , Mark J. Kilgard
4.1 out of 5 stars  See all reviews (10 customer reviews)
List Price: CDN$ 62.99
Price: CDN$ 39.68 & this item ships for FREE with Super Saver Shipping. Details
You Save: CDN$ 23.31 (37%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Temporarily out of stock.
Order now and we'll deliver when available. We'll e-mail you with an estimated delivery date as soon as we have more information. Your account will only be charged when we ship the item.
Ships from and sold by Amazon.ca. Gift-wrap available.

Product Details


Product Description

From the Inside Flap

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 StructureChapter 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

About the Author

Randima (Randy) Fernando is Manager of Developer Education at NVIDIA.

Mark J. Kilgard is a Senior Software Engineer at NVIDIA.

Tag this product

 (What's this?)
Think of a tag as a keyword or label you consider is strongly related to this product.
Tags will help all customers organize and find favorite items.
Your tags: Add your first tag
 

 

Customer Reviews

10 Reviews
5 star:
 (3)
4 star:
 (5)
3 star:
 (2)
2 star:    (0)
1 star:    (0)
 
 
 
 
 
Average Customer Review
4.1 out of 5 stars (10 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most helpful customer reviews

4.0 out of 5 stars Good intro to shaders, Jun 4 2004
By 
Dave Astle (San Diego, CA) - See all my reviews
(REAL NAME)   
This review is from: The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics (Paperback)
This is a well written book covering the Cg shading language. It contains a lot of useful information about Cg and graphics programming techniques in general. Unfortunately, I felt like it didn't cover as much of Cg as I would have liked, making the book less useful than it could have been.

The book starts with a history of shaders and programmable hardware, an overview of Cg, and a summary of related technologies, such as HLSL and CgFX. It then spends some time covering the syntax and semantics of Cg, and then moves on to the core material of the book, in which the authors explain key graphics pipeline functionality and how it can be implemented using Cg. The book concludes with several appendices covering the Cg runtime, CgFX file format, and Cg standard library, as well as other reference material.

The topics covered include transformations, animation, lighting, environment mapping, bump mapping, fog, shadow mapping, toon shading, and projective texturing. The explanations are all clear and understandable, in particular the chapter on bump mapping, which is one of the easiest introductions to the topic I've encountered. Features of Cg are introduced as needed while explaining these topics, rather than introducing them all at once, which is very conducive to learning. In addition, the authors include warnings and workarounds for techniques which may not be supported on older hardware, as well as advice on attaining optimal performance.

I have two primary complaints about the book. The first is that they never really discuss the application code using the shaders, which made it a bit difficult to understand how they fit in at times. The second is that the book isn't nearly as complete a reference as you might expect. For a great deal of the functions and functionality in Cg, they simply refer you to the Cg reference manual. Although this electronic document is freely available, it's fairly brief at times, so a more detailed explanation in the book would have been appreciated. Similarly, I would have liked to have seen more detailed explanation of CgFX, as well as examples of using it.

Overall, though, this book does a very good job of introducing the reader to Cg and to shaders in general. If you're new to these topics, I'd recommend it. Even if you're a DirectX programmer intending to use HLSL, you'll find this book useful since the languages are identical (though the usage is of course different). If you're already an experienced graphics programmer with some knowledge of shaders, then you'll likely be able to find everything you need in the freely available documentation instead.

Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


4.0 out of 5 stars Great introductory shaders book, Jun 3 2004
By 
Dave Astle (San Diego, CA) - See all my reviews
(REAL NAME)   
This review is from: The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics (Paperback)
This is a well written book covering the Cg shading language. It contains a lot of useful information about Cg and graphics programming techniques in general. Unfortunately, I felt like it didn't cover as much of Cg as I would have liked, making the book less useful than it could have been.

The book starts with a history of shaders and programmable hardware, an overview of Cg, and a summary of related technologies, such as HLSL and CgFX. It then spends some time covering the syntax and semantics of Cg, and then moves on to the core material of the book, in which the authors explain key graphics pipeline functionality and how it can be implemented using Cg. The book concludes with several appendices covering the Cg runtime, CgFX file format, and Cg standard library, as well as other reference material.

The topics covered include transformations, animation, lighting, environment mapping, bump mapping, fog, shadow mapping, toon shading, and projective texturing. The explanations are all clear and understandable, in particular the chapter on bump mapping, which is one of the easiest introductions to the topic I've encountered. Features of Cg are introduced as needed while explaining these topics, rather than introducing them all at once, which is very conducive to learning. In addition, the authors include warnings and workarounds for techniques which may not be supported on older hardware, as well as advice on attaining optimal performance.

I have two primary complaints about the book. The first is that they never really discuss the application code using the shaders, which made it a bit difficult to understand how they fit in at times. The second is that the book isn't nearly as complete a reference as you might expect. For a great deal of the functions and functionality in Cg, they simply refer you to the Cg reference manual. Although this electronic document is freely available, it's fairly brief at times, so a more detailed explanation in the book would have been appreciated. Similarly, I would have liked to have seen more detailed explanation of CgFX, as well as examples of using it.

Overall, though, this book does a very good job of introducing the reader to Cg and to shaders in general. If you're new to these topics, I'd recommend it. Even if you're a DirectX programmer intending to use HLSL, you'll find this book useful since the languages are identical (though the usage is of course different). If you're already an experienced graphics programmer with some knowledge of shaders, then you'll likely be able to find everything you need in the freely available documentation instead.

Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


3.0 out of 5 stars Good introduction to Cg, Dec 5 2003
By A Customer
This review is from: The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics (Paperback)
My review here is from an experienced OpenGL programmer's perspective.

This is an good introduction to the Cg shading language. It goes well beyond the free introductory PDFs on Cg that you can download from the nVidia site, and will quickly bring you up to speed. If you are unfamiliar with the new generation of graphics cards with programmable GPUs, you will love the introductory chapters. There is also an excellent chapter on bump mapping - the best, practical explanation of the technique I have ever seen. (Other books keep harping about tangent space, without explaining *why* you choose tangent space - never mentioning that it *is* possible to do it in object space.)

Now, for a few gripes:

1. There is no clear explanation for how exactly information (say, a calculated light position) should be passed from the vertex program to the fragment program. There are many ways to do this, and there is no suggested way of doing this. (eg: I can use out float3 var: POSITION, NORMAL, COLOR0, TEXCOORD0 - which one should I use and why?)

2. The vertex and fragment programs are given as such without any calling code. This may be really tough for beginners.

3. It does not provide a good reference to all the built in Cg functions. In many cases, you have to guess whether a function returns a value or modifes a parameter passed in. For example, there is only 1 line in the book about the faceforward(Ng, I, N) call. What is Ng? Does this function return any value?

4. The utility value of this book will plummet after you go through it once, since it is only an introduction. So I feel it should be priced accordingly. $45 is too much. I recommend getting it used, like I did, for half the price.

I like the book, but it is definitely not in the calibre of the Red book. (The OpenGL programming guide)

Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No

Share your thoughts with other customers: Create your own review
Want to see more reviews on this item?
 Go to Amazon.com to see all 14 reviews  4.4 out of 5 stars 
 
 
Most recent customer reviews








Only search this product's reviews



Listmania!

Create a Listmania! list

Look for similar items by category


Look for similar items by subject


Feedback


Amazon.ca Privacy Statement Amazon.ca Shipping Information Amazon.ca Returns & Exchanges