Write A Custom URP Shader Using Unity BRDF

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

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

  • @benjaminswee-shaders
    @benjaminswee-shaders  Год назад +3

    This will be the prelude to URP shaders. I'll cover some of the past lessons I did using this as a new lighting setup. If you have new requests or you want to see one of the older shaders using URP, let me know! I hope you found this helpful. If you want to support my Patreon you can do so here ruclips.net/video/UtwJGnif2OU/видео.html

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

      You could make another tutorial for ocllusion map

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

    omg, you just slapped me in the face. i was messing around with builtin, never ever wrote a shader, mnaged to hack my way through the standard builtin shader with tons of copy paste, but then i have to implement my vertex shader to all other passes, to make the lighting perfect, i do all of that without a damn clue what i am doing lol. BUT what i see here is full mastery of the subject. insane. ill get my hands on this seriously and get to the next level, cause its so cool. really impressed by your ability to identify each problem's root cause with chirurgical precision, and at the speed of light.

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

    That's exactly what I've been searching for!

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

    Thank you for this video! I could not find anywhere on the internet how to make a lit custom URP shader. It seems like they want to force you to use shader graph :/
    Not only you shoved us how to to it, but you also tought us how and where to look to implement your own custom shader. You also explain everything really well.

  • @aleksp8768
    @aleksp8768 6 месяцев назад +1

    Thanks! This is what I was looking for since I'm making a custom fog effect (distance based, not z-depth) but shader graph doesn't let you render unlit parts in a lit shader graph, so I can't make it a solid fog color without lighting... Thankfully with this I can so once again thanks!!!
    I'd say the only thing missing is support for additional lights other than the main directional light
    EDIT: for anyone looking to do the same, here's what worked for me:
    replace this:
    return UniversalFragmentPBR(inputdata, surfacedata);
    with this:
    Light mainLight = GetMainLight(inputdata.shadowCoord, inputdata.positionWS, inputdata.shadowMask);
    half4 color = UniversalFragmentPBR(inputdata, surfacedata);
    int additionalLightsCount = GetAdditionalLightsCount();
    for (int i = 0; i < additionalLightsCount; ++i)
    {
    Light light = GetAdditionalLight(i, inputdata.positionWS, inputdata.shadowMask);
    half nl = saturate(dot(inputdata.normalWS, light.direction));
    color.rgb += light.color * nl * light.distanceAttenuation * surfacedata.albedo;
    }
    return color;

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

    Super helpful. Thank you!

  • @leeoiou7295
    @leeoiou7295 Год назад +7

    Wow. You are really putting in work. There has been a lot of gate-keeping on shader knowledge for too long. Can I ask, what your experience is in compute shaders?

    • @benjaminswee-shaders
      @benjaminswee-shaders  Год назад +1

      Not enough to really teach it. I can do small things like position a lot of small objects or particles. If I were to try to teach it, there would probably be sections I don't fully understand.

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

      @@benjaminswee-shaders Thanks for your reply. Can you do stuff like marching cube/ray marching?

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

    this was great, I was looking for resources to help me manually convert a BRP shader to URP. This should help.

  • @DP-lr4lg
    @DP-lr4lg 7 месяцев назад

    Thanks a lot! You really helped me very much

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

    感谢!

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

    Was hoping to use this to migrate a CRT raster shader I made up to URP for my VR project. And although I get it running I still have the problem that the image is only shown in one of the eyes. I thought this URP thing was supposed to support stereoscopic rendering right out of the box but obviously not.

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

    Amazing description! One minor thing: wouldn't you want to normalize the view direction in the pixel shader instead of the vertex shader, like you did with the normal?

  • @taxi.man9815
    @taxi.man9815 Год назад +1

    Hello, I've been trying to learn writing shaders but unfortunately any tutorials I have looked at don't work in URP. This one gave me hope but even copy pasting the code in the description didn't seem to get me a shader which appeared. Surely I must be doing something wrong.
    I haven't changed anything to the project, it is a base URP 3d project in 2021.3.29f1. Any help would be much appreciated

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

    so we will have to do this every time we want to create a urp shader?

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

    I have a problem that the shader doesn't apply any texture or any color, it's completely transparent unless I made The Render Queue Transparent in unity inspector, but it will only apply the base color but not the main texture

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

      I fixed the problem in the second video

    • @alleyesonme1432
      @alleyesonme1432 6 месяцев назад

      @@glimpsygames2734 Which second video?

    • @glimpsygames2734
      @glimpsygames2734 6 месяцев назад

      @@alleyesonme1432 The second video of this tutorial series : ruclips.net/video/jlQTQmt_A2U/видео.html there is also the third : ruclips.net/video/oLyv3NSpPeg/видео.html

    • @glimpsygames2734
      @glimpsygames2734 6 месяцев назад

      @@alleyesonme1432 Go to his channel, then Playlists, Click on URP Shaders playlist, choose the second video

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

    Invisible in unity 2022.3.2f1

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

      Yes I had to do o.vertex = TransformObjectToHClip(v.vertex); instead of using o.positionWS in the vert block in order to show anything.

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

      @@64jcl hello, I also replaced o.positions with v.vertex, but it's still invisible. Can I ask you for help?