Cart
Free US shipping over $10
Proud to be B-Corp

The Cg Tutorial Randima Fernando

The Cg Tutorial By Randima Fernando

The Cg Tutorial by Randima Fernando


$11.99
Condition - Good
Only 1 left

Summary

Cg is the key to unlocking the power of a generation of programmable graphics hardware. This book features an introduction to Cg. It is essential for anyone programming real-time graphics. It teaches you how to use Cg to create effects for real-time applications.

The Cg Tutorial Summary

The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics by Randima Fernando

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 (R), DirectX (R), Windows (R), Linux, Mac OS X (R), and console platforms, such as the Xbox (TM), without having to program directly to the graphics hardware assembly language. Cg was developed by NVIDIA (R) Corporation in close collaboration with Microsoft (R) 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.

  • About Randima Fernando

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

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

    Table of Contents



    Figures and Plates.


    Examples.


    Tables.


    Equations.


    Foreword.


    Preface.


    1. Introduction.

    What Is Cg?

    A Language for Programming Graphics Hardware.

    Cg's Data-Flow Model.

    GPU Specialization and CPU Generalization.

    The Performance Rationale for Cg.

    Coexistence with Conventional Languages.

    Other Aspects of Cg.

    The Limited Execution Environment of Cg Programs.

    Vertices, Fragments, and the Graphics Pipeline.

    The Evolution of Computer Graphics Hardware.

    Four Generations of Computer Graphics Hardware.

    The Graphics Hardware Pipeline.

    The Programmable Graphics Pipeline.

    Cg Provides Vertex and Fragment Programmability.

    Cg's Historical Development.

    Microsoft and NVIDIA's Collaboration to Develop Cg and HLSL.

    Noninteractive Shading Languages.

    Programming Interfaces for 3D Graphics.

    The Cg Environment.

    Standard 3D Programming Interfaces: OpenGL and Direct3D.

    The Cg Compiler and Runtime.

    The CgFX Toolkit and File Format.

    Exercises.

    Further Reading.



    2. The Simplest Programs.

    A Simple Vertex Program.

    Output Structures.

    Identifiers.

    Structure Members.

    Vectors.

    Matrices.

    Semantics.

    Functions.

    Input and Output Semantics Are Different.

    The Function Body.

    Compiling Your Example.

    Vertex Program Profiles.

    Classes of Cg Compilation Errors.

    Profile-Dependent Errors.

    The Norm: Multiple Entry Functions.

    Downloading and Configuring Vertex and Fragment Programs.

    A Simple Fragment Program.

    Fragment Program Profiles.

    Rendering with Your Vertex and Fragment Program Examples.

    Rendering a Triangle with OpenGL.

    Rendering a Triangle with Direct3D.

    Getting the Same Results.

    Exercises.

    Further Reading.



    3. Parameters, Textures, and Expressions.

    Parameters.

    Uniform Parameters.

    The const Type Qualifier.

    Varying Parameters.

    Texture Samplers.

    Sampler Objects.

    Sampling Textures.

    Sending Texture Coordinates While Sampling a Texture.

    Math Expressions.

    Operators.

    Profile-Dependent Numeric Data Types.

    Standard Library Built-In Functions.

    2D Twisting.

    Double Vision.

    Exercises.

    Further Reading.



    4. Transformations.

    Coordinate Systems.

    Object Space.

    Homogeneous Coordinates.

    World Space.

    The Modeling Transform.

    Eye Space.

    The View Transform.

    Clip Space.

    The Projection Transform.

    Normalized Device Coordinates.

    Window Coordinates.

    Applying the Theory

    Exercises.

    Further Reading.



    5. Lighting.

    Lighting and Lighting Models.

    Implementing the Basic Per-Vertex Lighting Model.

    The Basic Lighting Model.

    A Vertex Program for Basic Per-Vertex Lighting.

    The Fragment Program for Per-Vertex Lighting.

    Per-Vertex Lighting Results.

    Per-Fragment Lighting.

    Implementing Per-Fragment Lighting.

    The Vertex Program for Per-Fragment Lighting.

    The Fragment Program for Per-Fragment Lighting.

    Creating a Lighting Function.

    Declaring a Function.

    A Lighting Function

    Structures.

    Arrays.

    Flow Control.

    Computing the Diffuse and Specular Lighting.

    Extending the Basic Model.

    Distance Attenuation.

    Adding a Spotlight Effect.

    Directional Lights.

    Exercises.

    Further Reading.



    6. Animation.

    Movement in Time.

    A Pulsating Object.

    The Vertex Program.

    Displacement Calculation.

    Particle Systems.

    Initial Conditions.

    Vectorized Computations.

    The Particle System Parameters.

    The Vertex Program.

    Dressing Up Your Particle System.

    Key-Frame Interpolation.

    Key-Framing Background.

    Interpolation Approaches.

    Basic Key-Frame Interpolation.

    Key-Frame Interpolation with Lighting.

    Vertex Skinning.

    The Theory of Vertex Skinning.

    Vertex Skinning in a Vertex Program.

    Exercises.

    Further Reading.



    7. Environment Mapping Techniques.

    Environment Mapping.

    Cube Map Textures.

    Generating Cube Maps.

    The Environment Mapping Concept.

    Computing Reflection Vectors.

    Assumptions for Environment Mapping.

    Reflective Environment Mapping.

    Application-Specified Parameters.

    The Vertex Program.

    The Fragment Program.

    Control Maps.

    Vertex Program vs. Fragment Program.

    Refractive Environment Mapping.

    The Physics of Refraction.

    The Vertex Program.

    The Fragment Program.

    The Fresnel Effect and Chromatic Dispersion.

    The Fresnel Effect.

    Chromatic Dispersion.

    Application-Specified Parameters.

    The Vertex Program.

    The Fragment Program.

    Exercises.

    Further Reading.



    8. Bump Mapping.

    Bump Mapping a Brick Wall.

    The Brick Wall Normal Map.

    Storing Bump Maps As Normal Map Textures.

    Simple Bump Mapping for a Brick Wall.

    Specular Bump Mapping.

    Bump Mapping Other Geometry.

    Bump Mapping a Brick Floor.

    The Vertex Program for Rendering a Brick Floor.

    Bump Mapping a Torus.

    The Mathematics of the Torus.

    The Bump-Mapped Torus Vertex Program.

    Bump Mapping Textured Polygonal Meshes.

    Examining a Single Triangle.

    Caveats.

    Generalizing to a Polygonal Mesh.

    Combining Bump Mapping with Other Effects.

    Decal Maps.

    Gloss Maps.

    Geometric Self-Shadowing.

    Exercises.

    Further Reading.



    9. Advanced Topics.

    Fog.

    Uniform Fog.

    The Attributes of Fog.

    The Mathematics of Fog.

    Intuiting the Equations.

    Creating Uniform Fog with Cg.

    Nonphotorealistic Rendering.

    Toon Shading.

    Implementing Toon Shading.

    Putting It All Together.

    Problems with This Technique.

    Projective Texturing.

    How Projective Texturing Works.

    Implementing Projective Texturing.

    The Code for Projective Texturing.

    Shadow Mapping.

    Compositing.

    Mapping Input to Output Pixels.

    Basic Compositing Operations.

    Exercises.

    Further Reading.



    10. Profiles and Performance.

    Profile Descriptions.

    The Vertex Shader Profile for DirectX 8.

    The Basic NVIDIA Vertex Program Profile for OpenGL.

    The ARB Vertex Program Profile for OpenGL.

    The Vertex Shader Profiles for DirectX 9.

    The Advanced NVIDIA Vertex Program Profile for OpenGL.

    The Pixel Shader Profiles for DirectX 8.

    The Basic NVIDIA Fragment Program Profile for OpenGL.

    The DirectX 9 Pixel Shader Profiles.

    The ARB Fragment Program Profile for OpenGL.

    The Advanced NVIDIA Fragment Program Profile for OpenGL.

    Performance.

    Use the Cg Standard Library.

    Take Advantage of Uniform Parameters.

    Using Vertex Programs vs. Fragment Programs.

    Data Types and Their Impact on Performance.

    Take Advantage of Vectorization.

    Use Textures to Encode Functions.

    Use Swizzling and Negation Freely.

    Shade Only the Pixels That You Must.

    Shorter Assembly Is Not Necessarily Faster.

    Exercises.

    Further Reading.



    Appendix A. Getting Started with Cg.

    Getting This Book's Accompanying Software.

    Getting the Cg Toolkit.



    Appendix B. The Cg Runtime.

    What Is the Cg Runtime?

    Why Use the Cg Runtime?

    Future-Proofing.

    No Dependency Issues.

    Input Parameter Management.

    How Does the Cg Runtime Work?.

    Header Files.

    Creating a Context.

    Compiling a Program.

    Loading a Program.

    Modifying the Program Parameters.

    Executing a Program.

    Releasing Resources.

    Handling Errors.

    More Details.



    Appendix C. The CgFX File Format.

    What Is CgFX?

    Format Overview.

    Techniques.

    Passes.

    Render States.

    Variables and Semantics.

    Annotations.

    A Sample CgFX File.

    Cg Plug-Ins Supporting the CgFX Format.

    Learning More About CgFX.



    Appendix D. Cg Keywords.

    Cg Keyword List.



    Appendix E. Cg Standard Library Functions.

    Mathematical Functions.

    Geometric Functions.

    Texture Map Functions.

    Derivative Functions.

    Debugging Function.



    Index. 0321194969T02192003

    Additional information

    GOR002430645
    9780321194961
    0321194969
    The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics by Randima Fernando
    Used - Good
    Hardback
    Pearson Education (US)
    20030306
    384
    N/A
    Book picture is for illustrative purposes only, actual binding, cover or edition may vary.
    This is a used book - there is no escaping the fact it has been read by someone else and it will show signs of wear and previous use. Overall we expect it to be in good condition, but if you are not entirely satisfied please get in touch with us

    Customer Reviews - The Cg Tutorial