Shaders for Game Programming and Artists.Pdf

Total Page:16

File Type:pdf, Size:1020Kb

Shaders for Game Programming and Artists.Pdf TEAM LinG - Live, Informative, Non-cost and Genuine ! TEAM LinG - Live, Informative, Non-cost and Genuine ! This page intentionally left blank TEAM LinG - Live, Informative, Non-cost and Genuine ! TEAM LinG - Live, Informative, Non-cost and Genuine ! © 2004 by Thomson Course Technology PTR. All rights reserved. No part of this SVP, Thomson Course book may be reproduced or transmitted in any form or by any means, electronic Technology PTR: or mechanical, including photocopying, recording, or by any information stor- Andy Shafran age or retrieval system without written permission from Thomson Course Tech- Publisher: nology PTR, except for the inclusion of brief quotations in a review. Stacy L. Hiquet The Premier Press and Thomson Course Technology PTR logo and related Senior Marketing Manager: trade dress are trademarks of Thomson Course Technology PTR and may not Sarah O’Donnell be used without written permission. Marketing Manager: NVIDIA® is a registered trademark of NVIDIA Corporation. Heather Hurley RenderMonkey™ is a trademark of ATI Technologies, Inc. Manager of Editorial Services: DirectX® is a registered trademark of Microsoft Corporation. Heather Talbot All other trademarks are the property of their respective owners. Acquisitions Editor: Mitzi Foster Important: Thomson Course Technology PTR cannot provide software sup- port. Please contact the appropriate software manufacturer’s technical support Senior Editor: line or Web site for assistance. Mark Garvey Thomson Course Technology PTR and the author have attempted throughout Associate Marketing Managers: this book to distinguish proprietary trademarks from descriptive terms by fol- Kristin Eisenzopf and lowing the capitalization style used by the manufacturer. Sarah Dubois Information contained in this book has been obtained by Thomson Course Project Editor: Technology PTR from sources believed to be reliable. However, because of the Sandy Doell possibility of human or mechanical error by our sources, Thomson Course Technical Reviewer: Technology PTR, or others, the Publisher does not guarantee the accuracy, ade- Mathieu Mazerolle quacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from use of such information. Readers Thomson Course Technology should be particularly aware of the fact that the Internet is an ever-changing PTR Market Coordinator: entity. Some facts may have changed since this book went to press. Amanda Weaver Educational facilities, companies, and organizations interested in multiple Interior Layout Tech: copies or licensing of this book should contact the publisher for quantity dis- Marian Hartsough count information. Training manuals, CD-ROMs, and portions of this book are also available individually or can be tailored for specific needs. Cover Designer: Mike Tanamachi ISBN: 1-59200-092-4 Library of Congress Catalog Card Number: 2004105651 CD-ROM Producer: Printed in the United States of America Brandon Penticuff 04 05 06 07 08 BH 10 9 8 7 6 5 4 3 2 1 Indexer: Kelly Talbot Proofreader: Sean Medlock Thomson Course Technology PTR, a division of Thomson Course Technology 25 Thomson Place Boston, MA 02210 http://www.courseptr.com TEAM LinG - Live, Informative, Non-cost and Genuine ! To my wife, Nicole, for all her love and support while I wrote this book. TEAM LinG - Live, Informative, Non-cost and Genuine ! Acknowledgments irst and foremost, I want to thank my wife Nicole for all of her support through- out this project. Writing a book can be a major undertaking, and without her help Fand love, I would never have completed this one or might have lost my sanity doing so. I love you! I also want to extend a big thanks to the Thomson Course Technology PTR team, first for giving me the opportunity to write this book, but also for all your help and support in making it come true. Mathieu Mazerolle also deserves special mention for his efforts as a longtime friend and technical editor. His help proved invaluable in making sure I was in line and ensuring this book was the best possible book it could be. I also want to send my thanks to the kind peo- ple at NVIDIA and ATI Technologies for their technical information, which helped immensely with this production. Finally, I want to thank everyone who has taught me in some way, including the awesome teachers at Sherbrooke University and, more importantly, Larry Landry and Glen Eagan for offering me an internship as part of the video game industry; thus launching my career. vi TEAM LinG - Live, Informative, Non-cost and Genuine ! About the Author SEBASTIEN ST-LAURENT has been programming games professionally for several years, working on titles for the Xbox, PlayStation 2, GameCube, and PC. He started in the video game industry while studying computer engineering at Sherbrooke University in Sher- brooke, Quebec. By interning in a small company called Future Endeavors during his col- lege years, he got into the industry and stood out in the line of graphics engineering. After graduating from college, he moved to California to work full time with Z-Axis as lead Xbox engineer, where he worked on several titles including the Dave Mirra Freestyle BMX series. He is a graphics engineer in the ACES group at Microsoft, Inc, where he is currently working on the next incarnation of Microsoft’s Flight Simulator product. About the Series Editor ANDRÉ LAMOTHE, CEO, Xtreme Games LLC, has been involved in the computing industry for more than 25 years. He wrote his first game for the TRS-80 and has been hooked ever since! His experience includes 2D/3D graphics, AI research at NASA, com- piler design, robotics, virtual reality, and telecommunications. His books are top sellers in the game programming genre, and his experience is echoed in the Thomson Course Technology PTR Game Development series. vii TEAM LinG - Live, Informative, Non-cost and Genuine ! Letter from the Series Editor You may have noticed that the Thomson Course Technology PTR Game Develop- ment series has not published a book on shaders until this one. This is no mistake. We were waiting for a number of things to occur: first and foremost, for the tech- nology to mature. If you recall the initial release of DirectX, you know that the soft- ware was revised almost on a quarterly basis, and worse yet, everything you learned was nearly useless until DirectX 5.0 stabilized a number of the systems. Shader pro- gramming is a similar animal; it’s been changing very quickly; however, both NVIDIA and ATI seem to have the hardware down, and Microsoft has stepped up to take a leadership role in the development of HLSL (High Level Shader Language) to make programming shaders as effortless as possible. The second, and probably most important, reason we have held off on a book in this area is that, as the series editor, I wanted to have a book that was the quintessential guide to beginning to intermediate shader programming. Finding the right author to do that has taken a long time, but the wait was well worth it. Sebastien St-Laurent is expert at shader programming, but even more important is his ability to make the topic interesting and engaging. Moreover, the information you read in this book will not be out of date in six months; this is core material, and 90 percent of it will be applicable three to five years from now, so you are going to get an incredible return on your time investment. There are a lot of shader books on the market. I have read all of them. When Sebastien and I developed the outline and table of contents for this book, we both wanted to make sure to cover the important material that others had covered while filling the holes and gaps that other books have repeatedly left out. In the final analysis, this is one of my favorite Thomson Course Technology PTR Game Development books. Not only does the book move at a fast (although not a blinding) pace, the writing style is fun, and the author continually gives examples and suggestions of how to use the technology. In addition, because the book relies heavily on ATI’s RenderMonkey shader tool, non-programmers and artists can learn a lot as well. On a technical note, the progress of graphics technology over the last 25 years is rather cyclic. If you recall, the first 3D games were software-based with software ras- terizers: DOOM, QUAKE, and related games. Then, as 3D fixed pipeline hardware matured, games started taking advantage and became hardware-based, and the pipeline moved to the hardware with the result that a huge loss of control ensued. TEAM LinG - Live, Informative, Non-cost and Genuine ! Now, however, we can run software on a per pixel basis, and that’s a mind-blowing concept. So shaders bring us full circle; we have the speed of hardware with the flex- ibility of software. I suppose the next step will be for the hardware to be completely reconfigurable via reprogrammable logic cores embedded in the GPUs ...we will see. In conclusion, if you had to pick a single book on pixel and vertex shader program- ming, this is the complete solution. You will learn everything from the tools, the technology, and actual implementation details. And of course this is all fresh mater- ial, not regurgitated, updated material from articles or other books. Hence, without hesitation, I recommend this book if you are interested at all in shader technology. Sincerely, André LaMothe Thomson Course Technology PTR Game Development Series Editor 2004 TEAM LinG - Live, Informative, Non-cost and Genuine ! Contents at a Glance Introduction . xxi Part I From the Ground Up . 1 Chapter 1 Welcome to the World of Shaders . 3 Chapter 2 The Art of 3D.
Recommended publications
  • Subaru Invites Fans to Talk to Subaru Rally Team USA Drivers, Travis Pastrana and Dave Mirra
    Subaru Of America, Inc. Media Information One Subaru Drive Camden, NJ 08103 Main Number: 856-488-8500 Subaru Invites Fans To Talk To Subaru Rally Team USA Drivers, Travis Pastrana And Dave Mirra Cherry Hill, N.J., Jul 7, 2010 - Subaru of America, Inc. is inviting fans to participate in an hour-long interactive conference call featuring Subaru Rally Team USA drivers, Travis Pastrana and Dave Mirra, Monday, July 26 at 6 p.m. EST. On the call, fans can ask questions and hear Travis and Dave talk about their preparation and plans for X Games 16, their love of Rally and the launch of the all-new 2011 Subaru Impreza WRX and STI. “Travis and Dave love their fans and this is a unique way to connect with them on a more personal level,” said Todd Lawrence, promotions and sponsorship manager, Subaru of America, Inc. “They are looking forward to talking about what’s going on with the Subaru Rally Team and are eager to drive their Subaru Impreza WRX STI rally cars at X Games in Rally Car Racing and the all-new SuperRally event.” To join the live conference fans can sign-up at http://tinyurl.com/24sb2kp. Then on July 26 at approximately 6 p.m. fans will be called on the phone number they provided at sign up. Fans can also watch Dave and Travis compete live on ESPN during X Games Saturday, July 31, beginning at 4 p.m. EDT. About Subaru of America, Inc. Subaru of America, Inc. is a wholly owned subsidiary of Fuji Heavy Industries Ltd.
    [Show full text]
  • Programming Graphics Hardware Overview of the Tutorial: Afternoon
    Tutorial 5 ProgrammingProgramming GraphicsGraphics HardwareHardware Randy Fernando, Mark Harris, Matthias Wloka, Cyril Zeller Overview of the Tutorial: Morning 8:30 Introduction to the Hardware Graphics Pipeline Cyril Zeller 9:30 Controlling the GPU from the CPU: the 3D API Cyril Zeller 10:15 Break 10:45 Programming the GPU: High-level Shading Languages Randy Fernando 12:00 Lunch Tutorial 5: Programming Graphics Hardware Overview of the Tutorial: Afternoon 12:00 Lunch 14:00 Optimizing the Graphics Pipeline Matthias Wloka 14:45 Advanced Rendering Techniques Matthias Wloka 15:45 Break 16:15 General-Purpose Computation Using Graphics Hardware Mark Harris 17:30 End Tutorial 5: Programming Graphics Hardware Tutorial 5: Programming Graphics Hardware IntroductionIntroduction toto thethe HardwareHardware GraphicsGraphics PipelinePipeline Cyril Zeller Overview Concepts: Real-time rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 1995-1998: Texture mapping and z-buffer 1998: Multitexturing 1999-2000: Transform and lighting 2001: Programmable vertex shader 2002-2003: Programmable pixel shader 2004: Shader model 3.0 and 64-bit color support PC graphics software architecture Performance numbers Tutorial 5: Programming Graphics Hardware Real-Time Rendering Graphics hardware enables real-time rendering Real-time means display rate at more than 10 images per second 3D Scene = Image = Collection of Array of pixels 3D primitives (triangles, lines, points) Tutorial 5: Programming Graphics Hardware Hardware Graphics Pipeline
    [Show full text]
  • Improving Shadows and Reflections Via the Stencil Buffer
    Improving Shadows and Reflections via the Stencil Buffer Mark J. Kilgard * NVIDIA Corporation “Slap textures on polygons, throw them at the screen, and let the depth buffer sort it out.” For too many game developers, the above statement sums up their approach to 3D hardware- acceleration. A game programmer might turn on some fog and maybe throw in some transparency, but that’s often the limit. The question is whether that is enough anymore for a game to stand out visually from the crowd. Now everybody’s using 3D hardware-acceleration, and everybody’s slinging textured polygons around, and, frankly, as a result, most 3D games look more or less the same. Sure there are differences in game play, network interaction, artwork, sound track, etc., etc., but we all know that the “big differentiator” for computer gaming, today and tomorrow, is the look. The problem is that with everyone resorting to hardware rendering, most games look fairly consistent, too consistent. You know exactly the textured polygon look that I’m talking about. Instead of settling for 3D hardware doing nothing more than slinging textured polygons, I argue that cutting-edge game developers must embrace new hardware functionality to achieve visual effects beyond what everybody gets today from your basic textured and depth-buffered polygons. Two effects that can definitely set games apart from the crowd are better quality shadows and reflections. While some games today incorporate shadows and reflections to a limited extent, the common techniques are fairly crude. Reflections in today’s games are mostly limited to “infinite extent” ground planes or ground planes bounded by walls.
    [Show full text]
  • Game Developers Conference Europe Wrap, New Women’S Group Forms, Licensed to Steal Super Genre Break Out, and More
    >> PRODUCT REVIEWS SPEEDTREE RT 1.7 * SPACEPILOT OCTOBER 2005 THE LEADING GAME INDUSTRY MAGAZINE >>POSTMORTEM >>WALKING THE PLANK >>INNER PRODUCT ART & ARTIFICE IN DANIEL JAMES ON DEBUG? RELEASE? RESIDENT EVIL 4 CASUAL MMO GOLD LET’S DEVELOP! Thanks to our publishers for helping us create a new world of video games. GameTapTM and many of the video game industry’s leading publishers have joined together to create a new world where you can play hundreds of the greatest games right from your broadband-connected PC. It’s gaming freedom like never before. START PLAYING AT GAMETAP.COM TM & © 2005 Turner Broadcasting System, Inc. A Time Warner Company. Patent Pending. All Rights Reserved. GTP1-05-116-104_mstrA_v2.indd 1 9/7/05 10:58:02 PM []CONTENTS OCTOBER 2005 VOLUME 12, NUMBER 9 FEATURES 11 TOP 20 PUBLISHERS Who’s the top dog on the publishing block? Ranked by their revenues, the quality of the games they release, developer ratings, and other factors pertinent to serious professionals, our annual Top 20 list calls attention to the definitive movers and shakers in the publishing world. 11 By Tristan Donovan 21 INTERVIEW: A PIRATE’S LIFE What do pirates, cowboys, and massively multiplayer online games have in common? They all have Daniel James on their side. CEO of Three Rings, James’ mission has been to create an addictive MMO (or two) that has the pick-up-put- down rhythm of a casual game. In this interview, James discusses the barriers to distributing and charging for such 21 games, the beauty of the web, and the trouble with executables.
    [Show full text]
  • GAME DEVELOPERS a One-Of-A-Kind Game Concept, an Instantly Recognizable Character, a Clever Phrase— These Are All a Game Developer’S Most Valuable Assets
    HOLLYWOOD >> REVIEWS ALIAS MAYA 6 * RTZEN RT/SHADER ISSUE AUGUST 2004 THE LEADING GAME INDUSTRY MAGAZINE >>SIGGRAPH 2004 >>DEVELOPER DEFENSE >>FAST RADIOSITY SNEAK PEEK: LEGAL TOOLS TO SPEEDING UP LIGHTMAPS DISCREET 3DS MAX 7 PROTECT YOUR I.P. WITH PIXEL SHADERS POSTMORTEM: THE CINEMATIC EFFECT OF ZOMBIE STUDIOS’ SHADOW OPS: RED MERCURY []CONTENTS AUGUST 2004 VOLUME 11, NUMBER 7 FEATURES 14 COPYRIGHT: THE BIG GUN FOR GAME DEVELOPERS A one-of-a-kind game concept, an instantly recognizable character, a clever phrase— these are all a game developer’s most valuable assets. To protect such intangible properties from pirates, you’ll need to bring out the big gun—copyright. Here’s some free advice from a lawyer. By S. Gregory Boyd 20 FAST RADIOSITY: USING PIXEL SHADERS 14 With the latest advances in hardware, GPU, 34 and graphics technology, it’s time to take another look at lightmapping, the divine art of illuminating a digital environment. By Brian Ramage 20 POSTMORTEM 30 FROM BUNGIE TO WIDELOAD, SEROPIAN’S BEAT GOES ON 34 THE CINEMATIC EFFECT OF ZOMBIE STUDIOS’ A decade ago, Alexander Seropian founded a SHADOW OPS: RED MERCURY one-man company called Bungie, the studio that would eventually give us MYTH, ONI, and How do you give a player that vicarious presence in an imaginary HALO. Now, after his departure from Bungie, environment—that “you-are-there” feeling that a good movie often gives? he’s trying to repeat history by starting a new Zombie’s answer was to adopt many of the standard movie production studio: Wideload Games.
    [Show full text]
  • Steve Marschner CS5625 Spring 2019 Predicting Reflectance Functions from Complex Surfaces
    08 Detail mapping Steve Marschner CS5625 Spring 2019 Predicting Reflectance Functions from Complex Surfaces Stephen H. Westin James R. Arvo Kenneth E. Torrance Program of Computer Graphics Cornell University Ithaca, New York 14853 Hierarchy of scales Abstract 1000 macroscopic Geometry We describe a physically-based Monte Carlo technique for ap- proximating bidirectional reflectance distribution functions Object scale (BRDFs) for a large class of geometriesmesoscopic by directly simulating 100 optical scattering. The technique is more general than pre- vious analytical models: it removesmicroscopic most restrictions on sur- Texture, face microgeometry. Three main points are described: a new bump maps 10 representation of the BRDF, a Monte Carlo technique to esti- mate the coefficients of the representation, and the means of creating a milliscale BRDF from microscale scattering events. Milliscale These allow the prediction of scattering from essentially ar- (Mesoscale) 1 mm Texels bitrary roughness geometries. The BRDF is concisely repre- sented by a matrix of spherical harmonic coefficients; the ma- 0.1 trix is directly estimated from a geometric optics simulation, BRDF enforcing exact reciprocity. The method applies to rough- ness scales that are large with respect to the wavelength of Microscale light and small with respect to the spatial density at which 0.01 the BRDF is sampled across the surface; examples include brushed metal and textiles. The method is validated by com- paring with an existing scattering model and sample images are generated with a physically-based global illumination al- Figure 1: Applicability of Techniques gorithm. CR Categories and Subject Descriptors: I.3.7 [Computer model many surfaces, such as those with anisotropic rough- Graphics]: Three-Dimensional Graphics and Realism.
    [Show full text]
  • Subaru Rally Team Usa Drivers David Higgins and Dave Mirra to Compete at Summer X Games 17
    Subaru Of America, Inc. Media Information One Subaru Drive Camden, NJ 08103 Main Number: 856-488-8500 CONTACT: Dominick Infante (856) 488-8615 [email protected] SUBARU RALLY TEAM USA DRIVERS DAVID HIGGINS AND DAVE MIRRA TO COMPETE AT SUMMER X GAMES 17 Cherry Hill, N.J., Jul 28, 2011 - Subaru of America, Inc. Subaru Rally Team USA drivers David Higgins and Dave Mirra head to Los Angeles this week to compete in Summer X Games 17. Higgins and Mirra look to add to the team’s successes at X Games competing in the Rally Car and Rallycross events July 30th and 31st respectively. Each will drive a 2011 Subaru Impreza WRX STI modified for Rallycross with an excess of 550 horsepower Boxer engine and Symmetrical All Wheel Drive. For 2011, Higgins won the Rally America Championship after three overall wins and two second place finishes of the six events of the series. In June, he smashed the 13-year course record at the Mt. Washington Hill Climb and placed second at the A Main final of the Global Rallycross series at Pikes Peak. David is competing in his first X Games. “I have heard so much about the X Games and have watched from home many times so I’m really looking forward to being a part of it,” said Higgins. “There really is nothing like it in the world and to be racing on the streets of Los Angeles should be spectacular for the drivers and the fans.” David Higgins, a native of the Isle of Man, got his first taste of motorsport when he was only eight years old and has enjoyed success ever since.
    [Show full text]
  • Directx 11 Extended to the Implementation of Compute Shader
    DirectX 1 DirectX About the Tutorial Microsoft DirectX is considered as a collection of application programming interfaces (APIs) for managing tasks related to multimedia, especially with respect to game programming and video which are designed on Microsoft platforms. Direct3D which is a renowned product of DirectX is also used by other software applications for visualization and graphics tasks such as CAD/CAM engineering. Audience This tutorial has been prepared for developers and programmers in multimedia industry who are interested to pursue their career in DirectX. Prerequisites Before proceeding with this tutorial, it is expected that reader should have knowledge of multimedia, graphics and game programming basics. This includes mathematical foundations as well. Copyright & Disclaimer Copyright 2019 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected]
    [Show full text]
  • Rally America
    Rally America http://www.rally-america.com/news/497/ Travis Pastrana wins New England Forest Rally Saturday, July 18, 2009 Subaru Rally Team USA's Travis Pastrana and co-driver Christian Edstrom sailed to their fourth win of the your email... season at the New England Forest Rally Saturday, to further extend their lead in the national championship. Pastrana entered Round 6 of the Rally America championship with a 21-point lead over his closest challenger, and said his strategy from the start was to avoid taking unnecessary risks and get his car to the finish in one piece. "It's hard to know you've got that little more speed in reserve and not use it, but it's that little more that can get you," he said. "We weren't the fastest here this weekend, but I'll take the win however I can get it." Ken Block and co-driver Alex Gelsomino set a blazing pace at the start, but lost more than 20 seconds to a spin early Saturday afternoon, then had a flat tire. They were unable to make up for lost time in the final stages of the day and finished in second-place overall. "It's extremely frustrating," said Block at the finish. "I put myself in the right position to win and it didn't work out for us." Even so, the result moves Block into second place in the championship, behind teammate Pastrana. Canadians Antoine L'Estage and co-driver Nathalie Richard were also in the running for a win early in this event, but they lost time to a power steering failure in their Mitsubishi Lancer Evolution X Saturday afternoon and finished in third.
    [Show full text]
  • X GAMES FACTS & FEATS 1995 the Inaugural Extreme Games Took
    X GAMES FACTS & FEATS 1995 The inaugural Extreme Games took place in June in Providence, R.I. with the following competitions: Bungee Jumping Eco Challenge In-Line Skating Skateboard Sky Surfing Sport Climbing Street Luge Biking Watersports 1997 Extreme Games changed its name to X Games and moved to the west coast for the first time – hosted by San Diego, Calif. 1999 The X Games moved north to San Francisco, Calif. After attempting the trick for 10 years, Tony Hawk landed the first-ever 900 in Skateboard Best Trick. Moto X made its debut in 1999 and phenom Travis Pastrana was awarded a near-perfect score of 99.0 in Moto X Freestyle. 2000 Moto X Step Up made its first appearance. Dave Mirra became the first BMX athlete to land a double backflip at the X Games. 2001 X Games Seven headed back east to Philadelphia, Penn., where the event hit a major milestone – a first-time indoor venue at the First Union Center. This was the first time X Games took place inside and outside an arena. Moto X Best Trick made its debut. 2002 Mike Metzger made X Games and Moto X history with his back-to-back backflips. Mat Hoffman landed the first no-handed 900 in Vert. 2003 X Games made its third move, this time back to California and landed in Los Angeles with an unprecedented contract lasting through 2009. Becoming the youngest ever X Games gold medalist, Ryan Sheckler landed all of his tricks and won Skateboard Park at just 13 years old.
    [Show full text]
  • Procedural Modeling
    Procedural Modeling From Last Time • Many “Mapping” techniques – Bump Mapping – Normal Mapping – Displacement Mapping – Parallax Mapping – Environment Mapping – Parallax Occlusion – Light Mapping Mapping Bump Mapping • Use textures to alter the surface normal – Does not change the actual shape of the surface – Just shaded as if it were a different shape Sphere w/Diffuse Texture Swirly Bump Map Sphere w/Diffuse Texture & Bump Map Bump Mapping • Treat a greyscale texture as a single-valued height function • Compute the normal from the partial derivatives in the texture Another Bump Map Example Bump Map Cylinder w/Diffuse Texture Map Cylinder w/Texture Map & Bump Map Normal Mapping • Variation on Bump Mapping: Use an RGB texture to directly encode the normal http://en.wikipedia.org/wiki/File:Normal_map_example.png What's Missing? • There are no bumps on the silhouette of a bump-mapped or normal-mapped object • Bump/Normal maps don’t allow self-occlusion or self-shadowing From Last Time • Many “Mapping” techniques – Bump Mapping – Normal Mapping – Displacement Mapping – Parallax Mapping – Environment Mapping – Parallax Occlusion – Light Mapping Mapping Displacement Mapping • Use the texture map to actually move the surface point • The geometry must be displaced before visibility is determined Displacement Mapping Image from: Geometry Caching for Ray-Tracing Displacement Maps EGRW 1996 Matt Pharr and Pat Hanrahan note the detailed shadows cast by the stones Displacement Mapping Ken Musgrave a.k.a. Offset Mapping or Parallax Mapping Virtual Displacement Mapping • Displace the texture coordinates for each pixel based on view angle and value of the height map at that point • At steeper view-angles, texture coordinates are displaced more, giving illusion of depth due to parallax effects “Detailed shape representation with parallax mapping”, Kaneko et al.
    [Show full text]
  • Per-Pixel Displacement Mapping with Distance Functions
    108_gems2_ch08_new.qxp 2/2/2005 2:20 PM Page 123 Chapter 8 Per-Pixel Displacement Mapping with Distance Functions William Donnelly University of Waterloo In this chapter, we present distance mapping, a technique for adding small-scale dis- placement mapping to objects in a pixel shader. We treat displacement mapping as a ray-tracing problem, beginning with texture coordinates on the base surface and calcu- lating texture coordinates where the viewing ray intersects the displaced surface. For this purpose, we precompute a three-dimensional distance map, which gives a measure of the distance between points in space and the displaced surface. This distance map gives us all the information necessary to quickly intersect a ray with the surface. Our algorithm significantly increases the perceived geometric complexity of a scene while maintaining real-time performance. 8.1 Introduction Cook (1984) introduced displacement mapping as a method for adding small-scale detail to surfaces. Unlike bump mapping, which affects only the shading of surfaces, displacement mapping adjusts the positions of surface elements. This leads to effects not possible with bump mapping, such as surface features that occlude each other and nonpolygonal silhouettes. Figure 8-1 shows a rendering of a stone surface in which occlusion between features contributes to the illusion of depth. The usual implementation of displacement mapping iteratively tessellates a base sur- face, pushing vertices out along the normal of the base surface, and continuing until 8.1 Introduction 123 Copyright 2005 by NVIDIA Corporation 108_gems2_ch08_new.qxp 2/2/2005 2:20 PM Page 124 Figure 8-1. A Displaced Stone Surface Displacement mapping (top) gives an illusion of depth not possible with bump mapping alone (bottom).
    [Show full text]