Blending in OpenGL

Поділитися
Вставка
  • Опубліковано 19 лис 2024

КОМЕНТАРІ • 125

  • @lahusa_
    @lahusa_ 6 років тому +212

    These presentations are actually really good (Maybe you could stylize them according to your video/channel color palette)

  • @PenguinMaths
    @PenguinMaths 5 років тому +45

    Love the powerpoint! As some others have pointed out, I'm confused why layering a semi transparent color over a fully opaque color would yield a semi transparent color, as shown in the alpha channel of the last slide. Great series.

  • @rynho7255
    @rynho7255 6 років тому +18

    Damn those slides are so good man. Keep them up, they really help us understand better than just showing pieces of code.

  • @no5x937
    @no5x937 3 роки тому +8

    This is your most professional presentation/tutorial. Having a written power point presentation greatly improves your presentation style, keeps you focused on top in the correct sequence, and helps eliminate the unnecessary meanderings and ramblings. I strongly recommend you create a PPT presentation as a reference to your future tutorial videos. Keep up the great work!

  • @ucmRich
    @ucmRich 6 років тому +18

    The "way" you designed your ppt presentation to coincide with how you teach is brilliantly on target. My brain gets it! thank you!
    ** also thank you for everyone helping to support him!

  • @789blablajaja
    @789blablajaja 6 років тому +13

    Wow, about half a decade ago I learned Java from your videos. Now I am doing it professionally and when I search for an opengl problem
    I stumble across this. Huge nostalgia wave crushing over me.

    • @789blablajaja
      @789blablajaja 6 років тому +4

      Also, amazing video! Powerpoint was used so well, and your explanations were so simple yet precise.

  • @ZyklonV
    @ZyklonV 6 років тому +13

    That was a nice and concise presentation. It’s a good initiative and makes it clearer. Plus you can pause the video to think. A presentation + live coding is what most teachers do at university.

  • @davidhall7275
    @davidhall7275 3 роки тому +4

    I love this quote : It is really quite simple once you understand how it works.

  • @Gettingitfiguredout
    @Gettingitfiguredout 5 років тому +8

    Thought the power point was really helpful, thank you for taking the time.

  • @alexandrosmoysi7140
    @alexandrosmoysi7140 7 місяців тому

    Presentation is definetly a great tool for you, it lets you take your great explaining skills for code, and use them on non coding topics. Best course ever!

  • @polaris911
    @polaris911 6 років тому +1

    I've been reading various guides online about this for the last couple days, I shoulda just watched this 12 minute video because you explained it better than any of them. Thanks for posting this, it really helps that you explained *conceptually* what is happening.

  • @aura-audio
    @aura-audio 4 роки тому +2

    Loved the powerpoint presentations! I understand this concept very well now!

  • @Wout680
    @Wout680 5 років тому +10

    10:55 Does this mean that the overlap of the white square with the magenta rectangle has an alpha of 0.75? Seems weird how the opaque rectangle with the semi-opaque square creates a semi-opaque result. Or am I interpreting this wrong?

    • @PluginEverything
      @PluginEverything 5 років тому

      This confuses me too.

    • @goldenlava1019
      @goldenlava1019 4 роки тому

      yeah

    • @taufiqulalam2035
      @taufiqulalam2035 4 роки тому +1

      Imagine three glass shards on top of each other. This alpha value function was designed to simulate that. Kind of. But it can't really properly. but it's fairly accurate.

    • @cyqry
      @cyqry 2 роки тому

      @@taufiqulalam2035 Its not fairly accurate when one of them should be fully opaque.

  • @ibrahimrashwan
    @ibrahimrashwan 2 роки тому

    Totally in with the that new style of using presentations simple & strait to the point and it's easy to understand

  • @clem494949
    @clem494949 6 років тому +22

    In the last example: something semi-transparent (a=0.5) on top af something opaque (a=1) gives you something a bit transparent (a=0.75) ?

    • @micheleabruzzese4499
      @micheleabruzzese4499 6 років тому +18

      The equation is wrong for alpha channel, it should be:
      out_alpha = src_alpha + dest_alpha * (1 - src_alpha)
      If dest_alpha equals 1, then out_alpha also equals 1

    • @Mugistan
      @Mugistan 4 роки тому

      @@micheleabruzzese4499 I'm not sure if that's true 0.5 + 1 * (1 - 0.5 ) = 1.5 * 0.5 giving 0.75

    • @micheleabruzzese4499
      @micheleabruzzese4499 4 роки тому +1

      @@Mugistan multiplication has priority over addition so it first multiplies dest_alpha times the parentheses, then adds src_alpha

    • @Mugistan
      @Mugistan 4 роки тому

      @@micheleabruzzese4499 oh I misread I thought it as like this (0.5 + 1) * (1 - 0.5) sorry my mistake

    • @tomneijman4212
      @tomneijman4212 4 роки тому +2

      I noticed that too, but that's how the function in the example works (apart from if this is what you want). Cherno's calculation is right, see the OpenGl documentation: docs.gl/gl4/glBlendFunc.

  • @vectork3
    @vectork3 4 роки тому

    Thanks Cherno! I really like this new presentation style. Its really easy to understand. Love from Nepal :D

  • @victorlucki8586
    @victorlucki8586 6 років тому

    The slides were a really good addition! They help visualize all the theory quite a bit.
    Please, so continue with them, if it's not too much work, of course.

  • @michaldvorak2230
    @michaldvorak2230 6 років тому

    Really a fan of this presentations style of teaching, would definitely be delighted to see it in your future videos!

  • @ty_teynium
    @ty_teynium 6 років тому

    This is similar to the siggraph class lecture presentations, but from your own home, I did actually pick up a lot of what you were explaining this way, but it can be a lot of work that’s why I just wait for the code parts so that I can see what works and where to put them.

  • @RX7GSLSEowner
    @RX7GSLSEowner 4 роки тому

    I like the powerpoint presentation. Thumbs up!

  • @landrypierce9942
    @landrypierce9942 6 років тому +4

    Can you do a video about using SPIR-V in OpenGL?

  • @Puddlestomps
    @Puddlestomps 6 років тому

    The presentation was nice. Helps illustrate the concept.

  • @charlesz88
    @charlesz88 2 роки тому

    I LOVE the PowerPoint style.

  • @jonathanorr5878
    @jonathanorr5878 4 роки тому

    This really helped thanks a lot for making these videos

  • @koungmeng
    @koungmeng 5 років тому +11

    8:14 why do we need to calculate alpha value if we dont need that? we need only the RGB values to determine the color, the alpha value is meaningless to us because we use it to find the RGB.

    • @SuperKarlFriedrich
      @SuperKarlFriedrich 4 роки тому +4

      you might use the blended color to calculate yet another blend behind that

    • @billypersistent6127
      @billypersistent6127 4 роки тому

      Yeah, there's no destination alpha variable in any of the RGB equations.

    • @Neran280
      @Neran280 4 роки тому +2

      Well actually we do not need the alpha value of the frame buffer in that case.
      There is no dst alpha variable for the RGB values involved. Because we specified SRC_ALPHA and ONE_MINUS_SRC_ALPHA it means that we just look at the shaders output alpha value (SRC_ALPHA) + are only interested in the RGB values of our current frame buffer to compute the final color not the alpha value in the current frame buffer. However we can only do this because we assume that the alpha value in the frame buffer is always 1, which makes sense in a game environment because you will always have something behind an object (IN THE END). In our case this is the black clear color or in a game you will have sky/background or something similar so your framebuffer will never have a non 1 alpha value. For example unity engine with its new renderer uses by default a destination buffer without alpha channel. If you use certain multipass effects you will have to store a new alpha value.
      One example in which you want to do this is if you want to do direct volume rendering by raycasting in your fragment shader. If you traverse your volume from front to back you can do early ray termination if your accumulated alpha is >= 1. Although you do not need to perform an actual OpenGL blending operation (because the blending is computed in your shader in this case) this accumulated alpha is equivalent to the dest_alpha.
      however the new alpha value computation is wrong because it does not make sense that an opaque color + an semi transparent color results in a semi transparent color. So in the last example A should equal to 1 and not 0.75.
      A_out = A_src + (1 - A_src) * A_dest
      The RGB values are correct.

  • @brod515
    @brod515 6 років тому +4

    if by default it use 1 for the source and destination is 0 shouldn't the image with these settings just look like the cherno logo but with a black background? Why did the image with the default blending settings look very strange as though the actual image was corrupted in some way?

    • @hls333555
      @hls333555 5 років тому

      I am confused about that too...

  • @tarasuzy00
    @tarasuzy00 3 роки тому

    It's easy to understand. Very helpful!

  • @bjornbork7650
    @bjornbork7650 6 років тому

    I liked the powerpoint presentation, very professional, and hope to see more of them in the future.

  • @jutuootv590
    @jutuootv590 3 роки тому

    thank you so much, this really helped me creating a 2d lighting system for my project :D

  • @jeroenkoffeman9402
    @jeroenkoffeman9402 4 роки тому

    And thanks for a very clear explanation video as always!

  • @De_Cain
    @De_Cain 4 роки тому

    Love this format, I understood your explanations much better with a pp.

  • @may007ank
    @may007ank 6 років тому

    That was very informative. I finally learned something I've been using for a long time, apparently, without understanding.

  • @senser1o76
    @senser1o76 3 роки тому

    12:19 dangerous gest :D

  • @mngmn
    @mngmn 8 місяців тому

    amazing series , kind of confused about 1 thing though, if the default when not blending is just 1 on all channnels of the source , then it should just nuke the existing buffer data, doesnt that mean that the texture you tried to use (the cherno logo) should just work and replace the old buffer?

  • @webgpu
    @webgpu 6 років тому +1

    wkr? authors use cliffhanging to "force" viewers to watch the next video. But your videos are already interesting, we will certainly watch them as they come:) That presentation is great. Visual aids are very helpful to better understand the concepts you talk about.

  • @arget9272
    @arget9272 6 років тому

    I really like the PowerPoint presentation in an explanatory video like this one 👍🏻🤓

  • @yuchen3587
    @yuchen3587 6 років тому

    Fantastic slides!

  • @mkgamesartvisuals
    @mkgamesartvisuals 3 роки тому

    Thanks a lot!

  • @emanuelkokovics
    @emanuelkokovics 3 роки тому

    SO I thought about testing the program without:
    GLCall(glEnable(GL_BLEND));
    GLCall(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
    Expecting something distorted to render, but it renders the same, with same problem (rendering just bottom left corner).

  • @ben-nh9sn
    @ben-nh9sn 5 місяців тому

    holy fuck the powerpoint is actually insane

  • @mayankshigaonker7725
    @mayankshigaonker7725 4 роки тому

    I like this style

  • @fountainwindmill
    @fountainwindmill 6 років тому

    I really like the new powerpoints since I'm a visual learner. I get what you mean by just listening to you, but i had to concentrate less to achieve the same result using your powerpoint. But you can skip them if they take too long to make, they're not necessary, just preferable.

  • @regbot4432
    @regbot4432 3 роки тому

    So underrated episode...

  • @user-kq4fk9bl6d
    @user-kq4fk9bl6d 6 років тому +2

    Are you going to post a video on order independant transparency? I think its kinda hard to implement correct and i coulnt find anything on the internet.

  • @ty_teynium
    @ty_teynium 6 років тому

    Also you should have the slide available for download, for reference!

  • @mukeshpareek5414
    @mukeshpareek5414 6 років тому +3

    Hi Cherno,
    First of all Thanks for making such awesome videos.
    Secondly,
    In my code if i comment out those two lines for blending. Still my texture is rendered perfectly. Can you explain that?

    • @haykav
      @haykav 6 років тому +1

      Mine is too, I don't know what's the deal with that.

    • @eriksimon6567
      @eriksimon6567 6 років тому +3

      are you using pngs? I used a jpeg and it worked fine because jpgs don't support transparency.

  • @gregd6022
    @gregd6022 3 роки тому

    cryptic explanation ... it simply "mixing" two inputs to get the output, each input has an "amount" coefficient (volume control). output is written to the buffer. (amount coefficients used are selected from a list of available options during setup). done.

  • @eythimis
    @eythimis 4 роки тому

    Awesome thx!!!!

  • @yanko694
    @yanko694 6 років тому

    Loved the presentation! Have you got any plans to do a turn on glTF 2.0 integration?

  • @rudejehlici5425
    @rudejehlici5425 4 роки тому

    Big like for the presentation! :D

  • @jingluntang7479
    @jingluntang7479 4 роки тому

    OMG first time seeing a ppt

  • @joaopedrovoga5497
    @joaopedrovoga5497 2 роки тому

    Nice explanation.

  • @shruikan123456789
    @shruikan123456789 6 років тому

    awesome slides!

  • @MrStarTraveler
    @MrStarTraveler 9 місяців тому

    This tutorial needs at leas one video on shader language. Last lesson new stuff was added to our shaders but I don't understand what that stuff is and where it comes from.

  • @pierre.vieira
    @pierre.vieira 5 років тому

    THANKS BRO

  • @benedikt7846
    @benedikt7846 2 роки тому

    Think I might just pass my exam thanks to this one

  • @emilasplund4462
    @emilasplund4462 6 років тому

    Powerpoint idea = perfect!

  • @Tetsujinfr
    @Tetsujinfr 4 роки тому

    Thanks for that, but I think that if viewers are familiar with rgba components already then they should already understand blending and stuff like linear interpolation of alpha * src + (1-alpha) * dest. So good to know how to do it in opengl but I think a rgba basics separate video might be a better option (so that I can skip it and those lost can watch it). Just my 2 pennies here.

  • @pranjalkhatri5631
    @pranjalkhatri5631 4 місяці тому

    thank you!!!!!!!!!!!!!!

  • @aljosaskorjanc1475
    @aljosaskorjanc1475 6 років тому

    Hello there Cherno!
    I have been trying to get a hold of LWJGL3 for quite some time now. Honestly, I find the learning confusing, due to the fact that there are just so many different sources. So my request is: Can you please make a video in which you explain how to learn OpenGL/LWJGL so that the learning curve is at it's optimum? Should we prefer to read books rather than follow "do this, do that" video tutorials on youtube? If so, which books do you advise us to read (and please, reference us to some good LWJGL books if there even are any because I have found none so far)? Should we follow online articles, blogs and tutorials about OpenGL? Should we study the OpenGL API in depth? (and if so, how?). Please, give us an overview of what way you think is the most productive to learn OpenGL/LWJGL.
    Yours sincerely,
    Aljoša

  • @Влад-э7в2ь
    @Влад-э7в2ь 3 роки тому

    Awesome!

  • @chiyungchu9463
    @chiyungchu9463 3 роки тому

    WOW, your powerpoint background color so cool, how u blend that.

  • @fencer9055
    @fencer9055 3 роки тому

    I'm following along in Java, and when I tested a transparent texture without blending, it worked just fine. Why is that the case?

    • @user-dh8oi2mk4f
      @user-dh8oi2mk4f 3 роки тому +1

      Does it still work if you manually disable blending?

  • @raf.nogueira
    @raf.nogueira 6 років тому

    How its possible to find a internship or a job with Opengl and game engine development if have so many engines already made out there ? I learning very much, but i live in poor country there are no possibilities for me to work with this here, but i want so much.

  • @sukhmandersingh4306
    @sukhmandersingh4306 3 роки тому

    When are we gonna enable blending on logo on laptop's back?

  • @ren69ade
    @ren69ade 6 років тому

    LIke the power point, better than waving hands and drawing imaginary boxes, and also better than live drawing in some drawing program.

  • @lizzyfleckenstein9837
    @lizzyfleckenstein9837 3 роки тому +3

    "When talking about graphics programming you actually have to tell the computer what you wanna do"
    Well, this pretty much goes for anything related to computers. Not only programming.

  • @jlewwis1995
    @jlewwis1995 2 роки тому

    4:29 can't you technically do binary blending by discarding fragments with alpha < some.value in your fragment shader? The opengl wiki certainly says so, so I wouldn't say that literally *nothing* will happen if you disable blending, it's just that the blending that is still available isn't going to be all that useful unless you can specially get away with only having either solid or completely transparent pixels

    • @abcxyz5806
      @abcxyz5806 Рік тому

      You can, but this is normally not called blending. Unity e.g. calls that Alpha Clipping. As you said, you cannot mix colors with this. However some engines can fake blending by using dithering, which has the benefit that the usual problems with transparency like front to back sorting do no apply.

  • @chinmayanand896
    @chinmayanand896 6 років тому +6

    Hey cherno love you bro

  • @gliese436-b5
    @gliese436-b5 6 років тому

    The PowerPoint was a great idea in my opinion.

  • @dirtyblasion15
    @dirtyblasion15 6 років тому

    More than helpful

  • @knayder42
    @knayder42 6 років тому

    Are you going to make video about Order Independent Transparency?

  • @paulhorbenko9560
    @paulhorbenko9560 2 роки тому

    In real life, if we put blue and red glass in front of each other, we won't have any color coming through at all(I believe). Since red glass only lets through the red light, and blue - blue.

  • @vertigo6982
    @vertigo6982 5 років тому

    What song is that in the intro? It's silky smooth.

  • @flusher84265
    @flusher84265 5 років тому +2

    Turning off blending yields the Charno logo

  • @MichaelYoussry
    @MichaelYoussry 6 років тому +2

    No more waving hands! 😢
    jk, awesome presentation

  • @aryesegal1988
    @aryesegal1988 6 років тому

    Aiii Cherno bruh, where are you flying to at the end of each video tho'? ;)

  • @brod515
    @brod515 6 років тому +2

    I think this is great but I don't think the example you gave about see through a red and a blue glass will look purple is a good example. i think in a real life situation (not sure) the color you would see would be black. I feel like what were doing here in OpenGL with blending should refer to mixing colors as opposed to anything relating to lighting.

    • @Wout680
      @Wout680 5 років тому

      Would it be a dark-ish purple, the red followed by blue window? How could you achieve subtraction of colours when light is additive?

    • @wirosk2916
      @wirosk2916 4 роки тому

      @@Wout680 Less amount of light is passing through each layer of glass making it appear darker. Maybe...

    • @philmsproduction
      @philmsproduction 4 роки тому +1

      I was thinking the same thing. I think the glass would actually multiply the colors rather than adding/averaging them.

  • @rhodexa
    @rhodexa 4 роки тому

    I'm pretty sure that if you put a red glass in front of a blue one, the result color would be black... because the red glass will remove any blue light, letting only the red light to pass through. When it hits the blue glass, the red light will be absorbed (or reflected) and no light will be seen on the other side xD

    • @War4est
      @War4est 4 роки тому +1

      Probably you didn't assume that the light could come not only from one direction.

    • @user-sl6gn1ss8p
      @user-sl6gn1ss8p 3 роки тому +1

      @@rhodexa I think you can get something closer to that setting the source parameter to be the destination's color and the destination to zero. That way I think you "filter" the original color with the new one - if the red is pure red and blue is pure blue you get zero, but if they have common components those survive.

    • @rhodexa
      @rhodexa 3 роки тому +2

      @@user-sl6gn1ss8p You're right. My point was that the 'real-life filter' wasn't a good analogy to what computers do to colors.
      • What filters do is subtract data from a source. (Passing red light through a blue filter will give nothing, cause no light was blue)
      • What OpenGL is doing is ‹combining›, adding data from two different sources. (you have a red light source, and a blue one. When mixed, produce a different light: magenta)
      Just a pedantic comment :D

    • @user-sl6gn1ss8p
      @user-sl6gn1ss8p 3 роки тому +1

      @@rhodexa true : )

  • @deesrexcoding3564
    @deesrexcoding3564 4 роки тому

    For some reason, it doesnt matter if I enable blending or not......

  • @slurpeesauce1750
    @slurpeesauce1750 3 роки тому

    Why does
    ```
    layout.Push(2)
    layout.Push(2)
    ```
    work but
    ```
    layout.Push(4)
    ```
    does not

    • @pipding4368
      @pipding4368 3 роки тому

      It's because each time you call layout.Push(), you're telling your VertexBufferLayout about a new 'attribute' of your vertex. At this point, each of our vertices have 2 attributes - a position (which is made up of 2 floats) and a texture coordinate (which is also made of 2 floats).
      By calling layout.Push(4), you're telling your VertexBufferLayout that your vertices have 1 attribute, which is made up of 4 floats.
      This causes a problem when your shader tries to read the data from the buffer, since it's expecting 2 attributes but you only defined 1

  • @adamodimattia
    @adamodimattia 4 роки тому

    Great video, I wish I could have seen it when I was learning Unity’s HLSL, would have helped me a lot.

  • @mycollegeshirt
    @mycollegeshirt 5 років тому

    That's a lerp, no?

  • @bor_is_lov
    @bor_is_lov 8 місяців тому

    bro switched from normal tutorials to practice only ones, only to switch then to powerpoint presentations

    • @bor_is_lov
      @bor_is_lov 8 місяців тому

      this is good tho, i like theory

  • @c1337
    @c1337 6 років тому +2

    Hi
    can you make a tutorial about calloc, malloc, realloc and free functions in c++

  • @vixellar7933
    @vixellar7933 6 років тому +5

    #notificationsquad

  • @slaincow4032
    @slaincow4032 6 років тому

    I’m only here for entertainment purposes 😂

  • @TheNeoxpert
    @TheNeoxpert 6 років тому

    Why you're not using Linux?

  • @malharjajoo7393
    @malharjajoo7393 25 днів тому

    This could have been explained in a much shorter video.

  • @devashish0312
    @devashish0312 6 років тому +1

    Please start uploading game engine series

  • @Behiri
    @Behiri 6 років тому

    I'm hearing openGL is deprecated is that true?

    • @XxAl3X3IxX
      @XxAl3X3IxX 6 років тому

      couldn't find anything about that. Are you sure you can trust the sources that say that?

    • @SketchpunkLabs
      @SketchpunkLabs 6 років тому

      You only hear that because the Khronos Group now have the vulkan API, so at some point OpenGL will fade away. Last I read is that Khronos will continue to develop the OpenGL Api. But in all honestly, there is going to be a point where they can not dedicate resources to developing two different Graphic APIs. I believe android is looking to make vulkan their preferred api, windows never supported OpenGL passed version 1, anything afterwards are AMD / nvidia making their own drivers to use modern versions of opengl for windows. Then you have valve which is still developing SteamOS even though they stopped selling the hardware, they're big push is to improve Vulkan support on linux. You can also use vulkan to make games on the Nintendo switch.
      So its not deprecated but the writing on the wall is that when vulkan is mature enough, opengl will no longer be needed.

  • @leonardomarinovic3492
    @leonardomarinovic3492 6 років тому

    Eeeeyyyyy wazzup guys chern0 here