Color Swap Shader Under 4 Minutes - Unity 2D

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
begin make sure you're on universal render pipeline i'm in a 2d scene i imported universal render pipeline from the package manager click the search bar type universal it's going to be the only thing with the keyword universal in the standard package package count universal rp hit install wait for instant all you're done perfect next step is you're going to right click and create a sprite now the sprite you know i'm going to add in the tutorial i'm going to reset its position i'm going to add in the tutorial sprite it's pretty basic next i'm going to right click hit create shader 2d render sprite uh lit and then i'm gonna name it uh color swap make sure pause the video if you did miss that okay let's get right right into making the shader i'm gonna maximize the tab and i'm gonna begin by actually creating a texture 2d so you can name it whatever you want but the important part is in the reference underscore main text this is what reads the texture that's currently on your sprite i'm just going to put the default as my tutorial sprite make sure to put underscore main text okay next thing i'll do is create a color this is what i'm going to alter too it doesn't matter what you name it really and the reference is what you can reference from script but i'm not going to go into scripts today okay i'm just going to right click and view it as a panel as a plane so that it doesn't look all cylinder and stuff there you go okay dragging this out we're gonna really quickly hit input texture texture 2d this just makes sure that it will be the correct node i'm going to output it to replace color as an input okay i'm going to pick the color that i want to replace now i want to drag color reference and drag the node in um yeah i'm going to drag it into two perfect it's already replacing the color drag the out into another replace color perfect now i'm going to pick the secondary jacket color and now here's the part where it gets interesting i'm going to drag a color reference out make it into a multiply node multiply it with itself after hooking it up to the two so i can multiply the color with itself make it darker and bam now this is the part you don't want to just output this into the color what you want to do is you want to drag this out output into a split node then you're going to want to chris hit space create an individual node just a combine node yep that's pretty much it drag red to red green to green blue to blue now drag the alpha from your first texture 2d bam you've got it and drag it into color output you just finished and it's completely adaptive you can you can view his sprite right there you know move change the color it will adapt to the color it will darken um correctly if you want you can mess with the math around darkening your color so it becomes a better complementary color but this is just you know an overview if i save the asset i can go into my scene i can see it happening in real time you just want to create a material right click the shader create material i'm going to just name it color swap the same thing and if i drag it in it will do color swap it i can change this color you know that's basically it if you got a question for me comment i will try and get to your comment i get notified so i will read your comment and i will answer if it's a good question thanks later
Info
Channel: CodeGnat Studios
Views: 1,433
Rating: undefined out of 5
Keywords: unity, shadergraph, shader, color change, color palette swap
Id: ExWDacHRVJ8
Channel Id: undefined
Length: 3min 47sec (227 seconds)
Published: Fri Jan 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.