Hi everyone! I hope you enjoyed this tutorial. Check out the video description for links to the rest of the series! I recorded the audio for this video while recovering from a sinus infection, and my voice barely held strong 😆Thank you for putting up with the occasional crackle!
Though I have conquered many shader challenges the past months, most of it was more of a "making physics and math that looks cool". This video is the first one I have seen that tackles such a large range of technicalities, like hash-ifs, multicompiling, differences between passes, varients and the likes. Such a comprehensive and pleasant overview of the "less fun stuff" is something I really needed, thank you for this!
Hi, thank you! I wanted to make a series kind of walking through the creation of a standard shader, and I'm glad to hear it's helpful. I guess it's not so flashy, but luckily I enjoy technical writing! Thanks for watching!
Damn, this is the single most useful tutorial series on PBR shading out there. You explained in this video what took me multiple weeks to gather from all over the place. Incredibly well done, I hope you finish this tutorial series as I've got a lot to learn still too!
Really impressed with the level of quality and depth you go in with urp shaders! Easily the best source for how to write shaders in urp and how the graphics pipeline works. I have been wanting to learn more about the graphics pipeline and trying to find more advanced shader tutorials that go more in depth. This is AMAZING!
I see you've only gotten 3 of 9 videos done for this. I'm a source-code $10 patron of yours now, and what you've gotten done so far is well worth a few more months of patronage -- but I'd like to remain your long term patron if you can deliver at least one new tutorial per month. Your videos here are very useful! Thank you for existing, and for choosing to help out everyone else!
Hi, thank you so much for the support! My goal is a tutorial every month, but it's difficult to promise that. I don't want to rush these and have been quite busy at my day job lately. No hard feelings whatever you decide to do, I just appreciate your choosing to support me at all.
(Unity version 2022.3.5) I'm not sure isn't my misunderstanding or some version different when I add lightingInput.shadowCoord = TransformWorldToShadowCoord(input.positionWS); and #pragma multi_compile _ _MAIN_LIGHT_SHADOWS it would't see the shadow on my obj. (i don't see the option to close cascade) it must be add #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE (didn't need #pragma multi_compile _ _MAIN_LIGHT_SHADOWS) that shadows will show up ( If someone know what happen on that, please tell me)
Echoing all the comments below this is really good stuff ... looking forward to more and more and more videos ... we need more videos ... explanations are clear and to the point ... it seems incredible to me that Unity does not produce anything like this at all ... their documentation is really horrible ... for a game engine that likes to have noob customers they are not doing a good job... looks like this is where you come in .. it is mainly because of talents like you that I chose Unity as my main platform ... I wish Unity would take better care of us .. the community is fantastic ...
Hello, I am using Unity 2022.3.8 and I saw another comment using #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE in order to get the shadows to show up, however even when I do this, I have no shadows. How do I fix this? My code up until that point is the exact same as the tutorial.
Have replicated your code for specular and all works fine except for the camera movement. Seems like cam position does not affect where the specular highlight is. Tried looking around if I could find a fix but got stuck on it, I'll get back to it next time but in the meanwhile if you have some suggestion of why the same code might not work shout! Thx It definitely sounds like I made a mistake somewhere, but I get no unity console errors or warnings and everything apart from that seems to work ok.
Hi, to me it happens the same, I defined _specular_color and still not working. I watched a lot of times that part and also compared with his code on github and was the same and still not working. Could you fis yours?
Hi! I've been looking for an answer in this video, but didn't find it here either, I'm using UniversalFragmentBlinnPhong for my compute shader generated grass, and when I've recently added a day-night cycle, I noticed it's not affected at all by ambient light, how do I make it work?
Hi Tomasz! This is because we don't sample lightmaps or lightprobes in this shader. Not yet at least - we will focus on this in part 5. For now, you can access the ambient lighting through the scene's default light probe values. Add this color to the output of UniversalBlinnPhong, like this float4 color = UniversalBlinnPhong(...); color.rgb += float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); return color;
Hey Ned. Implemented Lit material according to this lesson of yours. In general, everything is fine, but the shadows that fall on this material are very dark. As if in deep space, where the only source of light is the sun and everything that is obscured from it is in absolute darkness. Can you advise how to solve this problem? Regular URP materials in the same situation are also affected by global illumination, how to make it affect your material as well?
Hi! This is basically because we won't support lightmaps or ambient lighting yet. We will be covering it in part five of the series, which I'm working on now! Unfortunately, it's really not simple to just add support - I would end up reciting the tutorial script! You can kind of improve shadow darkness by adding a fraction of the albedo color to emission. Add this line before calling UniversalBlinnPhong: surfaceInput.emission = surfaceInput.albedo * 0.2; Of course, you can change the multiplier to anything that suits your game.
Hi! Amazing tutorial series!! Thanks so much!! I am stuck in the part of the specular light, I defined _specular_color and still not working. I don't know why. Please vould you do it not automatic. Thanks!!😘
Hi! Just to be sure, caps do matter, so it should be "_SPECULAR_COLOR" There are reference scripts in the video description you can check to rule out any typos! But if it still doesn't work, what version of Unity are you using?
Does anyone know if it would be possible to render the shadows and lights of a mesh without rendering the model itself? If so could anyone give me a quick explanation. Thank you : )
Hi! We will fix this later on in the series by using baked lighting, but there is a quick trick you can try. The SurfaceData struct has an emission field which acts like a color added to the final lit color. You can set that to the albedo times some multiplier, which will lighten shadows a bit!
@@NedMakesGames Thank you very much for replying.. The logic works!, By the way, When are you going to make the next video on the series... can't wait for it!
okay how is this so badly supported in visual studio? bad highlighting, no auto format, no refactoring, even my copilot got a stroke. i tried HLSL Tools for VS, it adds some more highlighting, but has other problems. This is pain :X video great btw.
What's up with the video? It's solid white for a while and turns to a static image with text, "We explore diffuse light" and an image. The audio suggests there's some live video illustrating but there is not.
That's strange, and definitely not intended. The video seems to be working fine for me though. Can you tell me what timestamp you see the glitches and with what quality setting?
I've tested on two devices. Android mobile device at 480p and Windows on Chrome at 1080p 60. Same result. It is persistent throughout the video. It's just solid white an turns to the text
@@NightmareAndNinja It seems, for some reason, RUclips is mixing this video with the Shorts version for you ( ruclips.net/video/QMtgB6yvvsU/видео.html ). The text "We explore diffuse light," never appears in this video, only in the short. I refreshed some metadata to hopefully get RUclips to wake up... Sorry about this.
Hi everyone! I hope you enjoyed this tutorial. Check out the video description for links to the rest of the series!
I recorded the audio for this video while recovering from a sinus infection, and my voice barely held strong 😆Thank you for putting up with the occasional crackle!
Though I have conquered many shader challenges the past months, most of it was more of a "making physics and math that looks cool". This video is the first one I have seen that tackles such a large range of technicalities, like hash-ifs, multicompiling, differences between passes, varients and the likes. Such a comprehensive and pleasant overview of the "less fun stuff" is something I really needed, thank you for this!
Hi, thank you! I wanted to make a series kind of walking through the creation of a standard shader, and I'm glad to hear it's helpful. I guess it's not so flashy, but luckily I enjoy technical writing! Thanks for watching!
Damn, this is the single most useful tutorial series on PBR shading out there. You explained in this video what took me multiple weeks to gather from all over the place.
Incredibly well done, I hope you finish this tutorial series as I've got a lot to learn still too!
Except it's not PBR
I have waited too long for this. Thanks, Ned.
Thanks for your patience! I hope you enjoy the video!
@@NedMakesGames I did. Cant wait for the next episode!
Really impressed with the level of quality and depth you go in with urp shaders! Easily the best source for how to write shaders in urp and how the graphics pipeline works. I have been wanting to learn more about the graphics pipeline and trying to find more advanced shader tutorials that go more in depth. This is AMAZING!
Thank you, that's very kind!
I see you've only gotten 3 of 9 videos done for this. I'm a source-code $10 patron of yours now, and what you've gotten done so far is well worth a few more months of patronage -- but I'd like to remain your long term patron if you can deliver at least one new tutorial per month. Your videos here are very useful! Thank you for existing, and for choosing to help out everyone else!
Hi, thank you so much for the support!
My goal is a tutorial every month, but it's difficult to promise that. I don't want to rush these and have been quite busy at my day job lately. No hard feelings whatever you decide to do, I just appreciate your choosing to support me at all.
This was great as always! Can’t wait for the next one!
Thank you, Jeff! I'm excited for it too - transparency is always interesting to mess with.
Ohh man, awesome stuff. Everything was explained clearly. Can't wait for next episode :)
Thank you! It's already in progress!
these tutorials are honestly great as there is hardly any documentation on urp.
(Unity version 2022.3.5)
I'm not sure isn't my misunderstanding or some version different
when I add
lightingInput.shadowCoord = TransformWorldToShadowCoord(input.positionWS);
and
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
it would't see the shadow on my obj.
(i don't see the option to close cascade)
it must be add
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
(didn't need #pragma multi_compile _ _MAIN_LIGHT_SHADOWS)
that shadows will show up
( If someone know what happen on that, please tell me)
Thank you, that did the trick for me. I'm having the same issue.
Once I got through the next couple steps, everything seemed to resolve. May be a version update?
Echoing all the comments below this is really good stuff ... looking forward to more and more and more videos ... we need more videos ... explanations are clear and to the point ... it seems incredible to me that Unity does not produce anything like this at all ... their documentation is really horrible ... for a game engine that likes to have noob customers they are not doing a good job... looks like this is where you come in .. it is mainly because of talents like you that I chose Unity as my main platform ... I wish Unity would take better care of us .. the community is fantastic ...
Can't wait to see your next tutorial. Quality content!
Thank you! It should be live in early October!
This is so COOL!! Thx so much for sharing.
Thank you, well explained and easy to understand. We need mor tutorials like this. You sir are epic :).
Thank you, I appreciate it! More are coming!
Awsome tutorial that explains things in great details.
Thank you, that was my goal! 😄
Hello, I am using Unity 2022.3.8 and I saw another comment using #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE in order to get the shadows to show up, however even when I do this, I have no shadows. How do I fix this? My code up until that point is the exact same as the tutorial.
Have replicated your code for specular and all works fine except for the camera movement. Seems like cam position does not affect where the specular highlight is.
Tried looking around if I could find a fix but got stuck on it, I'll get back to it next time but in the meanwhile if you have some suggestion of why the same code might not work shout! Thx
It definitely sounds like I made a mistake somewhere, but I get no unity console errors or warnings and everything apart from that seems to work ok.
Hi, to me it happens the same, I defined _specular_color and still not working. I watched a lot of times that part and also compared with his code on github and was the same and still not working. Could you fis yours?
awesome tutorial!
Great info Ned 👍 😊
Thanks for watching!
Hi! I've been looking for an answer in this video, but didn't find it here either, I'm using UniversalFragmentBlinnPhong for my compute shader generated grass, and when I've recently added a day-night cycle, I noticed it's not affected at all by ambient light, how do I make it work?
Hi Tomasz! This is because we don't sample lightmaps or lightprobes in this shader. Not yet at least - we will focus on this in part 5.
For now, you can access the ambient lighting through the scene's default light probe values. Add this color to the output of UniversalBlinnPhong, like this
float4 color = UniversalBlinnPhong(...);
color.rgb += float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
return color;
@@NedMakesGames Thanks, can't wait to see part 5 then :)
@@NineSins It will be a really good one I think!
You are amazing!
Hey Ned. Implemented Lit material according to this lesson of yours. In general, everything is fine, but the shadows that fall on this material are very dark. As if in deep space, where the only source of light is the sun and everything that is obscured from it is in absolute darkness. Can you advise how to solve this problem? Regular URP materials in the same situation are also affected by global illumination, how to make it affect your material as well?
Hi! This is basically because we won't support lightmaps or ambient lighting yet. We will be covering it in part five of the series, which I'm working on now!
Unfortunately, it's really not simple to just add support - I would end up reciting the tutorial script!
You can kind of improve shadow darkness by adding a fraction of the albedo color to emission. Add this line before calling UniversalBlinnPhong:
surfaceInput.emission = surfaceInput.albedo * 0.2;
Of course, you can change the multiplier to anything that suits your game.
This ShadowCaster pass is incompatible with SPR Batcher, right?
Any solution?
im getting a
> unrecgonized identifier SurfaceData surfaceInput
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
Hi! Amazing tutorial series!! Thanks so much!! I am stuck in the part of the specular light, I defined _specular_color and still not working. I don't know why. Please vould you do it not automatic. Thanks!!😘
Hi! Just to be sure, caps do matter, so it should be "_SPECULAR_COLOR"
There are reference scripts in the video description you can check to rule out any typos!
But if it still doesn't work, what version of Unity are you using?
hey, make sure you do "#define _SPECULAR_COLOR" BEFORE "#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl""
@@henrysteven137 Yup this was it. Took me a day to figure this out. Thank you for sharing!
very thanks for your content
Does anyone know if it would be possible to render the shadows and lights of a mesh without rendering the model itself? If so could anyone give me a quick explanation. Thank you : )
Hey ned, is there any way to control the shadow's opacity since it's too dark?
Hi! We will fix this later on in the series by using baked lighting, but there is a quick trick you can try. The SurfaceData struct has an emission field which acts like a color added to the final lit color. You can set that to the albedo times some multiplier, which will lighten shadows a bit!
@@NedMakesGames Thank you very much for replying.. The logic works!, By the way, When are you going to make the next video on the series... can't wait for it!
@@codevisionary I'm glad to hear it worked! The next video is actually going live this Wednesday. I hope you enjoy it!
If you turn the Light from baked to realtime, you should be able to change the realtime shadow strength
really nice 😊
Thank you! 🐻
okay how is this so badly supported in visual studio? bad highlighting, no auto format, no refactoring, even my copilot got a stroke. i tried HLSL Tools for VS, it adds some more highlighting, but has other problems. This is pain :X
video great btw.
What's up with the video? It's solid white for a while and turns to a static image with text, "We explore diffuse light" and an image. The audio suggests there's some live video illustrating but there is not.
That's strange, and definitely not intended. The video seems to be working fine for me though. Can you tell me what timestamp you see the glitches and with what quality setting?
I've tested on two devices. Android mobile device at 480p and Windows on Chrome at 1080p 60. Same result. It is persistent throughout the video. It's just solid white an turns to the text
@@NightmareAndNinja It seems, for some reason, RUclips is mixing this video with the Shorts version for you ( ruclips.net/video/QMtgB6yvvsU/видео.html ). The text "We explore diffuse light," never appears in this video, only in the short. I refreshed some metadata to hopefully get RUclips to wake up... Sorry about this.
the algorithm brings me here, idk why but ok
Haha, don't try to understand the algorithm! Thanks for the comment anyway!