Sign in to follow this  
mpan3

Blur/Bloom in pixel shaders

Recommended Posts

mpan3    122
I've been playing around with FarCry's postprocessing shader and wanted to creat a better bloom effect, but it seems my noobishness is getting in the way... Can't get the blur to work. I've removed the code for OGL pathway (and my foolish code)... but the code is still copyrighted by Crytek! // Coder: Tiago Sousa (c) Crytek! #include "../CGVPMacro.csi" MainInput { #ifdef D3D uniform sampler2D ScreenTex : texunit0, uniform sampler2D ScreenBluredTex : texunit1 #endif } DeclarationsScript { struct vertout { OUT_T0 OUT_T1 }; FOUT } CoreScript { #ifdef D3D // get screen float4 fScreenColor = tex2D(ScreenTex, IN.Tex0.xy); // get screen blured map float4 fScreenColorBlured = tex2D(ScreenBluredTex, IN.Tex1.xy); #endif float3 vUnsharpMask=(fScreenColor.xyz+fScreenColorBlured.xyz); OUT.Color.xyz = vUnsharpMask.xyz; OUT.Color.a = 1; } "ScreenBluredTex" is really too pixelated and i wanted to do a horizontal guass filter on it, but how?

Share this post


Link to post
Share on other sites
mpan3    122
Something Like this:

for( int i = 0; i < 8; ++i )
{
float4 fScreenColor += tex2D(ScreenTex, IN.Tex0.x+i*0.001);
}

It doesn't work, won't even compile. Isn't tex coordinate a value between -1 and 1?

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