Sign in to follow this  
ucfchuck

stupid pixel shader question

Recommended Posts

i thought a pixel shader was meant to shade pixels which it sometimes seems to, but when i try various simple blurring algorithms to smooth images like //-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- float4 PS( PS_INPUT input) : SV_Target { float4 p1 = txDiffuse.Sample(samLinear, input.Tex, int2(-1,1)); float4 p2 = txDiffuse.Sample(samLinear, input.Tex, int2(-1,0)); float4 p3 = txDiffuse.Sample(samLinear, input.Tex, int2(-1,-1)); float4 p4 = txDiffuse.Sample(samLinear, input.Tex, int2(0,-1)); float4 p5 = txDiffuse.Sample(samLinear, input.Tex, int2(0,1)); float4 p6 = txDiffuse.Sample(samLinear, input.Tex, int2(1,1)); float4 p7 = txDiffuse.Sample(samLinear, input.Tex, int2(1,0)); float4 p8 = txDiffuse.Sample(samLinear, input.Tex, int2(1,-1)); float4 p9 = txDiffuse.Sample(samLinear, input.Tex); float4 p10 = txDiffuse.Sample(samLinear, input.Tex, int2(-2,-2)); float4 p11 = txDiffuse.Sample(samLinear, input.Tex, int2(2,-2)); float4 p12 = txDiffuse.Sample(samLinear, input.Tex, int2(2,2)); float4 p13 = txDiffuse.Sample(samLinear, input.Tex, int2(-2,2)); return (((p10+p11+p12+p13)/36)+ ((p1+p3+p6+p8)/18)+((p2+p4+p5+p7)/12)+ ((p9/9)*3)); } it doesnt blur based on the pixels, it blurs based on texels, so how can i blur based on pixels???

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this