Shader Tutorial for GameMaker 05 - Gamma/Brightness/Contrast/Saturation

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

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

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

    Excellent video!! I've been adding a saturation coefficient in my own game and I was about to start digging into the photoshop solutions. Thanks for doing the deep dive here

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

    thank you so much for this, your explanation supplied with examples is amazing!

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

    Thank you so much for making these! You have saved me countless hours!

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

    As far as I know, when turning an image into black and white (for example) the brightness of every channel are usually set to different values in order to get a more expressive image. In previous versions of Photoshop you had to do it manually at every channel. Nowadays, the black and white tool includes every channel brightness in addition to the saturation tool.

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  4 года назад

      That's true. Every black and white photo film converted colours differntly. some made reds really dark, some really bright and so on. Also contrasts and the grain were completely different and software like photoshop or lightroom often try to emulate that. The beausty about shaders: you can change the conversion vector however you want - so play around with it and with contrast and brightness to create interesting b&w conversions :)

  • @JonPFS
    @JonPFS 7 лет назад +6

    hey reverend great tutorial
    got this error on the gamma shader "warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values"
    maybe its because my slider goes above minus and plus
    kind of fixed it with the abs this way:
    base_col.rgb = pow(abs(base_col.rgb), vec3(1.0 / gamma));

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  7 лет назад +4

      Thanks for the info. I looked into that and it seems a problem with GM:S 1. Warning X3571 should be a warning on compliation only and not an error crashing the game.
      abs(base_col.rgb) works as you said
      as does max(base_col.rgb, 0,0) but although in this case more logical, abs is probably faster
      and an if statement would too, but I'd always avoid that if possible in a shader
      This won't occur in GMS 2 btw.
      Although to be honest I don't understand why pow can't take a negative base in the first place :)

  • @kukuruzayevhenii8764
    @kukuruzayevhenii8764 5 лет назад +1

    7:03
    wouldn't gamma lower than 1 increase the colour value, not decrease it?
    for example: colour^(1/0.5) = colour^2 //gamma = 0.5 here
    and vice versa?
    edit: it all works properly in the video, im clearly missing something..

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  5 лет назад +3

      You forget that the colour values are between 0 and 1 - so the effect kinda flips. But here's two examples:
      Let's say the red channel is 0.6 and gamma is 0.5 - so lower than 1. Then the new colour is decreased:
      0.6^(1/0.5) = 0.6^2 = 0.36
      Now let's say gamma is 2. Then the new colour is increased:
      0.6^(1/2) = 0.6^0.5 = 0.775
      I remember having the same troubles when writing this tutorial :)

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

      @@gamingreverends-devcorner1379 ohhh, thanks a lot! :D

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

    Un énorme merci !

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

    and how to make a gamma on full screen no only for image

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

    such great tutorials! :D I have a problem though that i get inverted colors by the end of the tutorial (gritty shader) but i can't figure out where i'm wrong. The code looks like this:
    uniform float brightness;
    uniform float contrast;
    void main()
    {
    vec4 base_col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );

    base_col.rgb = (base_col.rgb - 0.5) * contrast + 0.5;
    float grey = dot(base_col.rgb, vec3(0.229, 0.587, 0.114));
    base_col.rgb = mix(base_col.rgb, vec3(grey), max(contrast - 1.0, 0.0) * 0.25);
    base_col.rgb = base_col.rgb + brightness * (1.0 + contrast * 0.5);

    gl_FragColor = base_col;
    }

  • @bobroslavsky
    @bobroslavsky 5 лет назад +1

    how did you make window in right part of gm in different colors

  • @dmathiastube
    @dmathiastube 5 лет назад +1

    👍