What Are Shaders?

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

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

  • @daggawagga
    @daggawagga 7 лет назад +359

    This is the best shader high level intro I've ever seen. So many introductions are either not succint or focus too much on something too specific for a intro.

  • @TehBurek
    @TehBurek 7 лет назад +174

    Kudos for drawing attention to independent and parallel execution of shader code, as someone who teaches this stuff in computer graphics class, I want to stress that also. That answers many questions from people coming from "regular" CPU programming and adjusting to this, like "why can't I pass a variable to next pixel?" or "why's there no random function?", etc. Shaders are (mostly) meant to be fire-and-forget, no waiting around, no syncing with each other, otherwise the performance would crumble. This way, you can have massive parallelism, litereally thousands of real hardware threads running simultaneously, without worrying about it.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 7 лет назад +2

      Also note the difference between a real-time shading language (like GLSL) versus one for non-real-time use (e.g. OpenShadingLanguage, OSL). The latter does indeed have a random function, only it calls it “noise”.
      Another fun concept in OSL is that of a “material closure”. This is how you define the characteristics of the material independent of the actual lighting. For example, you have built-in closure functions for microfacet, refraction etc, which you can combine in your own arithmetic expressions, and leave it to the renderer to work out the actual lighting at each pixel.

  • @YuliyaTheLoner
    @YuliyaTheLoner 5 лет назад +3

    43 people are from Australia and clicked thumbs up, but it came out upside down

  • @umeshkumarasamy6608
    @umeshkumarasamy6608 5 лет назад +6

    Where were you all this time?
    I've been looking everywhere
    for knowledge about shade
    and you've shown me the light

  • @slowdragon4169
    @slowdragon4169 7 лет назад +1

    i dont know how but you nailed the timing of publishing this video. Just in time. Like some superhero.

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

    You have an amazing way with words! Easy, EASY to align my thought process with what you're saying. I specifically thought the word "Bucket" and you said it less than 2 seconds later.

  • @thoomhy
    @thoomhy 7 лет назад +1

    For the checkerboard code, you can just do:
    If( x+y%2==0) {
    Black();
    }else{
    white();
    }
    At 2:04 You don't need all those conditions.

    • @NeoShameMan
      @NeoShameMan 7 лет назад

      Tom l
      Assignments do it without If because GPU don't like, hint exploit the modulo, an add and a mul, remember what multiplying by zero do.

    • @oahda
      @oahda 7 лет назад

      col.rgb = (x + y) % 2; 🐱

    • @NeoShameMan
      @NeoShameMan 7 лет назад

      Ava Skoog try (x^y)&1, since you are more advanced

    • @oahda
      @oahda 7 лет назад

      Oh, that's so clever! Because the last bit keeps alternating between 0 and 1. Really cool.

    • @James192p
      @James192p 7 лет назад

      It's best to avoid if conditions in shaders. While modern GPUs are a lot better at handling this, they don't have an actual ALU circuitry for every cores/SMs. So basically, the GPU renders BOTH conditions, and then at the end decide which one to pick. So, for every if condition, you render twice... sometimes you don't have a choice to have an if condition, but many times they are other ways to code things to avoid them, and this is where experience comes into play. The good news, is that the web is filled with examples, and there is a lot to learn from.

  • @allansh828
    @allansh828 7 лет назад

    nice to see people willing to sponsor this channel

  • @dealloc
    @dealloc 7 лет назад +28

    I think it's important to distinguish between the two kinds of shaders. Namely the vertex and fragment. Where fragment shaders are done for every pixel (therefore also known as a pixel shader), vertex shaders are done on every vertex. The order of the shaders are also key; Fragment shaders are applied _after_ Vertex shaders.
    So in this video the pixel shading (colors changing) are fragment shaders, whereas cell shading (toon shading) uses vertex shading, since they have to extrude from the model in order to make the outline around the models. The color of the outline are then applied by the fragment shader.

    • @NeoShameMan
      @NeoShameMan 7 лет назад +2

      ui_wizard
      Wind waker don't have outline, borderland do it as a (fragment) post process, and okami just use a reverse shell since ps2 don't have shader... It's not always vertex like afro samurai, which push the second pass vertex along the normal by flattening it in the view direction.

    • @Blendedasian
      @Blendedasian 7 лет назад +1

      ui_wizard the technique you mentioned uses the vertex shader to upscale a pitch black copy of the model that stays right behind the normally drawn one like a bigger shadow.
      But this was used mostly in earlier games because it was cheap in processing power.
      The newer installments use one or a combination of the 2 techniques:
      - Interpolate normals from vertex shader and set any pixel with angle over a certain threshold to pitch black using fragment shader
      - Edge detect using sobel/laplace/whatever algorithm you prefer and overlay as a post processing effect on fragment shader.
      I also remember someone mentioning in forums a technique where a depth-map (z values) of the screen was edge-detected and overlayed to the render to make the lines.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 7 лет назад +2

      There are more than two kinds.

    • @clodgozon3968
      @clodgozon3968 5 лет назад

      Well, there are more than that, but fragment and vertex shaders are often used than those aren't mentioned.

    • @zoriiginalx7544
      @zoriiginalx7544 5 месяцев назад

      I would like to say that fragment shaders can be done multiple times per pixel in the cases where there’s transparency (so the same pixel can have multiple geometric fragments it needs to do processing on) or if whatever reason your GPU decides to do depth tests after the fragment shader has finished running instead of directly after rasterization. Thus, making the word ‘fragment’ in fragment shader a more reasonable and appropriate naming than pixel shader IMO

  • @GingerAle611
    @GingerAle611 4 года назад

    Wow. Finally I got an understanding what is shaders.
    It's a piece of code, in which you put every pixel of an object, related to this shader. It makes some calculations, depends on what nodes you put inside. Then it returns a color value for these pixels, to render it on screen.

  • @safebox36
    @safebox36 7 лет назад +202

    _doing Computer Graphics assignment_
    Me: The f*** is a shader?
    TheHappyCat: _this video_

    • @kingarthurthethirdthst3804
      @kingarthurthethirdthst3804 7 лет назад +3

      Holy shit, literally the same thing happened to me. Just started a graphics course and by the time I hit shaders this video came out.

    • @Interestingworld4567
      @Interestingworld4567 7 лет назад

      If you want to know 100% what is a SHATER. just go to the "NVIDIA" CHANNEL THEY have a better video of 2 hour explanation how a shator work.

    • @Collidedatoms
      @Collidedatoms 7 лет назад

      Francisco: Would you mind posting a link to the video?

    • @Erlisch1337
      @Erlisch1337 6 лет назад +3

      wtf is a shater/shator tho? xD

    • @tuxmusicman
      @tuxmusicman 6 лет назад +1

      When you go through a whole Computer Graphics class without learning about shaders because your professor uses the old version of openGL . . .

  • @scapegoat079
    @scapegoat079 3 года назад

    "Have a happy day wherever you are"
    What a sweet way to sign off on a video hahaha.
    YOU have a happy day

  • @ewaldikemann4142
    @ewaldikemann4142 7 лет назад +2

    Very nice intro into a very complex theme. Even when it comes shading of objects in a 3d space with multiple light sources and various calculation techniques.
    I'm looking forward to the next part - thumps up!

  • @johnhammer8668
    @johnhammer8668 4 года назад +3

    Thanks for precisely pointing out pixel shader is a function applied to all pixels which takes position as the argument and does not depend on the adjacent pixels.
    Are all the other shaders also depened only on the postion and does not care about the values of other entities ?

  • @carterpryor3880
    @carterpryor3880 7 лет назад +4

    Seeing your videos on things like this make me really want to get up and experiment! Thanks for another awesome video!

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

    Love your videos. You sum up even complex subjects so nicely. Not so nerdy and not so shallow.

  • @TheMahotizer
    @TheMahotizer 4 года назад +4

    I just discovered your channel, and I’m so happy RUclips recommended it to me. I’m a design student in college and a lot of things that are interesting to me are jam packed into this video. I also love how you take time to explain various concepts in detail

  • @NiemandKatzchen
    @NiemandKatzchen 7 лет назад +2

    I wish that this video existed when I first started learning shaders, very good high level introduction and explanation.

  • @ImTheBestJamie
    @ImTheBestJamie 7 лет назад +3

    Ive always liked lighting in games as far as graphics are concerned, so its interesting to learn whats actually happening. Im looking forwards to the code :)

  • @16rosati
    @16rosati 5 лет назад +2

    Visual node based shader editors are available and they make the learning process a lot more user friendly!

  • @l4nzel0d
    @l4nzel0d 3 года назад +1

    That was actually helpful. Now I finally understand what shaders are 👏🔥

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

    Wow I've just discovered your channel. Your explanation is so neat and easy to understand.

  • @massivewon
    @massivewon 4 года назад +1

    Never worked with shaders before, but this was a fantastic video. I learned a lot! Subscribed.

  • @delchavez
    @delchavez 4 года назад

    Your videos are always so enlightening. You do a great job of explaining stuff that might otherwise be very difficult to understand.

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

    Stellar explanation! Thanks a lot. 💜

  • @wiigame3401
    @wiigame3401 5 лет назад

    I'm a very young (10 years old), game developer using unity. I really enjoy your creative computer content that helps me (even though you're not using unity)when I have a question. I just wish you can upload again. :-)

  • @man_vs_life
    @man_vs_life 4 года назад

    For a long time I had in the back of my mind just what the heck a "shader"was. Now I have some grasp of it, thank you.

  • @Bretana
    @Bretana 4 года назад

    As someone that knows nothing about shaders, this was incredibly easy to understand. Thanks for this!

  • @ddud4966
    @ddud4966 7 лет назад +22

    I always wish Photoshop had a shader language like Maya Hypershader except for 2D layers, that would be so powerful compared to their fixed blending options.

  • @ronald111001
    @ronald111001 7 лет назад +1

    I love your intellectual thought process

    • @BbXxQQ
      @BbXxQQ 7 лет назад +1

      u falling in love too, Mr. Ronald57?

  • @guiguiregismercer5720
    @guiguiregismercer5720 7 лет назад +2

    Loved it, please make more video about shaders, lighting and techniques! Thanks

  • @zikomo8913
    @zikomo8913 4 года назад

    Another great channel, never knew Game Dev RUclips has such great content, better late then never!

  • @robin_be
    @robin_be 7 лет назад

    This video is more about what is a pixel shader (or fragment shader). They are the most common (I guess), but I think you should've told that there are more types of shaders than just that just to prevent confusion.

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

    Too many games are definitely using the phong model cuz in a lot of games, things are weirdly too shiny.

  • @bocanica1
    @bocanica1 7 лет назад

    Thank you so much! This had me exited for my next laboratory for the computer graphics course which happens to be about shaders :D

  • @low-key-gamer6117
    @low-key-gamer6117 3 года назад +1

    Hi,
    I have Linux and somehow the Intel open source driver is not giving me the option to adjust contrast and my colours looks washed, can I use a shader with my existing X11 compositor to get more contrast?

  • @ipoh1213
    @ipoh1213 4 года назад

    Glad to watch this.

  • @Retrofire-47
    @Retrofire-47 3 года назад

    this was an awesome explanation

  • @deinemamainhd
    @deinemamainhd 7 лет назад

    Awesome. Please more videos about basics like this.

  • @freezn6287
    @freezn6287 7 лет назад +1

    I know im late to this video but I would like to see how refraction shaders work! plz!

  • @NOF4C3
    @NOF4C3 7 лет назад

    Hey you are really good at explaining things that even us non programmer understand a bit 👏👏👏👏 and can I ask can you make something about rigid bodies ?

  • @mdjoy8037
    @mdjoy8037 3 года назад

    Thanks, your voice is so good

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

    Great Video and topic explanation 🙌🏼🔥🔥🔥⚡

  • @tromino2598
    @tromino2598 7 лет назад

    That actually makes a lot of sense. Huh.
    You did a good job explaining it so far. I want to see what you have to say in your future videos on the topic. :p

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

    doesnt ddx ddy gives you acess to the previous pixels? color in frag and vertex height in vert

  • @oraz.
    @oraz. 6 лет назад

    This is the best ever shader video!

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

    Madam, you really need to update that thumbnail. I find the thumbnail as an old, Indian tutorial-style boring video. But the video itself is sooo great, it answers all my questions.
    I recommend you to use some thumbnail with more colour, I think a colourful thumbnail will make it looks better and eye-catching
    also OMG this video is so great, its a masterpiece :D
    Thank you sooo much, it's really helpful to me and anyone else

  • @callum5765
    @callum5765 7 лет назад +1

    This is great I would be interested in knowing the differences and intro into HLSL and GLSL and how to utilize a pbr shading model based on brdf lighting (in code / the techniques not UE4 Material editor).

  • @bamsgian9759
    @bamsgian9759 6 лет назад

    how could I detect specified object rather than colors? for example I want to apply water shaders, I must choose blue color bcoz the water is blue, but I won't let shaders affected to another blue color.

  • @abuzzedwhaler7949
    @abuzzedwhaler7949 6 лет назад +6

    Damn, I'm a CG artist, and I couldn't have said it better myself!

  • @zugolf4980
    @zugolf4980 5 лет назад +2

    Excellent, descriptive and concise introduction! Have a sub! :)

  • @shrkwt
    @shrkwt 3 года назад +1

    That's way giving instruction to the gpu (Shaders) provide less performance as compared to the game default graphics.

  • @frankynakamoto2308
    @frankynakamoto2308 7 лет назад

    Can you please please explain more how Swift Shader the software works and why it works so well?

  • @alirezajahanbakhsh7890
    @alirezajahanbakhsh7890 4 года назад

    I am so impressed by all of your videos! your have become my new my favorite! :)

  • @Cloroqx
    @Cloroqx 4 года назад +10

    This was a phenomenal explanation. It's a shame you didn't continue down this path, of making educational content.

    • @Pokemon4life-zs3dl
      @Pokemon4life-zs3dl Год назад

      She would have made a killer course on computer graphics

  • @lxliner
    @lxliner 7 лет назад

    wow, just week ago started to learn shaders, and this video appears!!!
    waiting for another video!!!

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 7 лет назад +1

    0:30 No, those are “pixel shaders” or “fragment shaders”. There are other kinds of shaders, e.g. ones executed for every vertex of the geometry (“vertex shaders”), also “compute shaders” etc.

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

    Great explanation!

  • @BulletProofCupid7
    @BulletProofCupid7 7 лет назад

    yay, another educational video! Looking forward to the next one :)

  • @Jose-uw3rj
    @Jose-uw3rj 7 лет назад

    Thank you very much for this video, it was pretty useful for understanding shaders. I will work on Spanish subtitles for this so I can recommend this video even to people who are not good at English :D

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

    Fantastic tutorial :)

  • @nullnightsun
    @nullnightsun 7 лет назад

    For me i make the background scene with photorealistic rendering..... the characters with npr and special effects in 2d drawings.... and its very awsome

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

    SUPER HELPFUL

  • @Creuilcreuil
    @Creuilcreuil 7 лет назад

    for the checker board pattern you could use, (x + y) % 2

    • @meiamsome
      @meiamsome 7 лет назад

      Perhaps even faster: (x ^ y) & 1

    • @VirtualTurtleGames
      @VirtualTurtleGames 7 лет назад

      Oliver Wright I know I'm a bit late, but what does this do? The operators specifically :) I've never written/ seen this coding language before but it looks quite interesting!

    • @sweetberries4611
      @sweetberries4611 5 лет назад

      @@VirtualTurtleGames x XOR y AND 1

  • @jayat4927
    @jayat4927 4 года назад

    i am from india i fell in love with u ..seeing ur IT cs knowledge ..do i deserve u

    • @aiwuhu
      @aiwuhu 4 года назад

      Perv from India

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

    Still an amazing video in 2024

  • @RoyalRiku13
    @RoyalRiku13 6 лет назад +3

    Now I really want to get into graphics programming :)

    • @man_vs_life
      @man_vs_life 4 года назад

      The future asks, "Did you?"

    • @RoyalRiku13
      @RoyalRiku13 4 года назад

      @@man_vs_life Tbh no, but only cuz I'm focused on Data Analytics projects since that's my main focus. Obvious ones looking into COVID-19 atm

  • @lagaffe91
    @lagaffe91 4 года назад +1

    Very interesting !

  • @ty_teynium
    @ty_teynium 7 лет назад

    @0:26 looks like the photo from Kojima productions at Siggraph showing their decima engine. They demonstrate something similar to this.

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

    I miss this channel

  • @ulysisxtr
    @ulysisxtr 7 лет назад

    Awesome video! I don't think it could be explained in a simpler way...

  • @franklynzhu6590
    @franklynzhu6590 6 лет назад

    Thank you, this was very informative for a newbie to shaders!

  • @guiguiregismercer5720
    @guiguiregismercer5720 7 лет назад

    Learning shaders is my next things!

  • @Kj16V
    @Kj16V 7 лет назад

    Ooooh Now I understand why there was a character called "Phong" in the CGI cartoon, Reboot!

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

    So what different between shader and color grading

  • @GhislainLeblanc
    @GhislainLeblanc 7 лет назад

    Well done!

  • @WillVRam
    @WillVRam 4 года назад

    What are your favorite shaders in games? and why.
    Thanks

  • @dimifisher
    @dimifisher 4 года назад

    I think is what curves and filters is in photoshop

  • @hollaback0690
    @hollaback0690 6 лет назад

    Best shader intro I've seen for noobs yet!!! Very helpful and thank you for simplifying the concept so we can understand the basics

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

    so can shaders be summerized as "object surface type/properties"?

  • @oj7046
    @oj7046 7 лет назад

    Dear. HappieCat, I was wondering if you understand what to do after an indie developer has a game or a demo of a game completed. I feel like it's more than just putting up a file on a digital distribution site like Steam besides spreading the word.

  • @parallaxis261
    @parallaxis261 7 лет назад

    thanks! very nice explanation.

  • @AllanBrunoPetersen
    @AllanBrunoPetersen 7 лет назад

    Excellent introduction and examples, thank you. :)

  • @sevuszeld5015
    @sevuszeld5015 3 года назад

    thanks a lot doc

  • @fernwood
    @fernwood 3 года назад

    I’ve been coding for 40 years and I swear, shaders make almost no sense to me. Still, this video is getting me closer to understanding. Thanks.

    • @clemdemort9613
      @clemdemort9613 3 года назад

      It's just code executed in parallel!
      With compute shaders you can even choose how many different processes you want to compute at once instead of doing it on a per pixel basis

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

      Takes a bit to click for anyone. So hard after getting so used to sequential coding.

  • @23kl104
    @23kl104 5 лет назад +10

    @4:09 "there is a link in the description", I see what you did there

  • @hafeesh
    @hafeesh 7 лет назад

    love your videos!!

  • @schmidtzcargolbull
    @schmidtzcargolbull 5 лет назад

    good introduction. very good even

  • @WooMaster777
    @WooMaster777 7 лет назад

    Thank you! Thank you! Thank you! I LOVE your videos. They are super helpful!

  • @blacksaturn8834
    @blacksaturn8834 7 лет назад

    That Okami reference made me happy :3

  • @Anggatetapangga
    @Anggatetapangga 4 года назад

    So, shader is like image filter?

  • @StigDesign
    @StigDesign 7 лет назад

    Great to see new video :D and Verry interesting :)

  • @THEHOUSEOFSATIO
    @THEHOUSEOFSATIO 3 года назад

    Thanks teacher

  • @windowsforvista
    @windowsforvista 7 лет назад

    Thank you!

  • @yanivdebby9137
    @yanivdebby9137 3 года назад

    do you know a software that i can use to create clip (video) from open source shaders? thx

  • @onlyme0349
    @onlyme0349 5 лет назад

    But how do you tell your gpu to add borders around your 3d models if it only has pixel information?

  • @camryhsalem5139
    @camryhsalem5139 3 года назад

    just excellent

  • @VictoriaFilmsgroup
    @VictoriaFilmsgroup 6 лет назад

    Would this shadertoy work for a full feature film color correction?

  • @8cyl6speed
    @8cyl6speed Год назад

    Where is pt2

  • @paparoxo3606
    @paparoxo3606 5 лет назад

    Amazing, thank you!