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
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.
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 :)
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));
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 :)
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..
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 :)
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 );
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
thx mate. glad these videos still help :)
thank you so much for this, your explanation supplied with examples is amazing!
Thank you so much for making these! You have saved me countless hours!
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.
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 :)
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));
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 :)
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..
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 :)
@@gamingreverends-devcorner1379 ohhh, thanks a lot! :D
Un énorme merci !
and how to make a gamma on full screen no only for image
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;
}
how did you make window in right part of gm in different colors
Preferences -> Ressource Tree -> Colors -> Labels/Backgrounds :)
Gaming Reverends - DevCorner thank you!
👍