uniform float4x4 ViewProj; uniform texture2d image; uniform float elapsed_time; uniform float2 uv_offset; uniform float2 uv_scale; uniform float2 uv_pixel_interval; uniform float rand_f; uniform float2 uv_size; uniform float4x4 ViewProj; uniform texture2d image; uniform float elapsed_time; uniform string notes = "Sharpness: -0.84, StartSmoothingWeight = 1, MinFilterWeight = 0, MaxFilterWeight = 1, Smoothing = 0, ScalingFactor = 0.25"; uniform float Sharpness = -0.25; // use positive values to get blurry pixels, use negative values to get clean smooth results uniform float StartSmoothingWeight = 1.00; // start smoothing eight uniform float MaxFilterWeight = 0.75; // max filter weigth uniform float MinFilterWeight = 0.25; // min filter weigth uniform float Smoothing = 0.33; // effects smoothing uniform float ScalingFactor = 0.25; // donwsampling 4x in size uniform float SamplingPointScale1 = 0.5; sampler_state textureSampler { Filter = Linear; AddressU = Border; AddressV = Border; BorderColor = 00000000; }; struct VertData { float4 pos : POSITION; float2 uv : TEXCOORD0; }; VertData mainTransform(VertData v_in) { VertData vert_out; vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj); vert_out.uv = v_in.uv * uv_scale + uv_offset; return vert_out; } float4 mainImage(VertData v_in) : TARGET { float2 uv = v_in.uv; float4 color = image.Sample(textureSampler, v_in.uv ); float3 c = color.xyz; float x = 0.5 * (1.0 / uv_size.x/ScalingFactor); float y = 0.5 * (1.0 / uv_size.y/ScalingFactor); const float3 dt = 1.0 * float3(1.0, 1.0, 1.0); float2 dg1 = float2( x, y); float2 dg2 = float2(x, -y); float2 sd1 = dg1*SamplingPointScale1; float2 sd2 = dg2*SamplingPointScale1; float2 ddx = float2( x, 0.0); float2 ddy = float2( 0.0, y); float4 t1 = float4(uv-sd1,uv-ddy); float4 t2 = float4(uv-sd2,uv+ddx); float4 t3 = float4(uv+sd1,uv+ddy); float4 t4 = float4(uv+sd2,uv-ddx); float4 t5 = float4(uv-dg1,uv-dg2); float4 t6 = float4(uv+dg1,uv+dg2); float3 i1 = image.Sample(textureSampler, t1.xy).xyz; float3 i2 = image.Sample(textureSampler, t2.xy).xyz; float3 i3 = image.Sample(textureSampler, t3.xy).xyz; float3 i4 = image.Sample(textureSampler, t4.xy).xyz; float3 o1 = image.Sample(textureSampler, t5.xy).xyz; float3 o3 = image.Sample(textureSampler, t6.xy).xyz; float3 o2 = image.Sample(textureSampler, t5.zw).xyz; float3 o4 = image.Sample(textureSampler, t6.zw).xyz; float3 s1 = image.Sample(textureSampler, t1.zw).xyz; float3 s2 = image.Sample(textureSampler, t2.zw).xyz; float3 s3 = image.Sample(textureSampler, t3.zw).xyz; float3 s4 = image.Sample(textureSampler, t4.zw).xyz; float ko1 = dot(abs(o1-c),dt); float ko2 = dot(abs(o2-c),dt); float ko3 = dot(abs(o3-c),dt); float ko4 = dot(abs(o4-c),dt); float k1=min(dot(abs(i1-i3),dt),max(ko1,ko3)); float k2=min(dot(abs(i2-i4),dt),max(ko2,ko4)); float w1 = k2; if(ko3