Reader small image

You're reading from  Become a Unity Shaders Guru

Product typeBook
Published inJul 2023
Reading LevelN/a
PublisherPackt
ISBN-139781837636747
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Mina Pêcheux
Mina Pêcheux
author image
Mina Pêcheux

Mina Pêcheux is a freelance content creator who has been passionate about game development since an early age. She is a graduate of the French Polytech School of Engineering in applied mathematics and computer science. After a couple of years of working as a data scientist and web developer in startups, she turned to freelancing and online instructional content creation to reconnect with what brightens her days: learning new things everyday, sharing with others and creating multi-field projects mixing science, technology, and art.
Read more about Mina Pêcheux

Right arrow

The Three Unity Render Pipelines

Now that we have seen a basic example of how to create a shader using Unity’s built-in render pipeline in Chapter 1, we are ready to dive into the newest shading tools and discover the modern render pipelines!

Indeed, while the built-in render pipeline is a good way to start and get familiar with making your own shaders, it is slowly becoming a legacy tool. Nowadays, Unity game makers are encouraged to explore the new Scriptable Render Pipelines (SRPs), which are embodied by the Universal Render Pipeline (URP) and High-Definition Render Pipeline (HDRP). With their optimized graphics, easy-to-use no-code shading tools, great postprocessing effects, and cross-platform support possibilities, those new render pipelines are now in the spotlight, and the built-in render pipeline pales in comparison. To become a modern Unity technical artist, you should definitely know and utilize these new resources to further widen your knowledge, participate in...

Technical requirements

To try out the samples yourself, you will need to have Unity installed, with a version from 2019 or later. You will then need to create either of the following:

  • A project with the common 3D template, which you will then upgrade to use the URP or HDRP render pipelines (see the Stepping up with the URP render pipeline section)
  • A project with the new 3D URP or 3D HDRP template, which you can temporarily force to use the built-in render pipeline, as shown in the Setting up our shader in Unity section of Chapter 1

You can find the code files for this chapter on GitHub at https://github.com/PacktPublishing/Become-a-Unity-Shaders-Guru/tree/main/Assets/Chapter%2002.

Using the built-in render pipeline

Up until now, we have looked at Unity’s built-in or legacy render pipeline. This was a good way to learn how to make shaders in this game engine. However, this pipeline also has its share of limitations.

So, in this first section, let’s discuss the advantages and drawbacks of this pipeline, as well as how we can extend it, thanks to CommandBuffers.

A handy but limited pipeline

The built-in pipeline has several advantages:

  • The most obvious plus is that it is readily available as soon as you create a new Unity project with a basic template. It lets you get familiar with the whole toolchain of shaders, materials, and mesh renderers.
  • Since it’s been around for a long time, the built-in render pipeline is also compatible with a large number of pre-existing shaders, VFX, third-party tools, and learning resources.
  • Of course, because it is a general-purpose render pipeline, it handles most of the common use cases...

Stepping up with the URP render pipeline

The URP is one of the two new SRP templates. It is meant to be highly customizable via a gallery of tools, scalable to ensure your projects are cross-platform between mobiles and desktops, and all-around a more optimized rendering solution than the built-in render pipeline. However, it is not installed by default in all your Unity projects, and we need a few preliminary steps to get a project URP-ready.

So, in the following sections, we will discuss how URP helps foster creativity and support multiple platforms. Then, we will examine the new node-based visual editors it offers, and finally, we will have a look at how to get and set up the URP in a project (both a new and an existing one).

A powerful pipeline for all creators

The URP is gradually becoming the standard for most Unity projects because of its wide variety of applications, its ease of use, and its scalability. Initially called the Light-Weight Render Pipeline (LWRP), it...

Going realistic with the HDRP render pipeline

Contrary to the URP, which is meant to handle diverse use cases and platforms, the HDRP focuses on a more specific application – the creation of 3D (hyper)photorealistic renders for high-end platforms, such as desktops or consoles.

The need for such a rendering tool has emerged for different reasons – most notably, because, as Unity has reached more and more diverse communities, it eventually spread to the film industry. CGI movie teams are now starting to see game engines as a way to get real-time high-level graphics, so Unity had to offer tools to create photorealistic renders inside the engine. Hence, the HDRP!

You might have already seen what the HDRP is capable of if you’ve watched Unity’s famous Unity short films, or if you’ve tried out the HDRP sample scene template – here is a screenshot from this hyper-realistic scene:

Figure 2.9 – Screenshot from the HDRP sample scene template

Figure 2.9 – Screenshot from...

Diving deeper into the SRPs

One of the core ideas with the new SRPs is to allow developers even more granularity in the customization of their rendering process by letting them code their entire rendering pipeline. It is a continuation of the CommandBuffers we saw in the Using the built-in render pipeline section, but with more choice and more control.

This can be particularly valuable if you want to optimize your graphics or your rendering resources in a certain way, typically to better fit low-tier platforms. For the more devoted graphics programmer, it is a great feature because creating your own custom render pipeline from start to finish is the ultimate way to merge aesthetics and performance.

Note that while there is no extensive documentation on that topic yet and it does involve more work than just using one of the templates, we will go through the basics of this in Chapter 10. Another approach to tackling this steep learning curve can also be to use the framework’...

Summary

In this chapter, we discussed the three pipelines Unity offers us – the built-in render pipeline, the URP, and the HDRP. We saw how these templates differ from one another, what their strengths and limitations are, and how we can customize their features to better understand the rendering process in Unity.

We also took this opportunity to introduce some tools and techniques that we will discuss in more detail in upcoming chapters, such as compute shaders and CommandBuffers.

Finally, we saw how the SRPs themselves are designed for performance, and how we can optimize our shaders, thanks to the SRP Batcher.

A key point of this analysis is that today, the URP is slowly becoming the de facto solution for Unity rendering. With its diverse applications, its out-of-the-box optimizations, and its beginner-friendly shader creation tools, such as Shader Graph, it is slowly taking over the built-in pipeline. This is why, in the rest of this book, we will focus on the URP...

Going further

If you’re curious about the differences between the three Unity render pipelines or CommandBuffers, here are a few interesting resources to check out or continue your journey with:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Become a Unity Shaders Guru
Published in: Jul 2023Publisher: PacktISBN-13: 9781837636747
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.
undefined
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 €14.99/month. Cancel anytime

Author (1)

author image
Mina Pêcheux

Mina Pêcheux is a freelance content creator who has been passionate about game development since an early age. She is a graduate of the French Polytech School of Engineering in applied mathematics and computer science. After a couple of years of working as a data scientist and web developer in startups, she turned to freelancing and online instructional content creation to reconnect with what brightens her days: learning new things everyday, sharing with others and creating multi-field projects mixing science, technology, and art.
Read more about Mina Pêcheux