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
20
points ]
 (2 votes)
Created 2016-07-28 12:06
3 years 35 weeks ago
afroninja
26
points ]
 (3 votes)
Created 2020-01-15 07:47
10 weeks 4 days ago
7YearBitch
20
points ]
 (2 votes)
Created 2020-03-16 20:09
1 week 6 days ago
70
points ]
 (7 votes)
Created 2020-01-24 22:26
9 weeks 2 days ago
40
points ]
 (4 votes)
Created 2020-01-23 12:57
9 weeks 3 days ago
30
points ]
 (4 votes)
Created 2020-01-26 14:10
9 weeks 12 hours ago
170
points ]
 (17 votes)
Created 2011-09-05 14:13
8 years 29 weeks ago
Sauce
71
points ]
 (8 votes)
Created 2018-08-22 19:15
1 year 31 weeks ago
Lord Kv
160
points ]
 (16 votes)
Created 2015-03-12 14:45
5 years 2 weeks ago
45
points ]
 (6 votes)
Created 2009-08-15 13:37
10 years 32 weeks ago
MisanthropX
74
points ]
 (8 votes)
Created 2019-12-05 20:57
16 weeks 3 days ago
Redon
105
points ]
 (11 votes)
Created 2019-10-24 21:41
22 weeks 3 days ago
10
points ]
 (1 vote)
Created 2019-10-26 11:09
22 weeks 1 day ago
25
points ]
 (3 votes)
Created 2019-10-11 23:29
24 weeks 2 days ago
10
points ]
 (1 vote)
Created 2019-10-16 01:26
23 weeks 5 days ago
Gangler
37
points ]
 (4 votes)
Created 2019-10-10 16:26
24 weeks 3 days ago
34
points ]
 (4 votes)
Created 2019-10-08 02:25
24 weeks 6 days ago
5
points ]
 (1 vote)
Created 2019-10-08 13:32
24 weeks 5 days ago
Gangler
42
points ]
 (5 votes)
Created 2019-09-23 23:48
26 weeks 6 days ago
Fatality
39
points ]
 (4 votes)
Created 2019-09-28 02:57
26 weeks 1 day ago
Who's new
  • Antknee55
  • gmiz
  • impala97
  • Fixxxer
  • Gangler