1. Trang chủ
  2. » Giáo Dục - Đào Tạo

shaders for game programming and artists

513 452 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 513
Dung lượng 9,68 MB

Nội dung

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 book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information stor- age or retrieval system without written permission from Thomson Course Tech- nology PTR, except for the inclusion of brief quotations in a review. The Premier Press and Thomson Course Technology PTR logo and related trade dress are trademarks of Thomson Course Technology PTR and may not be used without written permission. NVIDIA® is a registered trademark of NVIDIA Corporation. RenderMonkey™ is a trademark of ATI Technologies, Inc. DirectX® is a registered trademark of Microsoft Corporation. All other trademarks are the property of their respective owners. Important: Thomson Course Technology PTR cannot provide software sup- port. Please contact the appropriate software manufacturer’s technical support line or Web site for assistance. Thomson Course Technology PTR and the author have attempted throughout this book to distinguish proprietary trademarks from descriptive terms by fol- lowing the capitalization style used by the manufacturer. Information contained in this book has been obtained by Thomson Course Technology PTR from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, Thomson Course Technology PTR, or others, the Publisher does not guarantee the accuracy, ade- 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 should be particularly aware of the fact that the Internet is an ever-changing entity. Some facts may have changed since this book went to press. Educational facilities, companies, and organizations interested in multiple copies or licensing of this book should contact the publisher for quantity dis- count information. Training manuals, CD-ROMs, and portions of this book are also available individually or can be tailored for specific needs. ISBN: 1-59200-092-4 Library of Congress Catalog Card Number: 2004105651 Printed in the United States of America 04 05 06 07 08 BH 10 9 8 7 6 5 4 3 2 1 Thomson Course Technology PTR, a division of Thomson Course Technology 25 Thomson Place Boston, MA 02210 http://www.courseptr.com SVP, Thomson Course Technology PTR: Andy Shafran Publisher: Stacy L. Hiquet Senior Marketing Manager: Sarah O’Donnell Marketing Manager: Heather Hurley Manager of Editorial Services: Heather Talbot Acquisitions Editor: Mitzi Foster Senior Editor: Mark Garvey Associate Marketing Managers: Kristin Eisenzopf and Sarah Dubois Project Editor: Sandy Doell Technical Reviewer: Mathieu Mazerolle Thomson Course Technology PTR Market Coordinator: Amanda Weaver Interior Layout Tech: Marian Hartsough Cover Designer: Mike Tanamachi CD-ROM Producer: Brandon Penticuff Indexer: Kelly Talbot Proofreader: Sean Medlock 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 ! F 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 and 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 Acknowledgments TEAM LinG - Live, Informative, Non-cost and Genuine ! 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É LAM OTHE , 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 About the Author 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 ! [...]... artists Finally, with the approach taken throughout this book and the extensive exercises at the end of each chapter, Shaders for Game Programmers and Artists can also be a valuable asset in the classroom where real-time graphics have taken an even more important place in the computer science curriculum What Will Be Covered (And What Won’t) The topic of Shaders for Game Programmers and Artists is shaders, ... 37 Chapter 4 Getting Started, Your First Shaders 51 TEAM LinG - Live, Informative, Non-cost and Genuine ! W elcome to Shaders for Game Programmers and Artists The title of the book is very much self-explanatory; we will explore shader development together throughout this book You will learn how vertex and pixel shaders work and how information flows from the initial piece of... specific API and allows for easy development and prototyping And no additional coding TEAM LinG - Live, Informative, Non-cost and Genuine ! Prerequisites beyond the shader program itself is needed This has the added advantage of making this book a great learning tool for both students and technically minded artists! You can now learn shaders without having to acquire the more general programming and 3D API... 467 TEAM LinG - Live, Informative, Non-cost and Genuine ! Introduction D uring the summer of 2003, I was approached by André LaMothe to write a book on the topic of shaders My experience on the PC and Xbox and writing game engines and shader architectures made me a great candidate for such an endeavor Having always wanted to write a technical book, I simply could not resist and jumped into this great... Sine/Cosine, Absolute, and Power ■ Support for flow control instruction such as loops and conditionals The following list outlines pixel shader 2.0 and 2.x improvements: ■ ■ Support for extended 32-bit precision floating-point calculations Support for arbitrary swizzling and masking of register components TEAM LinG - Live, Informative, Non-cost and Genuine ! Vertex and Pixel Shader Pipelines and Capabilities... 1.1 Functional diagram for the vertex shader hardware architecture TEAM LinG - Live, Informative, Non-cost and Genuine ! Vertex and Pixel Shader Pipelines and Capabilities all the information needed to properly process the geometry for rendering, such as positions, colors, and texture coordinates As the information comes in, it is put into the proper input registers, v0 to v15, for use by the vertex... Radon 9800 or GeForce FX class card Since I use vertex and pixel shaders extensively throughout the book, hardware with support for these shader models is strongly recommended You may still use lesser hardware, but you will need to use software emulation, which will significantly lessen performance And of course, the latest drivers for your video card TEAM LinG - Live, Informative, Non-cost and Genuine... graphics hardware and 3D APIs made giant leaps forward in functionality and performance, even shattering Moore’s law with respect to technological advancement rate With the introduction of the DirectX 9.0 SDK and the latest generations of graphics hardware, such as the GeForce FX series from NVIDIA and Radeon 9800 series from ATI Technologies, came vertex and pixel shader version 2.0 and 2.x note The... available constant and temporary registers Significant increase in the minimum instruction card allowed by the standard, from 8 to 64 arithmetic and 32 texture instructions Pixel shader 2.x allows even more instructions by default and allows the hardware to go beyond the standard’s minimum requirements Support for integer and Boolean constants, loop counters, and predicate registers Support for dynamic flow... presented in a straightforward manner aimed at allowing you to quickly absorb and apply the knowledge you gain from this book Who Should Read This Book The topic of Shaders for Game Programmers and Artists is shader development; therefore, the book is written for anybody who has some interest in the topic Because the topics and techniques covered throughout this book are so varied, it is bound to be . Non-cost and Genuine ! 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. Live, Informative, Non-cost and Genuine ! F 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. 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 Acknowledgments TEAM LinG - Live, Informative,

Ngày đăng: 03/06/2014, 02:05

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN