MGS Stealth Camo in Unity Shader Graph

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in most Metal Gear Solid games you can obtain a special item called the stealth camo which makes snake or Ryden completely invisible to enemy guards you get it by being bad mashing triangle getting the bad guys to shake that booty or by shooting toy frogs stand ter in this video we're going to create our own stealth camo Shader to our eyes sneak appears like a translucent ghost although the specific appearance changes slightly from from game to game usually it's vaguely green transparent and it refracts light from uded objects a little that gives us a couple of clues about how we'll need to make our own Shader this all need to be transparent and we're probably going to sample the frame buffer or camera texture to do the refraction this is basically an image of the whole game screen captured partway through rendering a frame that we can use in future shaders that means that step one is going to be heading over to your urp asset and Ticking the opaque texture option at the top by default there are three urp assets for three quality settings so you should enable opaque texture for all of them now we can sample the frame buffer in our shaders I have our fake sneake here and we're going to help him avoid being spotted by the guard let's create a new unlit Shader via create Shader graph urp unlit Shader graph and I'll name it stealth camo you can make it lit if you want but I'll keep it simple when we open the graph we'll be met with the output stack and the graph inspector over in the graph settings tab of the latter I will change the surface type to transparent this is important because unisy captures the camera texture between rendering all the opaques and all the transparents so this graph will not work if we use opaque rendering here next I'm going to add some graph properties I'll actually add all three of them up front the first will be a color named base color this lets us choose which flavor of jelly just turn snake into I wonder if this green is closer to Apple or grape that's for you to decide the alpha channel of this color will control the ratio of the final pixel color between the base color RGB values and the camera texture values next up are two float properties called noise size and noise strength if we just wanted this camo Shader to look transparent we would only need a color property but what I'm going to do is Wobble the camera texture around a bit to simulate light refracting through snake which I'll do using noise these two properties simply control the size of the noise clouds and how strongly they disrupt the original texture I used default values of 20 for the size and 0.5 for the strength let's now construct the graph it's relatively small I'll work from the end backwards first make sure the alpha output is set to a constant one for the base color output I'm going to use a lurp node to pick between the scene color node and the a slot this is the node that gets the camera texture and the base color property in the B slot as I mentioned the base color Alpha Channel controls the ratio between these two colors so use a split note to get only the a component of the base color and connect it to the t- slot on the lurp node already if we save and observe the Shader in the scam view by changing the base color Alpha we can slide between seeing the color and seeing the wall behind snake now let's add some wobble we're going to do that by changing the UVS used for the seene color node start with a simple noise node and use noise size as its size parameter this outputs noise clouds with values between Z and one the next step is a small tweak but basically I want the noise to move the camera texture pixels in all directions rather than just towards the bottom left so I'll remap that 0 to one range to a minus one to one range instead otherwise our offset for all pixels is always in the same direction then I'll multiply by noise strength to get an offset value but what will it offset by default the seam color node takes a set of screen space UVS which are identical to the screen position node so all we need to do is add our offset to screen position and input it to the seam color node and that's the graph complete back in the seam view we can bump the noise SC to anything above zero and see some Distortion of the wall behind Snake Here the base color Alpha is about 30% now fake snake can slip by the enemy without being seen and complete his goal of meeting up with his jelly Brethren until next time have fun making [Music] shaders
Info
Channel: Daniel Ilett
Views: 2,220
Rating: undefined out of 5
Keywords: metal gear solid, mgs, stealth camo, stealth effect, camouflage, camo, unity, unity tutorial, urp, shader graph, shader, tutorial, shader tutorial, unity urp, metal gear, mgs stealth camo, mgs master collection, transparent shader, transparency, scene color node, shader nodes, unity nodes, distortion shader, scene distortion, color distortion, translucent, translucent shader
Id: CjgYWtJH1cE
Channel Id: undefined
Length: 5min 7sec (307 seconds)
Published: Tue Mar 26 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.