Mastering Unity Shaders and Effects
Copyright 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2016
Production reference: 1210916
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78355-367-9
www.packtpub.com
Credits
Author Jamie Dean | Copy Editor Vibha Shukla |
Reviewer Kenneth Lammers | Project Coordinator Shweta H Birwatkar |
Commissioning Editor Akram Hussain | Proofreader Safis Editing |
Acquisition Editor Aaron Lazar | Indexer Mariammal Chettiyar |
Content Development Editor Deepti Thore | Production Coordinator Arvindkumar Gupta |
Technical Editor Manthan Raja |
About the Author
Jamie Dean is a game artist, instructor, and freelancer, with over seven years of teaching experience in higher education. He is currently focused on developing content for mobile games.
Jamie also wrote Unity Character Animation with Mecanim , Packt Publishing, in 2015 .
I would like to thank my family, Carey, Silas, and Rowan, for their love and encouragement, and all the people at Packt Publishing who helped get this project off the ground and keep the momentum. Thanks to Keith, Chip, and rest of my colleagues at Concrete Software Inc. Thanks for the great opportunities!
About the Reviewer
Kenny Lammers has worked over 16 years in the gaming industry as a character artist, technical artist, technical art director, and programmer. Throughout his career, he has worked on titles such as Call of Duty 3, Crackdown 2, Alan Wake, and Kinect Star Wars. He currently owns and operates Ozone Interactive, along with his business partner Noah Kaarbo. Together, they have worked with clients such as Amazon, E-line Media, IGT, Microsoft, and BioLucid.
Kenny has worked for Microsoft Games Studios, Activision, and Surreal, and has recently gone out on his own, operating CreativeTD and co-operating Ozone Interactive.
Kenny authored Unity Shaders and Effects Cookbook , Packt Publishing , and was very happy to be a part of the writing and updating of Unity 5.x Shaders and Effects Cookbook , Packt Publishing .
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.packtpub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
Unity offers a range of tools to get your game project up and running. In version 5, the shaders got a significant upgrade, mostly being replaced with a set of Standard Shaders that can be easily set up to emulate the physical characteristics of real surfaces.
In this book, we will be exploring the options made possible with this new set of shaders and how they interact with lighting and effects in the game scene to produce high quality results.
It has been a long journey towards this level of realism in games. For a long time, the processing overhead of real-time lighting made it problematic. The burden of realism was placed squarely on the texture artist who had to bake static surface effects into the textures of characters and props.
Particularly with dynamic game objects such as characters, this made for some disappointing resultscharacters would move into darker or more brightly lit spaces with a disappointing level of light variation, exposing the simplicity and lack of realism in the game scene.
Advances with graphics, particularly the rapid improvement of graphics cards, have made real-time lighting techniques more cost effective.
This has resulted in higher expectations in gamesmore realistic surfaces that respond to dynamic lighting in a game scene.
In this book, readers will explore these shader and lighting concepts through the context of a typical sci-fi horror game. This will allow us to explore a variety of lighting and surface effects.
What this book covers
In this book, we will work through each of the major shader and effects concepts in different chapters. In each chapter, we will work through a different scene file:
, Getting to Grips with Standard Shaders , introduces the context and explores the capabilities and limitations of Unity's Standard Shaders as we set up the materials for our sci-fi horror-themed spacecraft bridge scene.
, Creating Custom Shaders , continues with spacecraft maintenance scenecreating custom shaders to improve the appearance of the game scene. We will create our first custom shader from scratch and then build on this code to create more complex effects for the helmet transparency and planet's atmosphere.
, Working with Lighting and Light-Emitting Surfaces , delves into the relationship between scene lighting and light-emitting surfaces, creating an animated holographic display for our spacecraft cockpit.
, Animating Surfaces with Code and Shaders