white balance shader

the shader make the white balance effect that look samiler to the unity effect
where the effect is wraping between 2 gradient colors (warm, cool)
warm is 1
cool is -1

you can add the shader to ColorRect node and it will work fine for any thing under it
I just edit the GDQuest Gradient Map Shader video so i can use it in any scene 
without adding it for every single sprite and in the same time it wrabs between 2 colors

you need to add the gradient colors by your self and put it in the shader param
(you can learn how to make the colors from this video )
then change the mix_amount value to 1 for warm or -1 for cool

Shader code
shader_type canvas_item;

uniform sampler2D warm_color: hint_black;
uniform sampler2D cool_color: hint_black;
uniform float temperature = 0;

void fragment(){
	
	vec4 input_color = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0);
	
	float grayscale_value = dot(input_color.rgb, vec3(0.299, 0.587, 0.114));
	vec3 sampled_color;
	if (temperature > 0.0){
		sampled_color = texture(warm_color, vec2(grayscale_value, 0.0)).rgb;
		COLOR.rgb = mix(input_color.rgb, sampled_color, temperature);
	}
	else{
		sampled_color = texture(cool_color, vec2(grayscale_value, 0.0)).rgb;
		COLOR.rgb = mix(input_color.rgb, sampled_color, temperature * -1.0);
	}
	COLOR.a = input_color.a;
}
Tags
cool, cool warm color, gradient, warm, white balance
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Owl

color splash (show only one color)

Related shaders

2D Hologram Shader

Half-Tone Comic Shader

PS1 Shader

guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
frukkt
1 month ago

blue green and red should not be visible?

Last edited 1 month ago by frukkt