Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unreal Engine 5 Shaders and Effects Cookbook - Second Edition

You're reading from  Unreal Engine 5 Shaders and Effects Cookbook - Second Edition

Product type Book
Published in May 2023
Publisher Packt
ISBN-13 9781837633081
Pages 402 pages
Edition 2nd Edition
Languages
Concepts
Author (1):
Brais Brenlla Ramos Brais Brenlla Ramos
Profile icon Brais Brenlla Ramos

Table of Contents (12) Chapters

Preface Chapter 1: Understanding Physically Based Rendering Chapter 2: Customizing Opaque Materials and Using Textures Chapter 3: Making Translucent Objects Chapter 4: Playing with Nanite, Lumen, and Other UE5 Goodies Chapter 5: Working with Advanced Material Techniques Chapter 6: Optimizing Materials for Mobile Platforms Chapter 7: Exploring Some More Useful Nodes Chapter 8: Going Beyond Traditional Materials Chapter 9: Adding Post-Processing Effects Index Other Books You May Enjoy

Exploring Some More Useful Nodes

Unreal contains many different and useful nodes – some of which we’ve already seen, while others are still left to be explored. It would probably be too ambitious to try and cover them all, given the huge number of functions available at our fingertips, however, it’s also true that the more examples we see, the better prepared we’ll be when we need to create a new shader. That being the case, we’ll continue to look at some of those useful nodes that we haven’t had the chance to explore so far in the book.

So, we will cover the following recipes in this chapter:

  • Adding randomness to identical models
  • Adding dirt to occluded areas
  • Matching texture coordinates across different models
  • Using interior cubemaps to texture the interior of a building
  • Using fully procedural noise patterns
  • Adding detail with Detail Texturing

As always, here is a little snippet of what we’ll be...

Technical requirements

The materials we’ll be creating in the next few pages can be tackled with the usual tools we’ve used up to this point: models, textures, and standard Unreal Engine assets that you will be able to use as long as you have access to the engine. As a result, the only things that you’ll need are the computer that you’ve been using to work in Unreal and your passion for learning something new.

Let me also leave you with a link you can use to download the Unreal Engine project that I’ve used to create this book:

https://packt.link/A6PL9

Feel free to download the project and load it up in Unreal if you want to work on the same scenes you’ll see me adjusting!

Adding randomness to identical models

The first recipe we’ll tackle in this chapter will deal with instances of a 3D model. You might have heard about this type of asset, as they are a common feature in many different 3D content-creation packages. We use the name instance to refer to the identical copies of an asset that get scattered throughout a scene, taking advantage of a feature of our graphics cards that allows us to render these copies much faster than if we were dealing with unique individual objects. This can be a very powerful technique for increasing performance, especially when we work with assets that appear multiple times in a level: vegetation, props, modular pieces, or other similar assets. Having said that, dealing with identical models doesn’t necessarily mean that we want them to look the same; we sometimes want a certain variation to occur, if only to break up any apparent visual repetition across the level.

In this recipe, we will explore a simple...

Adding dirt to occluded areas

Creating complex materials for 3D models requires artists to learn about the intricacies of the objects they work with. For instance, replicating the look of a dirty surface often makes the artist think about which areas are more likely to accumulate dirt. To aid with that type of work, render engines often include functionalities tailored to artists with the hopes that they will make their material-creating workflow easier.

One example of that comes in the form of the ambient occlusion render pass: the engine can easily compute which areas are closer to each other, and it allows us to use that information to drive the dirtiness of our shaders. This is what we’ll explore in the next few pages, so buckle up for the ride!

Getting ready

The scene that you can open if you want to follow along working with the same assets I’ll be using is called 07_02_Start, and you can find it within the following directory: Content | Levels | Chapter...

Matching texture coordinates across different models

How we apply materials and textures to our models varies a lot, and it is something that depends on multiple factors: for instance, are we working on small props or are we texturing large surfaces? Do we need to accurately depict real-life objects, or can we include procedural-creation techniques in our workflow?

Those are some of the questions we need to ask ourselves before we begin working on an asset, and we’ve answered some of them in multiple different recipes in this book. However, all of those lessons had one thing in common: we were always looking at individual objects. This time around, we will explore how to tackle multiple objects all at once, ensuring that the materials we create look good on all of them regardless of their individual UV layouts.

Make sure to continue reading to find out how!

Getting ready

The key to tackling this recipe is to have two or more different models that look different when...

Using interior cubemaps to texture the interior of a building

Working with a 3D model of a building comes with its own set of challenges. Many of them stem from the fact that these meshes are comprised of both large and small-scale pieces. This dual nature wreaks havoc among the artists that have to deal with them, and a great example of that problem can be seen when we look at their windows. Do we, as artists, allow users to see what’s inside, with the repercussions of needing to model the interiors? Or do we simply make the glass reflective and opaque, limiting the views of those rooms?

In the following pages, we’ll take a look at a more contemporary technique that brings windows to life thanks to a special type of texture called interior cubemaps, which allow us to add realism to our buildings without needing to model all of the rooms inside them.

Getting ready

Unlike most of our previous recipes, where we can usually jump straight into them, you’ll...

Using fully procedural noise patterns

In this recipe, we will talk about a technique that is both powerful and flexible but also quite demanding in terms of computing power. It is best used as a means of creating other assets, and it’s one that isn’t really suited for real-time apps and games. We are talking about the Noise node — a fully procedural mathematical system that allows you to create many different non-repetitive textures and assets.

Similar to the technique we studied in Chapter 2, in the recipe named Creating semi-procedural materials, this node takes things a bit further and enables you to use an effect that’s very widespread in offline renderers, giving you the ability to create materials where repetition is not a concern. Let’s see how it’s done!

Getting ready

Unlike in the previous recipe, we won’t need anything else apart from what the engine offers us to tackle this recipe. However, I’ve prepared a...

Adding detail with Detail Texturing

The way we create materials for a 3D model often changes based on the size of the object itself: the techniques we use to render small meshes aren’t usually the same ones as the methods employed on big surfaces. In reality, size is not what really matters: more often than not, the difference lies in the distance at which the camera is positioned with regard to a given model. Big surfaces tend to be viewed at drastically different distances: for instance, we can stand right in front of a building or be 10 meters away from it. This circumstance creates the need to set up materials that look good both when viewed up close and when we are far away from them.

In this recipe, we will explore a handy material function that allows us to seamlessly add detail to our materials so that they look great upon close inspection: the Detail Texturing function. Let’s take a look at how to work with it.

Getting ready

The material we are going...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Unreal Engine 5 Shaders and Effects Cookbook - Second Edition
Published in: May 2023 Publisher: Packt ISBN-13: 9781837633081
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}