Hi everyone, thanks for watching and commenting! I just wanted to let you know that if you're on an Apple platform using Metal, which includes most products released in the last few years, this geometry shader will not work. In fact, no geometry shader will work, even in the editor. However, the vertex-fragment part of this tutorial will work, and is useful to know. So, keep this in mind! If you'd like to know how to write something like this that will work on all platforms, check out this video on compute shaders: ruclips.net/video/EB5HiqDl7VE/видео.html
I know the focus here was Geometry shaders but this ended up being one of the best, comprehensive overviews of both a generic shader pipeline and a description of the Unity boilerplate/standard shader lines. Great work Ned!
Awesome, thanks u so much for the tutorial ! , I don't like creating shaders :), but somehow the video was supperb... Which made me feel like I can too write shaders !!!! , Thanks..
In 2021.2.0f1 Throws error: Shader error in 'Custom/PyramidFaces': 'UniversalFragmentBlinnPhong': no matching 6 parameter function at ( return UniversalFragmentBlinnPhong(lightingInput, albedo, 1, 0, 0, 1); )
Unity must have changed the arguments for that function in 2021.2. I’m away from my computer right now, but you can check the source code if you need to. UniversalFragmentBlinnPhong is near the bottom of the URP/ShaderLibrary/Lighting.hlsl file.
It takes 7 arguments now. But that function is deprecated anyways. Instead use UniversalFragmentBlinnPhong(InputData inputData, SurfaceData surfaceData)
Hey, great shading tutorial on URP! Love it! I only wish Unity had a in depth documentation for it. I have a question, I'm using only the Vertex and Fragment shader. i've even managed to use my own maths code into it. But I have a problem, Everything is fine until we add the second render pass for casting shadows, when I add that render pass, the objects on which the shader has been applied to, appear to have each vertex reacting to it, and I don't want that. i've tried changing the code in the lighting.hlsl but I can't seem to figure it out?
Hi, thank you! I'm glad it's helped you out. Sorry, I'm not sure what you mean by "have each vertex reacting to it," do you mean that everything casts a shadow but that's not what you want? You can use the SHADOW_CASTER_PASS keyword to change some logic in your shadow caster pass. It will work in the vertex stage as well.
@@NedMakesGames Hi, what's happening is, that it looks like a line of shadow is being casted throughout the surface of the applied mesh. I think it's something to do with the Phong shading function the Lighting.hlsl. Is there any way I could send you a visual representation? That can clear things out. Maybe via email, or the channel's discord server? oh nvm, i'll ask on the discord server :) Thanks
Hi! I don't think there's a way to do that in Unity. You'll need to write a "Frankenstein" shader and copy/paste the lit and shadow caster passes from the shaders you'd like to use. There is a "UsePass" ShaderLab tag, which can automatically grab passes from other shader files.
Do you know how geometry shaders are performing on tile based GPUs like the Quest 2 GPU? It should definitely be possible, but I am more interested in the performance impact it could have :)
I generally avoid geometry shaders now, because they aren't very performant and aren't well supported. Tile-based GPUs will probably suffer from requiring an additional render step before binning. That said, it's always worth building a test to benchmark. I imagine that a compute or CPU-based solution will be faster though.
The shader is great, but it won't cast shadow in the test, receive shadow is alright.I'm using 2020.2 Is there any setting i made it wrong?or the URP version issue? Thank you
Hi, thanks! I would guess there is a problem in your shadow casting pass. Compare your shader with the sample scripts in the video description to see if you made a typo! Otherwise, make sure cast shadows is enabled on your mesh renderer component.
@@NedMakesGames I think it would be great if you explain in a calm way all the shader steps. G asembly, vertex, tesellation, geometry, interpolator, fragment etc. Just with lines and boxes. Not showing a big incloude file from the first moment. You video is Ok but too fast to folllow specially if u have no experience in shaders. For example in a geometry shader or tesellariom shader what is the mission of the vertex shader? I have the oportunity to move the vertex twice? Before and after the tesellation? Etc.. I think in these kimd or videos the clear concepts even how the hardware works at each step is much more important than the code. And the at the end of you show code it should be very simple and short. Just my opinion :) i am not an expert to tell anybody what to do
Hi everyone, thanks for watching and commenting!
I just wanted to let you know that if you're on an Apple platform using Metal, which includes most products released in the last few years, this geometry shader will not work. In fact, no geometry shader will work, even in the editor. However, the vertex-fragment part of this tutorial will work, and is useful to know. So, keep this in mind! If you'd like to know how to write something like this that will work on all platforms, check out this video on compute shaders: ruclips.net/video/EB5HiqDl7VE/видео.html
I know the focus here was Geometry shaders but this ended up being one of the best, comprehensive overviews of both a generic shader pipeline and a description of the Unity boilerplate/standard shader lines. Great work Ned!
Thank you, I really appreciate it! I'm writing a new series on that topic if you'd like more of that: ruclips.net/video/KVWsAL37NGw/видео.html
So cool !! Thanks for making all of these video !
I wish THIS was my first shader lesson...
Awesome, thanks u so much for the tutorial ! , I don't like creating shaders :), but somehow the video was supperb... Which made me feel like I can too write shaders !!!! , Thanks..
In 2021.2.0f1 Throws error: Shader error in 'Custom/PyramidFaces': 'UniversalFragmentBlinnPhong': no matching 6 parameter function at ( return UniversalFragmentBlinnPhong(lightingInput, albedo, 1, 0, 0, 1); )
Unity must have changed the arguments for that function in 2021.2. I’m away from my computer right now, but you can check the source code if you need to. UniversalFragmentBlinnPhong is near the bottom of the URP/ShaderLibrary/Lighting.hlsl file.
It takes 7 arguments now. But that function is deprecated anyways. Instead use UniversalFragmentBlinnPhong(InputData inputData, SurfaceData surfaceData)
Did you solve it?
Trying to watch this video, but oof, that music is a bit much!
Aw sorry, but thanks for the feedback! I'm always looking to improve my videos' audio balance.
well explained and presented. thank you.
Hey, great shading tutorial on URP! Love it! I only wish Unity had a in depth documentation for it.
I have a question, I'm using only the Vertex and Fragment shader. i've even managed to use my own maths code into it. But I have a problem, Everything is fine until we add the second render pass for casting shadows, when I add that render pass, the objects on which the shader has been applied to, appear to have each vertex reacting to it, and I don't want that. i've tried changing the code in the lighting.hlsl but I can't seem to figure it out?
Hi, thank you! I'm glad it's helped you out.
Sorry, I'm not sure what you mean by "have each vertex reacting to it," do you mean that everything casts a shadow but that's not what you want? You can use the SHADOW_CASTER_PASS keyword to change some logic in your shadow caster pass. It will work in the vertex stage as well.
@@NedMakesGames Hi, what's happening is, that it looks like a line of shadow is being casted throughout the surface of the applied mesh. I think it's something to do with the Phong shading function the Lighting.hlsl. Is there any way I could send you a visual representation? That can clear things out. Maybe via email, or the channel's discord server? oh nvm, i'll ask on the discord server :) Thanks
This might seem off topic but do you know how to use different shaders for the lighting and shadowcasting phase?
Hi! I don't think there's a way to do that in Unity. You'll need to write a "Frankenstein" shader and copy/paste the lit and shadow caster passes from the shaders you'd like to use. There is a "UsePass" ShaderLab tag, which can automatically grab passes from other shader files.
Do you know how geometry shaders are performing on tile based GPUs like the Quest 2 GPU? It should definitely be possible, but I am more interested in the performance impact it could have :)
I generally avoid geometry shaders now, because they aren't very performant and aren't well supported. Tile-based GPUs will probably suffer from requiring an additional render step before binning.
That said, it's always worth building a test to benchmark. I imagine that a compute or CPU-based solution will be faster though.
really thank you for tutorial
Nice video, but code written shader seems very complicated.
They can be intimidating, but they tend to follow a formula. So it gets easier once you get that down. Thanks for watching!
The shader is great, but it won't cast shadow in the test, receive shadow is alright.I'm using 2020.2
Is there any setting i made it wrong?or the URP version issue?
Thank you
Hi, thanks!
I would guess there is a problem in your shadow casting pass. Compare your shader with the sample scripts in the video description to see if you made a typo! Otherwise, make sure cast shadows is enabled on your mesh renderer component.
Awesome !
Soooo helpful
👌👌👌👌
Wow i think is difficult to explain in more ofuscated :(
Sorry, I try to be clear! What gave you trouble?
@@NedMakesGames I think it would be great if you explain in a calm way all the shader steps. G asembly, vertex, tesellation, geometry, interpolator, fragment etc. Just with lines and boxes. Not showing a big incloude file from the first moment. You video is Ok but too fast to folllow specially if u have no experience in shaders. For example in a geometry shader or tesellariom shader what is the mission of the vertex shader? I have the oportunity to move the vertex twice? Before and after the tesellation? Etc.. I think in these kimd or videos the clear concepts even how the hardware works at each step is much more important than the code. And the at the end of you show code it should be very simple and short. Just my opinion :) i am not an expert to tell anybody what to do
cool :D