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

Making 2D outlines

After this brief introduction to 2D sprite shaders, we will move on to another nice topic for 2D shaders: the auto-outlining of sprites, thanks to dynamic and tweakable stroke shaders. Our goal here is to build more and more advanced shaders to introduce new effects gradually and create more complex outlines around our sprites.

We will first begin with a simple outline using one solid color, then we will see how to use post-processing and HDR emissive colors to add glow, and finally, we will study how to make animated shaders that use the current time in their logic.

Implementing a simple outline

First of all, let’s see how to implement a simple sprite outline for a pixel-perfect sprite. This is a simple technique for adding a stroke that relies only on copying and translating. It doesn’t handle corners, so it doesn’t work very well for smooth sprites, but here is how it will look on our sample pixel-perfect sphere:

Figure 11.17 – Pixel-perfect sphere sprite without (left) and with (right) our soon-to-be Outline shader ...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Become a Unity Shaders Guru
Published in: Jul 2023Publisher: PacktISBN-13: 9781837636747

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