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
LURKing
10
points ]
 (1 vote)
Created 2020-07-01 13:16
1 day 4 hours ago
70
points ]
 (7 votes)
Created 2020-01-24 22:26
22 weeks 5 days ago
TheMisterCat
16
points ]
 (2 votes)
Created 2007-02-21 18:06
13 years 19 weeks ago
92
points ]
 (11 votes)
Created 2011-05-17 17:36
9 years 7 weeks ago
Created 2020-05-14 12:56
7 weeks 4 hours ago
18
points ]
 (2 votes)
Created 2020-06-01 20:40
4 weeks 2 days ago
30
points ]
 (3 votes)
Created 2018-09-17 02:06
1 year 41 weeks ago
26
points ]
 (3 votes)
Created 2020-06-27 11:13
5 days 6 hours ago
LURKing
40
points ]
 (5 votes)
Created 2020-05-09 17:56
7 weeks 4 days ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
2 weeks 4 days ago
7YearBitch
8
points ]
 (1 vote)
Created 2020-06-14 17:58
2 weeks 3 days ago
7YearBitch
44
points ]
 (5 votes)
Created 2020-06-02 09:43
4 weeks 2 days ago
LURKing
25
points ]
 (3 votes)
Created 2020-06-12 18:25
2 weeks 5 days ago
7YearBitch
15
points ]
 (2 votes)
Created 2020-06-07 14:58
3 weeks 4 days ago
7YearBitch
15
points ]
 (2 votes)
Created 2020-06-07 14:48
3 weeks 4 days ago
19
points ]
 (2 votes)
Created 2020-05-31 16:27
4 weeks 4 days ago
38
points ]
 (4 votes)
Created 2020-05-16 23:15
6 weeks 4 days ago
224
points ]
 (23 votes)
Created 2012-10-20 09:56
7 years 36 weeks ago
Gangler
10
points ]
 (1 vote)
Created 2020-05-12 22:59
7 weeks 1 day ago
afroninja
56
points ]
 (6 votes)
Created 2020-01-15 07:47
24 weeks 1 day ago
Who's new
  • Getridou
  • Spr1te
  • Akari
  • LURKing
  • Antknee55