Sign in to follow this  
akhin

Chromatic Aberration

Recommended Posts

Hi ,

As for this effect , I am trying to find a nice way to make "horizontal/vertical leak lines" to disappear.

( Horizontal example : http://active.tutsplus.com/tutorials/effects/create-a-retro-crt-distortion-effect-using-rgb-shifting/
2nd cat photo in the page )

( Vertical example : [url="http://www.youtube.com/watch?v=2Fc4b4mokL4"]http://www.youtube.com/watch?v=2Fc4b4mokL4[/url] )

So for such an effect like this , how would you suggest me to implement it ?
( Not asking how to do it , but asking what to do )

Many thanks

Share this post


Link to post
Share on other sites
Looks like you could pull that off with storing a certain number of frame buffers, then colorizing them how ever you'd like, then when you render your frame have each pixel take a weighted average of all the frames. Might be a bit memory heavy though.

Share this post


Link to post
Share on other sites
It's easy (I think [img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img] ):

-Render the scene to a render target.
-In post processing:
Chose 2 random texture offsets (small values) that will be used as offsets to sample the scene texture.
Draw a fullscreen quad and sample the scene texture 3 times:
1 - using no offsets;
2 - using the first texture offset.
3- using the second texture offset.
Ouput the pixel color like this:
[CODE]return float4(sample1.r, sample2.g, sample3.b, 1.0f);[/CODE]

I think this should work.

[CODE]
Texture2D sceneTexture;

SamplerState triLinearSampler;

float4 PS(PSInput pIn) : SV_TARGET
{
float4 sample1 = sceneTexture.Sample(triLinearSampler, pIn.texC, int2(0, 0));
float4 sample2 = sceneTexture.Sample(triLinearSampler, pIn.texC, int2(-5, 0));
float4 sample3 = sceneTexture.Sample(triLinearSampler, pIn.texC, int2(5, 0));

return float4(sample1.r, sample2.g, sample3.b, 1.0f);
}
[/CODE] Edited by TiagoCosta

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