Let There Be Light (And Shadow) | Writing Unity URP Code Shaders Tutorial [2/9] ✔️ 2021.3

Поделиться
HTML-код
  • Опубликовано: 10 ноя 2024

Комментарии • 64

  • @NedMakesGames
    @NedMakesGames  2 года назад +7

    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!

  • @molgeraxproductions6671
    @molgeraxproductions6671 2 года назад +2

    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!

    • @NedMakesGames
      @NedMakesGames  2 года назад

      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!

  • @maxvandoorn7002
    @maxvandoorn7002 Год назад +1

    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!

  • @abraiyan7984
    @abraiyan7984 2 года назад +2

    I have waited too long for this. Thanks, Ned.

    • @NedMakesGames
      @NedMakesGames  2 года назад

      Thanks for your patience! I hope you enjoy the video!

    • @abraiyan7984
      @abraiyan7984 2 года назад

      @@NedMakesGames I did. Cant wait for the next episode!

  • @bots_op
    @bots_op 2 года назад

    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!

  • @brianknox3778
    @brianknox3778 Год назад

    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!

    • @NedMakesGames
      @NedMakesGames  Год назад

      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.

  • @donutdude246YT
    @donutdude246YT 2 года назад +2

    This was great as always! Can’t wait for the next one!

    • @NedMakesGames
      @NedMakesGames  2 года назад +2

      Thank you, Jeff! I'm excited for it too - transparency is always interesting to mess with.

  • @MarekNijaki
    @MarekNijaki 2 года назад

    Ohh man, awesome stuff. Everything was explained clearly. Can't wait for next episode :)

    • @NedMakesGames
      @NedMakesGames  2 года назад +2

      Thank you! It's already in progress!

  • @LeehamsonTheThird
    @LeehamsonTheThird Год назад +1

    these tutorials are honestly great as there is hardly any documentation on urp.

  • @賀客
    @賀客 Год назад +3

    (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)

    • @tuxedoblackfoot
      @tuxedoblackfoot Год назад +1

      Thank you, that did the trick for me. I'm having the same issue.

    • @tuxedoblackfoot
      @tuxedoblackfoot Год назад

      Once I got through the next couple steps, everything seemed to resolve. May be a version update?

  • @jussirautiainen3784
    @jussirautiainen3784 11 месяцев назад

    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 ...

  • @franciszekbarszcz2887
    @franciszekbarszcz2887 2 года назад

    Can't wait to see your next tutorial. Quality content!

    • @NedMakesGames
      @NedMakesGames  2 года назад +1

      Thank you! It should be live in early October!

  • @RenaissanceWen
    @RenaissanceWen Год назад

    This is so COOL!! Thx so much for sharing.

  • @legacycz
    @legacycz 2 года назад

    Thank you, well explained and easy to understand. We need mor tutorials like this. You sir are epic :).

    • @NedMakesGames
      @NedMakesGames  2 года назад

      Thank you, I appreciate it! More are coming!

  • @carlwong1919
    @carlwong1919 2 года назад

    Awsome tutorial that explains things in great details.

  • @7y700-s1u
    @7y700-s1u 11 месяцев назад +1

    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.

  • @borzonstudios8638
    @borzonstudios8638 Год назад +1

    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.

    • @karikakahuate
      @karikakahuate Год назад

      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?

  • @hazelhwang695
    @hazelhwang695 Год назад

    awesome tutorial!

  • @stephapie1612
    @stephapie1612 2 года назад

    Great info Ned 👍 😊

  • @NineSins
    @NineSins 2 года назад +1

    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?

    • @NedMakesGames
      @NedMakesGames  2 года назад +2

      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;

    • @NineSins
      @NineSins 2 года назад +1

      @@NedMakesGames Thanks, can't wait to see part 5 then :)

    • @NedMakesGames
      @NedMakesGames  2 года назад +1

      @@NineSins It will be a really good one I think!

  • @therealtroy8275
    @therealtroy8275 Год назад

    You are amazing!

  • @aleksandrburykh9482
    @aleksandrburykh9482 Год назад

    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?

    • @NedMakesGames
      @NedMakesGames  Год назад

      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.

  • @wagnerdesouza6512
    @wagnerdesouza6512 Год назад

    This ShadowCaster pass is incompatible with SPR Batcher, right?
    Any solution?

  • @Purpbatboi
    @Purpbatboi Год назад +1

    im getting a
    > unrecgonized identifier SurfaceData surfaceInput

    • @aeroniix1489
      @aeroniix1489 3 месяца назад

      #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

  • @karikakahuate
    @karikakahuate Год назад

    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!!😘

    • @NedMakesGames
      @NedMakesGames  Год назад +1

      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?

    • @henrysteven137
      @henrysteven137 Год назад +2

      hey, make sure you do "#define _SPECULAR_COLOR" BEFORE "#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl""

    • @traaara
      @traaara 10 месяцев назад

      @@henrysteven137 Yup this was it. Took me a day to figure this out. Thank you for sharing!

  • @trell_7842
    @trell_7842 2 года назад

    very thanks for your content

  • @crackedcrackeroncracktheii4209
    @crackedcrackeroncracktheii4209 9 месяцев назад

    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 : )

  • @codevisionary
    @codevisionary 2 года назад +1

    Hey ned, is there any way to control the shadow's opacity since it's too dark?

    • @NedMakesGames
      @NedMakesGames  2 года назад

      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!

    • @codevisionary
      @codevisionary 2 года назад

      @@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!

    • @NedMakesGames
      @NedMakesGames  2 года назад

      @@codevisionary I'm glad to hear it worked! The next video is actually going live this Wednesday. I hope you enjoy it!

    • @jonathanliu2476
      @jonathanliu2476 Год назад

      If you turn the Light from baked to realtime, you should be able to change the realtime shadow strength

  • @hibiscusbear
    @hibiscusbear 2 года назад

    really nice 😊

  • @siRrk1337
    @siRrk1337 Год назад

    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.

  • @NightmareAndNinja
    @NightmareAndNinja 2 года назад

    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.

    • @NedMakesGames
      @NedMakesGames  2 года назад

      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?

    • @NightmareAndNinja
      @NightmareAndNinja 2 года назад

      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

    • @NedMakesGames
      @NedMakesGames  2 года назад +1

      @@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.

  • @Rafaelcraftero
    @Rafaelcraftero 2 года назад

    the algorithm brings me here, idk why but ok

    • @NedMakesGames
      @NedMakesGames  2 года назад +1

      Haha, don't try to understand the algorithm! Thanks for the comment anyway!