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
vampirefrog
Created 2024-04-11 22:25
5 hours 32 min ago
vampirefrog
29
points ]
 (4 votes)
Created 2010-05-30 10:00
13 years 45 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
3 years 24 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
8 weeks 4 days ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
37 weeks 4 days ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 17 weeks ago
Created 2023-12-12 23:34
17 weeks 2 days ago
Zoocata
Created 2023-11-27 23:00
19 weeks 3 days ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
27 weeks 4 days ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
2 years 46 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
43 weeks 2 days ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
48 weeks 6 days ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 6 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 10 weeks ago
Created 2023-01-19 19:36
1 year 11 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 13 weeks ago
Getridou
Created 2023-01-01 14:30
1 year 14 weeks ago
Getridou
10
points ]
 (1 vote)
Created 2023-01-01 10:58
1 year 14 weeks ago
Getridou
Created 2023-01-01 10:49
1 year 14 weeks ago
afroninja
17
points ]
 (2 votes)
Created 2023-01-01 06:32
1 year 14 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN