I really like the Halation effect and the interlacing from CRT Geom. Could it be possible to extract those and make them standalone shaders if you don’t want to use the other aspects of CRT Geom?
Here’s the halation effect isolated (you can replace the stock.cg shader with other stuff, like xBR): http://www.mediafire.com/download/5vbfp … lation.zip
and here’s interlacing detection:
/* COMPATIBILITY
- HLSL compilers
- Cg compilers
*/
struct input
{
float2 video_size;
float2 texCoord_size;
float2 output_size;
float frame_count;
float frame_direction;
float frame_rotation;
float2 texture_size;
sampler2D texture : TEXUNIT0;
};
struct tex_coords
{
float2 texCoord : TEXCOORD0;
};
// VERTEX SHADER //
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float4 color : COLOR,
out float4 oColor : COLOR,
float2 tex : TEXCOORD,
uniform input IN,
out tex_coords coords
)
{
oPosition = mul(modelViewProj, position);
oColor = color;
coords.texCoord = tex;
}
// FRAGMENT SHADER //
float4 main_fragment(in tex_coords co, uniform input IN, uniform sampler2D s_p : TEXUNIT0) : COLOR
{
float2 xy = co.texCoord;
float2 ilfac = float2(1.0,floor(IN.video_size.y/200.0));
// The size of one texel, in texture-coordinates.
float2 one = ilfac / IN.texture_size;
float2 ilvec = float2(0.0,ilfac.y > 1.5 ? mod(float(IN.frame_count),2.0) : 0.0);
// Of all the pixels that are mapped onto the texel we are
// currently rendering, which pixel are we currently rendering?
float2 ratio_scale = (xy * IN.texture_size - float2(0.5) + ilvec)/ilfac;
// Snap to the center of the underlying texel.
xy = (floor(ratio_scale)*ilfac + float2(0.5) - ilvec) / IN.texture_size;
return float4(tex2D(s_p, xy));
}
It puts an annoying diagonal line across the screen with a 1-pixel offset on my machine when showing non-interlaced content. Not really sure what’s up with that, but YMMV (that is, could be radeon/AMD-specific).
Here’s halation and interlacing detection together: http://www.mediafire.com/download/10t04 … lation.zip On this one, you can replace the image-adjustment shader with other things but the interlacing detection messes up stuff like xBR.