Anonymous | 2011-07-26 18:06
Simple Color Grading Shader
19
points ]
 (2 votes)
Aka Color Correction

Simple color grading shader v1.0
It's written in GLSL, also it's my FIRST shader ever.
It's still not finished, needs a few tweaks and stuff but it works.
Yes, desaturation feature IS in plans.
The shader basically lets you add different atmosphere to the map, set colors for shadows, midtones and bright areas.

->>For those who don't know what color grading is please check out this URL: http://udn.epicgames.com/Three/ColorGrading.html

Also sorry, It's still not saving settings but I'll add feature to add presets later.

USAGE:

Just type in your autoexec.cfg "exec cgrade.cfg"
Then you can bind/use/whatever the cgrade gui or just open it with /showgui cgrade

You may use the shader whereever and however you want but you should credit me then.
Have fun.

fsvs = [
    void main(void)
    {
        gl_Position = gl_Vertex;   // woohoo, no mvp :) 
        gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
]

fsps = [
    #extension GL_ARB_texture_rectangle : enable
    uniform sampler2DRect tex0; 
    void main(void)
    {
        vec4 sample = texture2DRect(tex0, gl_TexCoord[0].xy);
]

////////////////////////////////////////////////
//
// color grading shader definitions:
//
////////////////////////////////////////////////

lazyshader 4 "colorgrade_shadows" [ @fsvs } ] [
	uniform vec4 params;
	@fsps
	
	float factor = max(sample.x, max(sample.y, sample.z));
	vec4 shadows = params;
	
	if(factor  0.01)
		{
			factor = (factor + 0.09)*10;
			
			shadows.w = shadows.x; //.w is value backup
			shadows.x = ((1 - shadows.w) / 2) * factor;
			shadows.x += shadows.w;	//Adding backup
			
			shadows.w = shadows.y; //.w is value backup
			shadows.y = ((1 - shadows.w) / 2) * factor;
			shadows.y += shadows.w;	//Adding backup
			
			shadows.w = shadows.z; //.w is value backup
			shadows.z = ((1 - shadows.w) / 2) * factor;
			shadows.z += shadows.w;	//Adding backup
		}
		gl_FragColor = vec4(sample.x * shadows.x, sample.y * shadows.y, sample.z * shadows.z, sample.w);	
	}
	else gl_FragColor = vec4(sample);
} ]

lazyshader 4 "colorgrade_midtones" [ @fsvs } ] [
	uniform vec4 params;
	@fsps
	
	float factor = (sample.x + sample.y + sample.z)/3;
	vec4 midtones = params;
	
	if(factor >= 0.1 && factor  0.3)
		{
			factor = (factor - 0.31)*10;
			
			midtones.w = midtones.x; //.w is value backup
			midtones.x = ((1 - midtones.w) / 2) * factor;
			midtones.x += midtones.w;	//Adding backup
			
			midtones.w = midtones.y; //.w is value backup
			midtones.y = ((1 - midtones.w) / 2) * factor;
			midtones.y += midtones.w;	//Adding backup
			
			midtones.w = midtones.z; //.w is value backup
			midtones.z = ((1 - midtones.w) / 2) * factor;
			midtones.z += midtones.w;	//Adding backup
		}
		else if(factor  0.5)	//Hightlights
	{
		if(factor
ColorGradingShader.zip (1.79 KB)
19
points
 (2 votes)
User login
Users on Quadropolis
1 guest & no users online
30
points ]
 (3 votes)
Created 2019-05-17 21:51
5 years 27 weeks ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
4 years 23 weeks ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 26 weeks ago
8
points ]
 (1 vote)
Created 2024-06-02 14:26
24 weeks 3 days ago
8
points ]
 (1 vote)
Created 2024-06-02 22:13
24 weeks 3 days ago
vampirefrog
Created 2024-04-11 22:25
31 weeks 6 days ago
vampirefrog
29
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 25 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
4 years 4 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
40 weeks 3 days ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
1 year 17 weeks ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 49 weeks ago
Created 2023-12-12 23:34
49 weeks 1 day ago
Zoocata
Created 2023-11-27 23:00
51 weeks 2 days ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
1 year 7 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 23 weeks ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 28 weeks ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 37 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 42 weeks ago
Created 2023-01-19 19:36
1 year 43 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 45 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN