Unity 2D Glow Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so today we are going to see how to create a 2d glow in unity [Music] so what is going on guys i'm gabriel aguer currently working on rabbit style links below for more we're actually going to use the scene from rabbit's tail and i'm going to show you how to create a glow how to go from here to this we are going to add a 2d glow to a certain area of an image so without further ado let's jump right into this and it would be awesome if you guys could follow our studio golden bug in social media we are developing a metroidvania very excited about it so make sure to check it out so as you can see we are going to go from these to have a glowing plant really cool i was in dire need of a glow to my game to rabbit style and i came up with this quick solution and i want to share with you so the first thing we are going to need well is besides the image the sprite you are trying to add glow to we are going to need a shader i think it's really important to mention that i'm using the 2d renderer in the universal render pipeline by the way that's really important because we have some features here like shadow graph where we can create specific shaders for sprites so let's do exactly that with right click let's go to create and in shader we have a lot of options but what we are going to need is a sprite lead shader graph or a sprite unlit if you don't want these to be affected by lights of the to the scene in my case i want this to be affected by the lights we have 2d lights so i'm going to create a sprite lead shadow graph i'm going to rename this to 2d glow underscore tutorial and then double click to open this up and the shader is very simple in the graph inspector make sure you have universal as the active targets and in my case like i said i'm using sprite lit for the material in more recent versions you can select if it is alpha or additive you can try both by the way first thing we need is a texture to d for the main texture and it's super important that the reference is named like this and the scar main text exactly like this we don't need to assign any text to this unity will automatically detect the sprite being used in the sprite render and add it to our material to our shader let's then create a color for the glow color in hdr mode leave it at black and then create a text 2d for the glow texture which is basically a mask i'm going to show you in a moment what this is let's sample the main texture and to this we are going to add something and that same thing is going to be the sampled glow texture multiply it with the glow color and this is going to be connected to the base color of our shader very simple very straightforward if we save this right now press right click in our shader and create a material you can rename it to whatever you want and then we can assign this to the sprite render to the material slot and as you can see not much has changed but we have kind of a glitch and i left it on purpose so you know what's happening basically we don't have any transparency our shader must know what is the alpha so let's go back to our shader and it's actually very simple in the last node we can split it and access the a channel which is the alpha channel and connect it to the alpha input of the fragment function save this and that's it we have transparency in our sprite and if you want a simple glow to the entire image that's it you have done it you simply need to select the color increase intensity probably add a global volume and that's it but if you want to add a glow to a specific region you are going to need basically the same image the same sprites as you can see i have an emission texture which is exactly the same but if i for example select the yellow and increase the intensity i get a glow only in certain areas of this plant which is great i can select whatever color i want and it adds a nice glow so as you can see the trick in this image the emission image is to black out what we don't want to have a glow the visible parts are the ones that are going to have a glow as you can see and i can quickly show you how you can do it i'm going to right click on my original mesh which is a psb file a photoshop large file but i'm going to use crit and it's a very specific workflow with crit i'm going to drag and drop the psb which creator reads perfectly i'm only going to show the plant that i want to have glow i'm going to create a new layer i'm going to create a group and on this new layer with the brush tool with a black color let me just decrease the fade so it's smooth opacity at 100 i'm going to paint like this as you can see it's all over the place but we can click on this icon to only apply to only apply the black color to where there is pixels so i'm going to add what i don't want to have glow you can create some fades with low opacity basically then i'm going to show every single one of these plants and i'm going to export this as a photoshop file this is the krita workflow by the way call it the emission02 and i'm going to open it up again in krita this new file but this time let's turn on this icon but this time i'm going to merge the group with ctrl e as you can see we only have the plants with the exact same name i'm gonna press ctrl s to save this i'm gonna go to the folder and rename the extension to psb because i'm using the photoshop importer from unity and i don't want to change the position of the plant compared to the original sprites once i go back to unity it will impart the emission zero to texture and as you can see i can add it right here and we can see the changes happening obviously if you are in photoshop or in you probably have a different workflow but this is the creator workflow renaming the extension to psb but hey that's a little bit besides the point now you know how to add a glow to certain parts of your image basically you need to black out what you don't want to have glow and what is left behind will have a glow and yes if you want your entire image to glow you simply need to increase the glow color and intensity another important thing to mention before finishing this tutorial is that i have a global volume with bloom that's why it's glowing it's very simple to add one nowadays with right clicking your scene you can create a global volume and then add a profile or create a new one and on that profile you can add a bloom a vignette motion blur a lot of post-processing effects that are quite useful and will improve the aspect of your game and they aren't that heavy by the way but yeah that's it now you know how to create a quick glow to an entire image or to only certain parts please make sure to check out the game we are developing follow us on twitter or on instagram or on tick tock whatever you want or wishlist on steam that would be awesome all the links are below as you can see the game is getting really cool really beautiful so you will not be disappointed for sure i have tons of projects on my patreon page by the way with special effects a lot of special effects links below by the way and i want to take this moment to appreciate each patron for supporting me the last month and as usual a quick shout out to the top tier patrons which are treaty sorcery of tin schneider achilles benitez aviatobali jack marks duke williams dewey trump edward chai gabriel orlowski gills walter jodep manfregla goblin plug guillermo trinidad casey miller kennen ansel mark anu mograph quentin giorno radioactive bullfrog scorpio servo shanique coutier meso stephen t megal brown vel verisuta will hughes will paulian shin pyong ling and myeong laksung thank you all for your amazing support you guys are awesome and you keep this channel running as well as the studio i hope you have enjoyed this video and i hope to see everyone in the next video thanks bye [Music]
Info
Channel: Gabriel Aguiar Prod.
Views: 41,782
Rating: undefined out of 5
Keywords: 2d, unity, glow, unity glow, unity 2d glow, unity tutorial, unity effects, unity shader graph tutorial, unity shader graph, shader graph, shader graph tutorial, unity shader tutorial, shader, unity 2d, unity 2d tutorial, unity 2d shader graph, unity 2d shaders, unity 2d effects, shader graph 2d, tutorial, 2d shader, unity 2d laser, 2d tutorial, unity bloom, unity 2d shader, 2d glow, rabbit tale, rabbits tale, golden bug, gabriel aguiar, metroidvania, indie dev, game dev, vfx
Id: Tm0rRX8GnFk
Channel Id: undefined
Length: 9min 37sec (577 seconds)
Published: Tue Aug 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.