Linear depth + color perspective

Update
http://youtu.be/AYxxhn5hiG0

# CONSTANTS #
LIGHT_COLOR = Vec3(.7,.4,.3)
GLOBAL_AMBIANT = Vec3(.3,.6,.7)

FAR_CLIP = 1000
NEAR_CLIP = 10
//Cg

void vshader(float4 vtx_position : POSITION,
             out float4 l_position : POSITION,
             out float2 l_texcoord : TEXCOORD0,
             uniform float4 texpad_originalmap,
             uniform float4x4 mat_modelproj)
{
    l_position = mul(mat_modelproj, vtx_position);
    l_texcoord = (vtx_position.xz * texpad_originalmap.xy) + texpad_originalmap.xy;
}



void fshader(float2 l_texcoord : TEXCOORD0,
             uniform sampler2D k_originalmap : TEXUNIT1,
             uniform sampler2D k_lineardepth : TEXUNIT2,
             out float4 o_color : COLOR)
{

    float4 scene = tex2D(k_originalmap, l_texcoord);
    float lineardepth = tex2D(k_lineardepth, l_texcoord).x;
    
    float4 color = scene;
    
    float4 gray = 0.30*color.x + 0.59*color.y + 0.11*color.z;
    
    color.r *= scene.r * 1/lineardepth; // nearer objects are warmer in color
    color.g = scene.g;
    color.b *= scene.b * lineardepth; // further objects are colder in color
    
    color *= gray * lineardepth; // further objects lose saturation
    
    color /= lineardepth; // test
    color += lineardepth; // further objects are whiter (should be background color)
    
    o_color =  color; // output

}