Book Image

Unreal Engine 4 Shaders and Effects Cookbook

By : Brais Brenlla Ramos, John P. Doran
Book Image

Unreal Engine 4 Shaders and Effects Cookbook

By: Brais Brenlla Ramos, John P. Doran

Overview of this book

Unreal Engine 4 is a powerful game engine, one which has seen a recent boost in widespread adoption thanks to its ease of use and the powerful rendering pipeline that it packs. Seeing as how it's relatively easy to create stunning presentations and visuals, Unreal has quickly become a strong contender in industries where this kind of software had been previously denied entry. With that in mind, this book aims to help you get the most out of Unreal Engine 4 - from creating awe-inspiring graphics to delivering optimized experiences to your users. This is possible thanks to a mixture of hands-on experience with real materials and the theory behind them. You will immediately know how to create that material that you want to display, and you'll also end up with the knowledge that will let you know how to control it. All of this will be done without losing sight of two key components of any real-time application - optimization, and efficiency. The materials that you create will be light and efficient, and they will vary depending on your target platform. You'll know which techniques can be used in any kind of device and which ones should be kept to high-end machines, giving you the confidence to tackle any material-related task that you can imagine. Hop onboard and discover how!
Table of Contents (16 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Preface

Unreal Engine 4 Shaders and Effects Cookbook aims to take you on a journey of creation and discovery within the Unreal Engine 4 game engine. As the title of the book implies, we'll travel hand in hand to every corner of the engine, performing actions that affect the visuals of our games and apps. We'll do so in an orderly way, starting from the very beginning by covering fundamental topics that will stay with us throughout the rest of the book. Each chapter that follows will expand upon that base, allowing for a gentle progression curve that will allow almost any user to follow along. In spite of that, each entry – or recipe – has been also conceived as an independent unit, letting you tackle it separately from the others in case you are already proficient with the other topics.

We'll start by covering the core concepts behind Unreal Engine's rendering pipeline, such as its physically based rendering approach and post-processing effects. With solid foundational knowledge about those two topics, we'll expand upon them and study different types of materials: opaque ones, translucent ones, and more, such as the different subsurface materials and other shading models. We'll also explore several advanced material creation techniques and tricks that the engine lets us use to create multiple different effects—from mixing materials and blueprints, to instancing and material optimization. There's a whole lot we are going to be covering!

Upon finishing this book, you will have a thorough knowledge about many different material concepts and techniques, both from a practical and a theoretical point of view. You'll be able to use these newly learned concepts in any games, apps, or personal projects that you tackle, with the absolute confidence that you are doing it right. With that said, let's get to it!

Who this book is for

Unreal Engine 4 Shaders and Effects Cookbook benefits from a structure that goes in crescendo, covering more difficult topics as we move along together. Thus, the book lends itself to being read by multiple different profiles of user from novice users, to more seasoned ones that haven't yet touched Unreal's material pipeline. Whatever the case, a good understanding of Unreal is definitely a plus, and something that will make your journey throughout this book a much smoother experience.

What this book covers

Chapter 1, Physically Based Rendering, starts off this book by going over the fundamental rendering concepts that Unreal relies on, as well as introducing us to the material editor.

Chapter 2, Post-Processing Effects, introduces the user to the powerful concept of post-processing in Unreal and explains the different effects that can be achieved through it. 

Chapter 3, Opaque Materials and Texture Mapping, goes into detail about one of the most common type of materials in Unreal and the different uses that it has.

Chapter 4, Translucent Materials and More, covers one of the most exciting type of materials, the translucent ones, as well as many others, including subsurface and emissive materials.

Chapter 5, Beyond Traditional Material Uses, goes over different uses that materials can have beyond simply being applied to 3D models, including light functions, UI elements, and displaying videos.

Chapter 6, Advanced Material Techniques, talks about some of the most high-end effects that can be created within the material editor by using advanced techniques, such as parallax occlusion mapping and mesh distance fields.

Chapter 7, Using Material Instances, discusses how to use the concept of instancing to quickly make tweaks to a material instance, layer different shaders on top of each other, and affect multiple material settings at once.

Chapter 8, Mobile Shaders and Material Optimization, goes over various ways to optimize your materials to make them more performant on different hardware where efficiency is important, such as on mobile devices or when working in virtual reality.

Chapter 9, Some Extra Useful Nodes, focuses on some of the most useful nodes we can find within Unreal that don't really belong to a collective category of their own.

To get the most out of this book

Any reader will need to have installed a version of Unreal Engine on their computers; the latest version, if possible. Most of the recipes we'll look at should work on different engine versions, but we recommend 4.22 in order to have the latest features installed.

Prior knowledge about the engine is not a must, but having some working experience with Unreal will help the reader enjoy a smoother experience throughout the book. Whilst no coding skills are required, some fluency with the Blueprint visual scripting language would also be of great help.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Unreal-Engine-4-Shaders-and-Effects-Cookbook. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789538540_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Add a Cheap Contrast node after the Texture Sample, and connect its In (S) input pin with the output of the previous image"

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Drag a cable out of the original Texture Sample and create a new Multiply node"

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Getting ready

This section tells you what to expect in the recipe and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make you more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.https://www.packtpub.com/