hey guys and today we're going to be going over well this um so if you couldn't tell i wasn't purposefully making it low res uh but this is just a shader that i made and it's only low res because we can't really have access to physically zooming in besides i guess slowness but this does provide some form of zoom with kind of low res and we're going to be doing just this is just like an example so that i can teach you guys a little bit about shaders and vanilla so when you're working on shaders
you need a few things you need the game output log which you can google search if you don't know how to open and it needs to have all these selected because a lot of shader info like debug stuff shows up on info for some reason not on warning so if something goes wrong it will be in the info button and it'll tell you what line you had a problem with but it's pretty hard to debug these things so you're also going to need to go into your versions into whatever version you're on go to the
jar file and then just open it with some kind of archiver so you can see the files so these are the two very important things when you're working on shaders a lot of times you're jumping off of somewhere else because you can't just magically add new ones and then they just show up in game you have to use a existing one and then branch off from there so we're going to create a new pack and i'm just going to type in demo for this one so when you have resource pack you need the pac.mcmeta and
the pac.png as well as a folder that just goes to assets right so we're going to make a folder for assets the png and the mc meta doesn't really matter as long as the pac.mcmeta says version six and let's do uh for demo and that's okay so i mean if you don't have resource pack already you wouldn't make a new file save it as a mcmeta file name it pack all right so in assets we're going to copy this extension so assets then minecraft there we go okay so there's this new folder called shaders so
we're gonna make that okay so now you have post and you have programs so post is kind of like what is going to trigger what's going on and program is what that thing that gets triggered is going to do so program is what's physically zooming in and post is what tells you to zoom in when you spectate a creeper today we're just doing spectate creeper obviously i have some way cooler methods with uh but they require a little bit more complex knowledge of shaders to do so we're going to start with the simple case uh
so yeah we'll be hooking off with something that already exists you can do this with a glowing effect as well uh it's a common trick you summon a end crystal give it glowing effect you can mess around with that because n crystals of glowing effect will trigger the shader for everybody anywhere in the world i just want to use creeper because it's a little simpler to deal with no things i got to explain that are exceptions and then also like with glowing you have to hide the glowing entity sometimes if you're not doing the under
crystal trick that could be a little bit annoying so we're going to just go with the basics so first we need post this is how it's going to go somewhere so we have all these ones that the game already uses in one way or another obviously there's ones like creeper and spider which happen when you spectate them then there's some better ones like transparency which we'll use later which trigger when you turn on fabulous shader i'm just going to put fast since we don't need it right now but those ones are applied automatically when you
have fabulous on okay so let's go ahead and pick creeper so creeper.json these are there's gonna be basically three types of files json vsh and fsh and those are opengl language type files and json are their special json components that you can mix and match and mess with so obviously you're going to need some kind of a text editor to edit these we're going to work with creep with uh sublime text i will zoom in quite a bit so that anybody that is on mobile can or something some smaller device can see this pretty well
so let's zoom in a lot so shaders have three well really two key components you got your targets and your passes so a target is kind of like something that holds something it holds a texture essentially it holds basically like a 2d image most of the time and then passes are kind of like an order of operations so kind of like these so first we do this command then we do this one then we do this one this one this one right but what we do is we put targets into the passes and there's a
few default targets so main is just going to be main so it's what i see like this excluding any special things if that makes sense to you like main is kind of like what is eventually going to get drawn onto your screen which is why at the end of this your out target is main okay so in this shader it does some like for the regular creeper shader it plays the it does a few passes so the first pass it does is going to be color convolve so this is going to play a program called
color convolve it's going to take an input as the main and output is the swap you cannot make input and output the same it might not show up as a bug but it definitely won't update properly so you have to take input to a temporary target so swap the main goes to swap and then the swap goes to main at the end right down here and that's a pretty common practice of you put something on a placeholder then the placeholder goes in using just a simple kind of uh input method so this will be bits
there's a couple different ones like blit um we'll go over some of the common ones as well uh but anyways i'm just trying to show you how to mess with uh just mess with things that you already have available to you in this one so anyways we have color convolved we're not trying to color convolve we're trying to zoom in so we're just going to change this to zoom it's going to be our own special one uniforms are like matrices that you pass to it that hold data so for example color convolve needs red green
and blue matrix and obviously when you're spectating a creeper it turns everything green so they have these special values on the green matrix only we don't need uniforms because we're just zooming it's a very simple case so it's just as simple as you have an input the input is going to be main and it's going to run the zoom program and then it's going to output on the swap and then again we can get rid of this this isn't important i guess you could probably use the same thing but uh well definitely not because bits
is going to like turn this into pixely and technically we're not pixely so we're going to change this to blit blitz is probably the most common one you'll see there's two versions blit and blit underscore copy uh we'll cover blitz copy in a later video but it's like a special version of blit all this does is it just takes the input and puts on the output that's that's pretty much all it does blit copy is like a special one because sometimes split doesn't work when you're like rotating a screen and you have some weird cases
split copy just like accounts for all cases like the check for everything kind of case but anyways so this is a pretty simple shader it might be confusing to look at since you don't understand all the concepts 100 but you have targets and you have swap this is like creating your own scoreboard or your own dummy variable and then you have so passes and then the passes is going to first take main and put it on swap and run zoom so zoom is going to do something to main and put it on swap then you're
going to run blit you're going to do something to swap and put it on main and to do something is nothing really you're just swapping them which is why they use the nomenclature of swap okay so now let's go on to what does zoom do and what does well you don't really need to know what blitz does but we'll take a look at it real fast anyway uh so we're going to go into program so blitz blitz actually is pretty simple and this can get really it could get really complicated with all the specific word
choices so it could be kind of hard to find so i'm not going to cover what most of these do but you have samplers and you have uniforms those are the main things and then vertex and fragment are what programs to run on this thing that you're passing into here so we pass main into here and then we run vertex and fragment and vertex and fragment do stuff like so here is fragment fragment has to do with color so fragment is just going to get the pixel at the coordinates multiply it by color modulate which
usually is not going to do anything and you're going to put that onto fragment color okay so what this does is for every pixel this loop will play this is kind of like a loop so it'll it'll run these lines for every pixel text chord is the location of where you're at in the loop which you can't really it's something that'll just increment it on its own and diffuse sampler is kind of like your picture that you're reading so you're going to go to a location in your picture create a texture 2d which is just
going to give you um r g b alpha on a vector and then you're going to store the rgb alpha onto the current pixel you're at which would be glad color so yeah so blit is very simple it just samples where you're at and puts it where you're at on the rendering process and then vertex shader has to do with the corners of your screen so in the upper left bottom right center corners those are different vertexes and it lets you kind of like move where the vertexes are so essentially like you can take the
corners and stretch them now this would probably be where you're going to want to run this zoom thing but i have a set of zoom code that runs in fsh so that you can a little bit easier adjusted in two dimensions instead of just one dimension so we're going to be covering that so let's go ahead and close the blit because blit will just run on its own and work as intended so let's go ahead and copy these two right here and since they're such a simple case and we're going to open them up and
we're going to edit them so we don't there's a lot of stuff here we don't need but i'm just going to not touch it for the sake of not doing anything confusing we're just going to type zoom here so it'll play our own zoom fsh file so we need to make a zoom fsh file and now it has the same stuff as before but we're going to change what this does i'm not going to this this is by no means a tutorial on how to do glsl code uh so i'm going to just be pulling
from my previous ver project and i'll leave a paste bin link to this code well i'll just leave the link to where this code is a placement link to this code in the description um but yeah this program was made by disco hound hunt durdisco hunt on discord there was actually a lot of guys and i'll let you know all the resources that i used when i was going through shaders but just know that it basically makes every pixel on your screen at a different location with reference to the center of the screen i believe
and you can mess with these two variables to change how wide how far they get spread at the top and the bottom to make a trapezoid shape and you can mess with this one to mess with the zooms let's see if you guys also caught this you're going to see here malformed line at 10 passes out target so this will tell you an error sometimes it's on the warning sometimes it's on the info add an extra comma there so if i refresh it shouldn't have that error anymore it's good to clear logs when you're gonna
refresh that way you can see the new stuff when the new stuff is there so no errors so let's go ahead and spectate and yeah that's pretty zoomed in okay so then obviously we have to figure out some way to apply the shader so i went ahead and this isn't a command tutorial by all means but i made it a scoreboard that is zoom and it activates when you right click a carrot on a stick then when you when this happens it runs the conditional command to summon the creeper tp the creeper to you then
puts you in spectator mode then spectate the creeper then set your zoom to zero then if you're near a creeper a shader creeper then and it detects you outside of spectator mode then kill it puts you back in creative so now when i go like this now i'm going to go like this it'll apply the shader uh you can see the flash of the creeper sometimes though so it's not perfect obviously you would want some nice idealized case where the shader triggers on its own in which i'll show you with the shader sauce i think
right shader sauce this i think this is the right pack but when you have the shader sauce ignore the numbers in the top left of the screen and you have the shader sauce it'll zoom when you click the carrot on a stick and just like that so it's a lot more it's a lot more uh smooth and it's easier to implement less commands obviously uh but it's a lot more complicated you'll see with the numbers on the top left i'm doing some crazy number stuff but yeah so i was mainly just covering the shader though
and i will eventually cover the uh special shader here the whatever you want to call it the shader sauce shader but what it does is it basically reads a 3d model color and it saves that until it sees another one of a similar color and then it reads off what the alpha level is so if the alpha level is 252 out of 255 then it'll do this shader and so on and so on but yeah i'll be releasing that later when i get a little bit more in depth on shaders but this is just a
beginner's tutorial so what we covered today is how to hook off of existing shaders in the game like creeper what passes are and what they refer to as well as the in target and out target we also went over program and what programs are and what you can change in here so this is the fragment it'll refer to a fragment shader this is the vertex it'll refer to a dot vsh file of the same name uh you can also have subfolders that i didn't explain but you could have like uh debug slash right and then
it'll be in the debug the program debug folder uh now uniforms we kind of talked about but we didn't go over them specifically there's a lot of uniforms that are just like special that are used in everything such as outsize project matte color modulates pretty common there's a couple of the common ones uh then samplers we kind of went over samplers so samplers are kind of like a set of information like the diffuse sampler is mainly just going to be all the pixels on your screen there's a couple other samplers like depth sampler that's going
to give you info about every pixel's depth on the for each pixel so you can actually see like that one that pixel that i'm looking at right over there is x distance away so you can actually do that but it's a little more advanced now if you want more info on this i will link a really good tutorial like guide google doc in the description that covers most of the shader stuff just not the depth stuff because that's newer and it has some examples that are somewhat out of date but some of them do work
uh it was by i think it was made by sir bennett but yeah uh and then special shout out to sir bennett oh nowhere vdv man and or disco hunt for helping me make my secret my shader sauce pack my special uh i haven't come up with a name for it but it's essentially like a shader selector uh anyways that's pretty much it for today guys thanks for watching and i'll see in the next one peace [Music] you