Advanced Graphics Programming Using C/C++

Similar documents
INTRODUCTION TO RENDERING TECHNIQUES

Introduction to Computer Graphics

Digital 3D Animation

LIST OF CONTENTS CHAPTER CONTENT PAGE DECLARATION DEDICATION ACKNOWLEDGEMENTS ABSTRACT ABSTRAK

Cork Education and Training Board. Programme Module for. 3 Dimensional Computer Graphics. Leading to. Level 5 FETAC

So, you want to make a photo-realistic rendering of the Earth from orbit, eh? And you want it to look just like what astronauts see from the shuttle

Computer Animation: Art, Science and Criticism

ACE: After Effects CC

A Short Introduction to Computer Graphics

Specular reflection. Dielectrics and Distribution in Ray Tracing. Snell s Law. Ray tracing dielectrics

BCC Multi Stripe Wipe

Thea Omni Light. Thea Spot Light. Light setup & Optimization

ABS 731 Lighting Design & Technology. Spring 2006

PRODUCT LIFECYCLE MANAGEMENT COMPETENCY CENTRE RENDERING. PLMCC, JSS Academy of Technical Education, Noida Rendering 1 of 16

Schneps, Leila; Colmez, Coralie. Math on Trial : How Numbers Get Used and Abused in the Courtroom. New York, NY, USA: Basic Books, p i.

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Making natural looking Volumetric Clouds In Blender 2.48a

Adding Animation With Cinema 4D XL

Programming 3D Applications with HTML5 and WebGL

Graphic Design. Background: The part of an artwork that appears to be farthest from the viewer, or in the distance of the scene.

Volumes of Revolution

Photorealistic Rendering Techniques in AutoCAD 3D

Visualization and Feature Extraction, FLOW Spring School 2016 Prof. Dr. Tino Weinkauf. Flow Visualization. Image-Based Methods (integration-based)

Motion tween is nothing but tweening a Symbol's movement from one position to another.

SAN DIEGO COMMUNITY COLLEGE DISTRICT MESA COLLEGE ASSOCIATE DEGREE COURSE OUTLINE

Complete List of Features

ACE: After Effects CS6

VIRGINIA WESTERN COMMUNITY COLLEGE

Tutorial 13: Object Animation

3D Animation Graphic Designer

Anime Studio Debut vs. Pro

