This is actually so cool. I've been programming for years, but never got into shaders. Thank you so much for this tutorial. Looking forward to looking at another tutorial -Kouda
SV_Target in hlsl refers to which output are you going to store your data in. For example you might have 1 depth texture and 1 color texture and you want to write on both of them . So you return an struct like color:SV_TARGET0 and depth:SV_TARGET1.
Great tutorial . It is basically the hlsl syntax that we normally use for vulkan/dx12, ... The macro that converts vertex position to clip pos is basically multiplying modeViewProjection matrix into it.
Great video. I'm very familiar with the principles but its fantastic to finally learn how to edit and experiment with the shader in Unity. Thanks for explaining the bizarre syntax.
thanks for the tutorial. i wound up integrating the stuff I use in my surface shader to it, and gave it a few options for toggling features on and off. I was looking for a way to integrate a roadmap into the terrain using a premade texture, and i did not know how to do it using a surface shader. also you can scale the size of the outputed texture on the surface by using a scaler to increase its size on the y or z axis, as long as its a tiling texture it will work perfectly
To help when following tutorials, I like to make every name a little silly like fragmentFuncThing. So that I know this is a name and isn't confused later about if it's a value type or an obligatory function. But yes the GPU is very underrated, it's basically the same as the CPU but most often it's many times faster and better hence why it's called GPU Graphics Processing Unit. I thing Coroutines were involved in that or something, just remember an article about it of how you should use the GPU as much as possible when you can due to it's high performance compared to the CPU. Glad there's an easy tutorial finally going from THE BASICS where every good tutorial should start.
Great, I just started looking for a shader tutorial that explains them from the ground up! A bit of feedback, could you zoom in on your code? Watching in split window view makes it a bit hard to see. (In visual studio it's ctrl + scroll wheel up)
Thanks for the support :D Yeah, I'll try to remember to zoom in. I sometimes do but then I zoom back out when I'm working on my own. I'll try my best to remember :D
Ty very much, I get it. I was perplexed , why this guy isn't returning in a function? Could he be like expecting it and fixing it in a grand finale? Hehe Ty, anyway, I can put what is missing in the explanation because your sense and familiarity are well conveyed. I.e when you abstract some piece of data from the properties to the CGProg you make a pause or talk about it. I can tell you really care and were you intend to go. So its really nice to have this videos, don't be.. Like depressed if you think they aren't the best, they are good enough. Cheers mate, gonna see all the next videos ! Ty again. Keep it up
I'm glad you are excited to learn :D Keep in mind I am still learning too so don't expect everything to be perfect. Shader coding is a very advanced area to delve into :D
Dapper Dino - Coding Tutorials, I know, Now I think that shader graph cant do all stuff that we can make through CG language code, I really want to create Grass shader with ability to rotate in different direction in which player stays at grass. It is called how I saw interactive grass) Anyway good luck and I wait for new videos!
Here is the Documentation for it: wiki.unity3d.com/index.php?title=Shader_Code It's the position of the vector after it has been transformed into projection space in the 'Vector to Fragment' function.
@@DapperDinoCodingTutorials Coding shaders is really hard, so let's fuck it and just tell everyone how to use shader graphs and tutorials on premade assets! Finally found your video which finally teaches it. Like trying to find a coding tutorial on entities in gmod lua
You mentioned in the video that the formatting was annoying to do. but for the cg part if you code it in Visual Studio Code it will have auto-formatting and then you can copy it into the shader file.
I have a bunch of question after watching this... but it all start with this : we have 2 functions : vertexFunc and fragmentFunc, but we are just declaring it, there is no point in the code that it says to call the function what is going on ? btw, what did we meant by "Pass" ?
EWxcellent tutorial. I don't fully understand it all, but you explain it really well. I'm getting an error, though: undeclared identifier 'UnityObjectToClipPos' I've checked and re-checked my code and I simply can't understand what I'm doing wrong.
Sir I need your help:) What If I want to add some little vert function but at the same time I want keep all power and flexibility of Standard Shader? Is it any good and simple way to inherit from Standard Shader with no blood? Or maybe copy it and modify but keeping simple.
I've never bothered doing that before tbh but I see why you would :D I guess you could copy the code from the Unity standard shader and just tweak it a bit?
im not sure on this but: i think its because the first 3 contain the position of the vertex and the 4th one contains the distance from the main renderer (the camera) to the vertex again im not sure so dont quote me on it
me when i try to learn it after knowing OpenGL: ^-----^ ez and btw ik I'm quite late but when we use this ":" behind a function, it basically means whatever we wrote after that sign is going to be inherited, and so we can use its stuff, or so I think, I'm coming from c++ so that's how it works.
Hello, I followed your video to write shader, and finally made a mistake, according to the prompt to make changes, but still wrong. syntax error:unexpected token '-'at line 46 (on d3d11) syntax error:unexpected token '*'at line 48 (on d3d11)
Look at the error messages and just do what they say. They seem simple enough. You just have characters that shouldn't be in the shader. I never used a '-' or a '*' in mine anywhere.
Just change the '-' to an '=' since you are setting the variable. Please learn basic coding before trying to learn shaders. This is for beginners to shaders not beginners to coding.
I WANT TO LEARN HOW TO WRITE SHADERS WITHOUT CGPROGRAM BOT NOBODY GOES OVER THIS!!!!!!!!!!! im making a mobile game and it needs to be efficient as possible. that means we cant use CGprogram
Whenever I see "Colour" spelled like that I automatically pronounce it with a hard "ooh" sound. So "Coloohr". It just looks wrong with a u in it. Anyway, great tutorial. Thank you very much!
I'm a beginner. So, what the heck are you doing? I'm a programmer. I've programmed objects in Java and Flash (AS3). Even android applications. So, let's backup a minute. This is Unity, a whole new world and it's also C#, something new to me too. So tying these two things together... Where is the cube? Was it added to the scene? You should start from the beginning. And you right-click-create material, then shader, and click and babble, and more babble. Please start from the beginning. I can program in object oriented programming, I can do many things. I'm not showing off, but if this is a beginner "tutorial", please do it from the very beginning. Unity Scenes is a new concept and you just jumped in with a scene already in motion it appears.
5 years later and its still great. love these vids man.
Wow, this is one of the simplest shader tutorial I've ever encountered. Nicely done
Straight from scratch and explaining everything exactly in clear and quick detail.
Tutorial perfection.
Great idea. I hope you won't stop making these tutorials, because there are very few of them about writing own shaders on RUclips :)
I'll try to keep them as often as my other videos :D Thanks for the support :)
mind blowing, really decent Tutorial
This is actually so cool. I've been programming for years, but never got into shaders. Thank you so much for this tutorial. Looking forward to looking at another tutorial
-Kouda
I'm an UI artist with some tech-art background and this is a super helpful series to me. Thanks a lot, man.
SV_Target in hlsl refers to which output are you going to store your data in. For example you might have 1 depth texture and 1 color texture and you want to write on both of them . So you return an struct like color:SV_TARGET0 and depth:SV_TARGET1.
20:16 "So basically what this does is it makes it work." Excellent tutorial!
Great tutorial . It is basically the hlsl syntax that we normally use for vulkan/dx12, ...
The macro that converts vertex position to clip pos is basically multiplying modeViewProjection matrix into it.
Thank you for making this video.
Super excited to get started with this
Great video. I'm very familiar with the principles but its fantastic to finally learn how to edit and experiment with the shader in Unity. Thanks for explaining the bizarre syntax.
this is awsome your tutorials are short and to the point good job on em, I am following em right now!
nice! I'm having an exam tomorrow where I need to know the basics of shaders and this certainly did the trick! :D Gj man!
Thank you very much! Very nice explanation, I could finally understand what the hell I am doing
Even though im very new to C# and Unity, you made me understand everything. Thank you so much!
Excellent explanation here. First tutorial of several that I've seen to actually get things clicking. :D
thanks for the tutorial. i wound up integrating the stuff I use in my surface shader to it, and gave it a few options for toggling features on and off. I was looking for a way to integrate a roadmap into the terrain using a premade texture, and i did not know how to do it using a surface shader. also you can scale the size of the outputed texture on the surface by using a scaler to increase its size on the y or z axis, as long as its a tiling texture it will work perfectly
Awesome tutorial! Really to the point, which is exactly what I need since I'm just getting started with shaders! Subscribed :)
have you ever thought about being a teacher? You explain things clearly and simply and make it fun to learn
Great tutorial! Thank you!
To help when following tutorials, I like to make every name a little silly like fragmentFuncThing. So that I know this is a name and isn't confused later about if it's a value type or an obligatory function.
But yes the GPU is very underrated, it's basically the same as the CPU but most often it's many times faster and better hence why it's called GPU Graphics Processing Unit.
I thing Coroutines were involved in that or something, just remember an article about it of how you should use the GPU as much as possible when you can due to it's high performance compared to the CPU.
Glad there's an easy tutorial finally going from THE BASICS where every good tutorial should start.
Great, I just started looking for a shader tutorial that explains them from the ground up! A bit of feedback, could you zoom in on your code? Watching in split window view makes it a bit hard to see. (In visual studio it's ctrl + scroll wheel up)
Thanks for the support :D Yeah, I'll try to remember to zoom in. I sometimes do but then I zoom back out when I'm working on my own. I'll try my best to remember :D
24:08 and that my children is how Unity was born xD
OH
Ty very much, I get it.
I was perplexed , why this guy isn't returning in a function? Could he be like expecting it and fixing it in a grand finale? Hehe
Ty, anyway, I can put what is missing in the explanation because your sense and familiarity are well conveyed.
I.e when you abstract some piece of data from the properties to the CGProg you make a pause or talk about it.
I can tell you really care and were you intend to go.
So its really nice to have this videos, don't be.. Like depressed if you think they aren't the best, they are good enough.
Cheers mate, gonna see all the next videos ! Ty again.
Keep it up
Excellent introduction video.
Oh my God! I really want to know how it do from script not from graph or forge and etc) Wait for new tutorials) Good luck, don't stop doing it :)
I'm glad you are excited to learn :D Keep in mind I am still learning too so don't expect everything to be perfect. Shader coding is a very advanced area to delve into :D
I missed information about SV_POSITION. POSITION is position of object? And SV_POSITION is?
Dapper Dino - Coding Tutorials, I know, Now I think that shader graph cant do all stuff that we can make through CG language code, I really want to create Grass shader with ability to rotate in different direction in which player stays at grass. It is called how I saw interactive grass) Anyway good luck and I wait for new videos!
Here is the Documentation for it: wiki.unity3d.com/index.php?title=Shader_Code
It's the position of the vector after it has been transformed into projection space in the 'Vector to Fragment' function.
@@DapperDinoCodingTutorials Coding shaders is really hard, so let's fuck it and just tell everyone how to use shader graphs and tutorials on premade assets!
Finally found your video which finally teaches it.
Like trying to find a coding tutorial on entities in gmod lua
great series thanks !
You mentioned in the video that the formatting was annoying to do. but for the cg part if you code it in Visual Studio Code it will have auto-formatting and then you can copy it into the shader file.
How do you make the HLSL for visual studio 2022 tool to work an intellicode to read hlsl? default installation is full of warning and error.
I have a bunch of question after watching this... but it all start with this :
we have 2 functions : vertexFunc and fragmentFunc,
but we are just declaring it,
there is no point in the code that it says to call the function
what is going on ?
btw, what did we meant by "Pass" ?
Nice dapper
Thank you, good sir. I tip my tyrannosaurus top hat to you.
In Canada we spell colour with a u as well.
EWxcellent tutorial. I don't fully understand it all, but you explain it really well. I'm getting an error, though: undeclared identifier 'UnityObjectToClipPos'
I've checked and re-checked my code and I simply can't understand what I'm doing wrong.
Sir I need your help:)
What If I want to add some little vert function but at the same time I want keep all power and flexibility of Standard Shader? Is it any good and simple way to inherit from Standard Shader with no blood? Or maybe copy it and modify but keeping simple.
I've never bothered doing that before tbh but I see why you would :D I guess you could copy the code from the Unity standard shader and just tweak it a bit?
wait a minute you are from UK? (i am too, there is not a lot of British RUclipsrs)
Shader error in 'Unlit/tutorial1': Did not find shader kernel 'vertexFunc' to compile (on d3d11)
Hlsl is between the CGPROGRAM and ENDCG
How can I create a Shader for a Material on an Image, so that the Image gets masked and is reacting to light
I tried this tutorial on Unity 2020. I copied your code exactly. Unity placed the shader in a section called 'not supported' and it does not work
How would you do a custom sprite shader?
Sooo is this for minecraft shaders?
Where's the other parts?
Has anyone got any ideas of how to change a LUT via a script?
Why is position a float4? Shouldn't it only be a float 3?
im not sure on this but: i think its because the first 3 contain the position of the vertex and the 4th one contains the distance from the main renderer (the camera) to the vertex
again im not sure so dont quote me on it
me when i try to learn it after knowing OpenGL:
^-----^ ez
and btw ik I'm quite late but when we use this ":" behind a function, it basically means whatever we wrote after that sign is going to be inherited, and so we can use its stuff, or so I think, I'm coming from c++ so that's how it works.
Hello, I followed your video to write shader, and finally made a mistake, according to the prompt to make changes, but still wrong.
syntax error:unexpected token '-'at line 46 (on d3d11)
syntax error:unexpected token '*'at line 48 (on d3d11)
Look at the error messages and just do what they say. They seem simple enough. You just have characters that shouldn't be in the shader. I never used a '-' or a '*' in mine anywhere.
In 24 minutes, 33 seconds, 45 lines,fixed4 pixedlColor - tex2D(_MainTexture,IN.uv);
Why are you setting your variable with a '-' you should use '=' no matter what the language :p
Do you have any social software? For example, WeChat, QQ, Email? Can I show you a screenshot?
Just change the '-' to an '=' since you are setting the variable. Please learn basic coding before trying to learn shaders. This is for beginners to shaders not beginners to coding.
Other videos ?
this is about the same as programming in fricken notepad
8:02 *Accidental semi-colon*
You Need to to zoom in
I WANT TO LEARN HOW TO WRITE SHADERS WITHOUT CGPROGRAM BOT NOBODY GOES OVER THIS!!!!!!!!!!! im making a mobile game and it needs to be efficient as possible. that means we cant use CGprogram
Whenever I see "Colour" spelled like that I automatically pronounce it with a hard "ooh" sound. So "Coloohr". It just looks wrong with a u in it. Anyway, great tutorial. Thank you very much!
I'm a beginner. So, what the heck are you doing? I'm a programmer. I've programmed objects in Java and Flash (AS3). Even android applications. So, let's backup a minute. This is Unity, a whole new world and it's also C#, something new to me too. So tying these two things together... Where is the cube? Was it added to the scene? You should start from the beginning. And you right-click-create material, then shader, and click and babble, and more babble. Please start from the beginning. I can program in object oriented programming, I can do many things. I'm not showing off, but if this is a beginner "tutorial", please do it from the very beginning. Unity Scenes is a new concept and you just jumped in with a scene already in motion it appears.
yo brada it's a beginner shader tutorial. first learn about editor and tools then learn about shaders, that are executed from the gpu
lol mate. Learn Unity first tho
Terrible audio in a good video