Custom Lighting and Toon Shading with Shadows in 10 mins! Unity Shader Graph

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

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

  • @cocolasticot9027
    @cocolasticot9027 3 месяца назад +1

    Fantastic tuto, that perfectly encapsulates my despair 😂

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

    this is a fantastic tutorial that actually explains what each step actually does and how to find more resources for it too. Tho some explanations were missing, i spent half hour figuring i had to put curly brackets in the hlsl shader ^^''.
    Will you some day do a tutorial on how to add additional lights with this method too?

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

      Thanks! its my first tutorial, so its def not perfect!
      I plan on doing additional lighting at some point, and to update this to work with forward+ rendering!

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

    Nice tutorial and also very entertaining!

  • @adrienlebg6653
    @adrienlebg6653 Месяц назад

    Just Incredible men !!!!!!!!!!!!!!! U help me so much!

  • @lucutes2936
    @lucutes2936 9 месяцев назад +2

    any idea how to apply an outline to this shader?

  • @Blietman
    @Blietman 7 месяцев назад

    Great video, thanks! Is it possible to draw only drop shadows without self shadows?

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

    How do you go about lights other than the main one? i dont really see a way to loop through lights in shader graph

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

    tutorial is good but how to add baked shadowmaps?

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

      Thanks!
      I plan on eventually adding to the tutorial, the next update will be on forward+ renderer and additional lighting. Baked shadow maps are on the docket but not for a while!

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

    Thanks, but can you teach me how to make it accept the shadow

  • @gRIO904
    @gRIO904 4 месяца назад

    Great tutorial, but I wasn't able to make the shadows work even though the node arrangement is exactly the one from the tutorial. The keywords seem to do nothing.

    • @spacemicroscope
      @spacemicroscope  4 месяца назад

      Did you set the keywords to global and multi-compile?

    • @gRIO904
      @gRIO904 4 месяца назад

      @@spacemicroscope the global/local setting is missing

    • @gRIO904
      @gRIO904 4 месяца назад

      ​@@spacemicroscope Turns out the problem was I was using an unstable version (Unity 6 preview). Thanks for the tutorial and the answer!

    • @drivehaven
      @drivehaven 25 дней назад

      @@gRIO904 How did you end up fixing it? I also dont have the global / local setting, but im on 6.0.28 which is LTS

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

    Thanks for the great tutorial! Though I didn't get the shadow to work😂. Are all three keywords set to multi compile, global, and default? The last two in the videos are not set to these settings and I feel a bit confused.

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

      You're welcome! Yes they should be, I think I forgot to set them while I was recording, but that's how they're set in my project. Be sure you are multiplying the color by shadow attenuation!

  • @tartess3978
    @tartess3978 Год назад +3

    I have a problem. "Shader error in 'Shader Graphs/Master': syntax error: unexpected token 'Direction' at line 4"
    What did I do wrong?
    My code
    void GetLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float Attenuation)
    #if defined(SHADERGRAPH_PREVIEW)
    Direction = float3(0.5, 0.5, 0);
    Color = 1;
    Attenuation = 1;
    #else
    float4 sCoord = TransformWorldToShadowCoord(WorldPos);
    Light mainLight = GetMainLight(sCoord);
    Direction = mainlight.direction;
    Color = mainlight.color;
    Attenuation = mainLight.shadowAttenuation
    #endif
    Thank you in advance

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

      i'm not sure "#if defined(SHADERGRAPH_PREVIEW)" is proper syntax for cg/hlsl or whatever macro this is
      instead write "#ifdef SHADERGRAPH_PREVIEW"

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

      I'm getting the same issue but changing the syntax didn't fix it. Any other thoughts on what might be causing this? Thanks!! @@spacemicroscope

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

      @@hipperdiscuits I'd need to see full code posted to say anything about it. The above code that @tartess3978 posted has many other mistakes that I didnt see the first time, there are no curly braces and some missing semi colons

    • @DragonitaPurple
      @DragonitaPurple Год назад +3

      Had the same problem and found the solution:
      There needs to be curly brackets{} surrounding the code before the #if and after the #endif

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

      @@spacemicroscope same problen

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

    Great Tutorial!, i have a question, do you know how to add more lights? like point lights anda spot lights.

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

      yes, you need to loop through all of the additional lights in a custom function. I think the method is called GetAdditionalLights(worldPos) or something (its in the shader files i was talking about!)
      The problem with additional lighting in shader graph is that shader graph cant loop, so you have to decide what you want to be calculated in the custom function and give it parameters according your needs.
      I still haven't settled on any single approach for additional lights

  • @诺里德
    @诺里德 Год назад

    ❤that's useful for me,thanks for your share

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

    Nice, thanks! But i don't get it, what should i do to control strength of shadows :D

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

      the gradient controls how dark the surface can get, You don't even have to stick to greyscale!

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

      ​@@spacemicroscope Wow such fast answer o:
      Anyways i did it stupid'ish way by using lerp i.imgur.com/zV2rIe7.png

  • @Xath974
    @Xath974 11 месяцев назад +1

    bravo merci

  • @spacemicroscope
    @spacemicroscope  2 года назад +4

    I can show you the wold