Photo Studio. Site Map Preface What`s New? Getting Started Basic Tasks Advanced Tasks Workbench Description Customizing Glossary Index

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

ESSENTIAL CURRICULUM GUIDLINE FOR ANIMATION I INTRODUCTION

DIGITAL IMAGE PROCESSING AND ANALYSIS

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

Drawing Basic Shapes:

GAME ENGINE DESIGN. A Practical Approach to Real-Time Computer Graphics. ahhb. DAVID H. EBERLY Geometrie Tools, Inc.

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

IT 386: 3D Modeling and Animation. Review Sheet. Notes from Professor Nersesian s IT 386: 3D Modeling and Animation course

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

R Graphics Cookbook. Chang O'REILLY. Winston. Tokyo. Beijing Cambridge. Farnham Koln Sebastopol

Deferred Shading & Screen Space Effects

BIRT: A Field Guide to Reporting

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Flash MX 2004 Animation Lesson

Adobe Certified Expert Program

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

MISSION VALLEY REGIONAL OCCUPATION PROGRAM COMPUTER GRAPHICS DESIGN COURSE OUTINE

Animation. Persistence of vision: Visual closure:

Klaus Goelker. GIMP 2.8 for Photographers. Image Editing with Open Source Software. rocky

The Essential Guide to User Interface Design An Introduction to GUI Design Principles and Techniques

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

Autodesk Revit Architecture 2011 Professional Massmodeling Rendering Video Tutorial

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Media Graphic Arts. September 2014

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions.

Chapter 9- Animation Basics

Using HDR Panoramas. Dr Ryan Southall - School of Architecture & Design, University of Brighton.

Graphic Design I GT Essential Goals and Objectives

MovieClip, Button, Graphic, Motion Tween, Classic Motion Tween, Shape Tween, Motion Guide, Masking, Bone Tool, 3D Tool

MODELING AND ANIMATION

Welcome to CorelDRAW, a comprehensive vector-based drawing and graphic-design program for the graphics professional.

PATH TRACING: A NON-BIASED SOLUTION TO THE RENDERING EQUATION

Introduction to Computer Graphics. Reading: Angel ch.1 or Hill Ch1.

CS 371 Project 5: Midterm Meta-Specification

TRISH & CHRIS MEYER AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO

About the Render Gallery

Basic Shapes. Most paintings can be broken down into basic shapes. See how this famous painting by Cézanne can be broken down into basic shapes.

Step 2: Paint Your Model

Rendering Area Sources D.A. Forsyth

Collection from My Original Avid Forum Series Basic. Collection from My Original Avid Forum Series Avid

The Rocket Steam Locomotive - Animation

Color and Light. DELTA SCIENCE READER Overview Before Reading Guide the Reading After Reading

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

A Proposal for OpenEXR Color Management

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Advanced Computer Graphics. Rendering Equation. Matthias Teschner. Computer Science Department University of Freiburg

LAMBDA CONSULTING GROUP Legendary Academy of Management & Business Development Advisories

Adobe Marketing Cloud Sharpening images in Scene7 Publishing System and on Image Server

My Materials. In this tutorial, we ll examine the material settings for some simple common materials used in modeling.

PROGRAM CONCENTRATION: Business & Computer Science. COURSE TITLE: Introduction to Animation and 3d Design

Path Tracing Overview

Wiley Publishing, Inc.

Maya 2014 Still Life Part 1 Texturing & Lighting

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

3D Analysis and Surface Modeling

Self-Positioning Handheld 3D Scanner

Real Time Rendering. Preface What's New Getting Started Basic Tasks Advanced Tasks Workbench Description Index

Sweet Home 3D user's guide

PowerPoint: Graphics and SmartArt

A Ray Tracing Solution for Diffuse Interreflection

Glencoe. correlated to SOUTH CAROLINA MATH CURRICULUM STANDARDS GRADE 6 3-3, , , 4-9

Computing Concepts with Java Essentials

Art Tuts Learn how to draw, animate, etc. Inkscape tutorials How to draw a candle. Candle

Jan Köhnlein and Helmut Weberpals

Document Management for Hypermedia Design

Transcription:

CORIOLIS GROUP BOOK Advanced Graphics Programming Using C/C++ Loren Heiny John Wiley & Sons, Inc. New York Chichester Brisbane Toronto Singapore

Contents Preface Who This Book Is For A Glance Inside What You'II Need About the Code Chapter 1 Introduction to Ray Tracing Capturing Images with Ray Tracing Tracing Light Rays Using a Camera Model From Rays to Images Representing a Scene A Simple Ray Tracing Program The Major Data Structures Specifying Colors Specifying Light Sources Specifying Objects Specifying Vectors and Points Describing the World Overview of SIMPLRAY The Main Function Generating Rays Getting Oriented Calculating a Ray Determining What a Ray Hits Working with Planes Representing a Ray Intersecting a Ray and a Plane Representing a Sphere Finding the Closest Object Calculating the Normal Chapter 2 Adding a Lighting Model A Good Lighting Model Ambient Intensity Diffuse Light Specular Light xiii xiii xiv xiv XV 1 1 2 2 5 5 5 6 6 6 7 8 9 9 10 10 11 12 16 16 17 18 20 22 23 25 25 26 26 28

vi Contents Adding the Light Components Multiple Light Sources Back to Tracing Rays Applying the Lighting Model Calculating the Ambient Color Calculating the Diffuse Color Scaling the Light Adding the Specular Component Calculating the Reflecting Ray Handling Shadows Tracing the Ray Setting the Pixel Compiling SIMPLRAY for DOS Compiling for Windows Choosing a Video Mode Setting the Video Mode DOS Versus Windows Applications Modifying SIMPLRAY Computing Power and Ray Tracing Chapter 3 An Enhanced Ray Tracer Using C++ Effectively Overview of the RAY Program The New Objects Deriving Rectangles Triangle Objects Supporting Spheres Ellipsoids Cylinder Objects Managing Objects An Enhanced Lighting Model New Light Sources Point Light Sources Directed Light Sources Cone Light Sources Scaling Light Managing 9 Light Sources Translucent Objects Antialiasing Bounding Boxes 29 30 30 32 32 32 34 34 36 36 38 40 40 41 42 43 43 44 45 55 55 56 57 59 63 67 68 69 72 73 73 74 75 76 77 78 80 80 81 83

Contents vii Building a Hierarchy of Objects 85 Supporting Bounding Boxes 86 Chapter 4 Creating a World 133 The Scene Description Language 133 The Parser 136 Reading Tokens 136 Parsing a File 137 Processing Parameters 138 Handling Nested Commands 138 Creating an Object 139 Grouping Objects 139 Handling Parser Errors 140 Using the Scene Description Language 140 Setting the Display Parameters 140 Setting the Viewing Parameters 141 Specifying Lights 142 Specifying Objects 142 Nesting Files 143 Saving an Image 143 Compiling and Using RAY 144 Sample Scenes 145 Things Are Shaping Up 145 Generating Swept Surfaces 146 Chapter 5 Textures and Patterns 173 Rendering a Pattern 173 Setting the Texture 174 Mapping onto Three-Dimensional Objects 175 Rendering a Checker Pattern 176 Mapping the Checker Pattern 177 Rendering Non-Checker Patterns 177 Mapping to Planar Objects 178 Mapping to a Rectangle 178 Mapping to a Sphere and Ellipse 180 Mapping to a Cylinder 181 Defining a Checker Pattern 182 Mapping Images 183 Managing Images 184 From Point to Pixel 185 Defining an Image Map 186

viii Contents Blended Colors A Textured Scene Constructing the Room Constructing the Cabinets Making the Soup Can Making a Pot Using Bounding Boxes Nothing's Perfect Chapter 6 Adding Animation Animation Overview Supporting Animation The Animating Structure Animating Objects Going the Next Step The Animation Language Specifying the Number of Frames Specifying a Motion Path Moving the Viewer Saving the Image Sequence Playing Back an Image Sequence An Animation Example Chapter 7 Rendering Water and Clouds Designing a Model of Water The Essence of Water Animating Waves Using Normals to Make Waves A Water Object Creating Waves Adding Water to a Scene Sample Water Scene A Watery Glass Extending the Water Model Rendering Clouds A Two-Dimensional Sky Implementing A Sky Plane Calculating the Texture Defining Two-Dimensional Clouds Cloudy Marble 187 189 189 190 192 192 193 193 199 199 200 201 202 204 204 205 205 205 206 207 207 215 215 216 217 218 218 219 221 221 222 224 224 225 226 227 227 228

Contents A ix Three-Dimensional Clouds Creating Three-Dimensional Clouds The Three-Dimensional Cloud Function Defining Clouds Sample Clouds Tips on Constructing Clouds Chapter 8 Rendering Fractal Mountains Rendering Natural Objects How Fractals Work Using Triangles Generating Mountains Reading the Initial Triangles Setting the Fractal Parameters Subdividing Triangles Writing the Triangles Setting the Color Generating a Random Number Using Bounding Boxes Compiling and Running GENMTN Designing Your Mountains Making More Interesting Images Chapter 9 A PCX Toolkit Overview of PCX Files The PCX File Format The PCX File Header Run-Length Encoding Decoding a PCX File The PCX Toolkit Processing the Header Initializing a Header Writing the Header Writing an Image Processing the Palette Reading a PCX File Reading a Header Reading the Image A Sample Read Function Testing PCXTOOL.C 229 229 231 233 233 236 237 237 238 238 239 240 241 242 243 244 245 246 247 249 250 271 271 272 272 274 275 275 276 277 278 278 279 279 280 280 281 282

x Contents Chapter 10 TIFF: A Flexible Image File Format TIFF Overview Working with Classes The Pieces of a TIFF File Working with Tags The Image Format The TIFF.C Toolkit Reading a TIFF File Processing the Tags Determining an Image's Size Reading the Image A High-Level Read Function Writing a TIFF File Writing the Image Data Testing the TIFF Tools Compiling and Running TESTTIFF Chapter 11 Image Processing Essentials Working with Images An Image Processing Toolkit Using Histograms Contrast Enhancement Brightness Adjustment Reducing Noise Sharpening an Image Zooming and Resizing Images Mirroring and Rotating Images Converting a Color Image to Grayscale Colorizing an Image Gamma Correction Testing IMTOOLS.C Chapter 12 Morphing Magic How Morphing Works Warping Images Mapping Images Creating a Simple Morphing Program Controlling the MORPH Program Initializing the Morphing Process Generating Images Moving the Triangle Patches 293 293 294 294 296 299 299 300 302 303 303 304 305 306 306 308 331 331 332 333 334 335 336 336 338 339 340 340 341 342 355 355 355 356 357 357 358 359 359

Contents xi Morphing the Images 360 Determining a Point in a Triangle 361 Generating the Output Color 362 Compiling MORPH 363 Using MORPH 363 Morphing Tips 365 Appendix A Vector Operations 377 Working with Vectors 377 Vector Operations 379 Appendix В A Graphics Toolkit 385 Setting the Mode 385 Setting a Pixel 386 Working with Colors 387 Supporting С and C++ Compilers 388 Appendix С Working with Windows 395 Overview of WINSHELL 395 Using WINSHELL 396 Preparing for Windows 396 Displaying an Image 396 Working with Colors 397 Compiling for Windows 397 Index 401