Code Snippet: Radial Blur shader

This short code snipped will show how to make a simple radial blur as a post effect pass. The effect is cool and the code is preeeetty simple.

If you are in XNA, you can use it in spritebatch (make a shader with a pixel shader only, set it and call the classic spritebatch to draw the image) or you can use in DirectX, Opengl (minor changes)

sampler TextureSampler : register(s0);

float2 Center = { 0.5, 0.5 }; ///center of the screen (could be any place)
float BlurStart = 1.0f; /// blur offset
float BlurWidth = -0.1; ///how big it should be
int nsamples = 10;

float4 PS_RadialBlur(float2 UV	: TEXCOORD0 ) : COLOR
    UV -= Center;
    float4 c = 0;
    for(int i=0; i <nsamples; i++) {
    	float scale = BlurStart + BlurWidth*(i/(float) (nsamples-1));
    	c += tex2D(TextureSampler, UV * scale + Center );
   	c /= nsamples;
    return c;

Experiment changing the nsamples parameter. You can also put it as a uniform variable and force the compiler to unroll the for loop =P

Enjoy !


  1. #1 by young squirt on 9 de dezembro de 2016 - 11:32 am

    Very good blog article.Really thank you! Really Great.

  2. #2 by oxy on 9 de dezembro de 2016 - 12:25 pm

    689378 116891I adore reading and I conceive this website got some genuinely utilitarian stuff on it! . 646420

  3. #3 by on 9 de dezembro de 2016 - 12:33 pm

    It is the Chinese wayI kid you not sometimes our clients give absolutely no notice.They are paranoid travellers. Check the 50 strong delegation.You should check if they are bringing their own guns as well. Seriously. These blokes do not fuck around with security, or leave it to other Police forces.

  4. #4 by auto leasing kredit ändern on 9 de dezembro de 2016 - 1:12 pm

    pisze:Moim zdaniem Polska nie jest gotowa na programy pokroju Masterchef.Primo – najważniejszy jest dobór jurySecundo – najważniejsi sÄ… uczestnicyTertio – najważniejszy jest widzA u nas moim zdaniem nie ma dużej iloÅ›ci ani odbiorców, ani uczestników z których można byÅ‚oby przebrać…A jury, które zostaÅ‚o dobre, nawet nie wspomnÄ™. Nie rozumiem czemu z Magdy ktoÅ› (ona sama?) stara siÄ™ robić drugiego Gordona – nie ten charakter.OceÅ„ komentarz 3  0

  5. #5 by nox app player download on 9 de dezembro de 2016 - 1:26 pm

    I have read some excellent stuff here. Certainly price bookmarking for revisiting. I wonder how so much attempt you place to create one of these wonderful informative web site.

  6. #6 by fantasy flex vibrator on 9 de dezembro de 2016 - 1:43 pm

    one of our visitors lately encouraged the following website

  7. #7 by free pc games download full version for windows 8 on 9 de dezembro de 2016 - 2:00 pm

    Nice post. I study something more difficult on totally different blogs everyday. It can all the time be stimulating to learn content material from other writers and apply a bit one thing from their store. I’d prefer to make use of some with the content material on my weblog whether you don’t mind. Natually I’ll offer you a hyperlink on your net blog. Thanks for sharing.

  8. #8 by lewisville tx dentist on 9 de dezembro de 2016 - 2:23 pm

    Undeniably believe that that you said. Your favorite justification seemed to be at the web the simplest factor to take note of. I say to you, I certainly get annoyed even as people consider worries that they plainly don’t realize about. You controlled to hit the nail upon the highest and defined out the whole thing with no need side effect , other folks can take a signal. Will likely be again to get more. Thank you|

  9. #9 by on 9 de dezembro de 2016 - 2:54 pm

    C’est des articles cachés. Si tu clics en séquence sur les boutons haut, bas, smiley , simley et smiley , tu auras un nouveau bouton qui te permettra d’accéder au site secret de Darth (le côté obscure de la photo, la où il nous dévoile ses plans de conquête du monde à la minus et cortex). Non promis, j’ai rien fumé …

  10. #10 by cosmetic dentist lewisville on 9 de dezembro de 2016 - 3:26 pm

    You can definitely see your skills within the article you write. The sector hopes for even more passionate writers such as you who are not afraid to say how they believe. At all times go after your heart.|

  11. #11 by on 9 de dezembro de 2016 - 3:47 pm

    A rolling stone is worth two in the bush, thanks to this article.

  12. #12 by kreditangebot niedrig zins rechner on 9 de dezembro de 2016 - 4:19 pm

    Ho, ho, Fed a l’air très puissant, il ne veut pas traîner et se méfie de Gasquet. Dans ce jeu, quand il a décidé de faire le break, il hausse son niveau de jeu subitement. Impressionnant.

  13. #13 by Freeman Becton on 9 de dezembro de 2016 - 4:19 pm

    I’m gratified by the manner in which deals with this type of issue! Generally on point, sometimes controversial, without fail well-written and also stimulating.

  14. #14 by dentist lewisville on 9 de dezembro de 2016 - 4:32 pm

    Quality content is the important to invite the people to go to see the website, that’s what this website is providing.|

  15. #15 by Parker Schmelzle on 9 de dezembro de 2016 - 4:34 pm

    In my estimation, does a excellent job of dealing with subject matter of this kind! While often deliberately controversial, the material posted is more often than not well-written and thought-provoking.

  16. #16 by american potrošački kredit izračun on 9 de dezembro de 2016 - 5:07 pm

    d3jau nera tokio dalyko, kaip Microsoft "antifanai"… tiesiog, kai kuri toki slamsta fanu nera:D comon… su tokiu biudzetu, koki turi Ms ju offisas turetu buti superine programa… kolkas nemokamas OpenOffice daro ji per visus galus… apie windowsus isvis net nesnekam geriau (nebent labai nori pasigirti, kad Win7 JAU "panasus" i zmoniska OS 😀 )… zdz, valio Microsoftui! 😀

  17. #17 by beamtenkredit ohne o2 on 9 de dezembro de 2016 - 5:11 pm

    My husband and i have been really fortunate Jordan could do his preliminary research from your ideas he acquired using your blog. It’s not at all simplistic to just choose to be giving away steps many people have been selling. We keep in mind we’ve got the website owner to appreciate because of that. The entire explanations you made, the simple blog navigation, the relationships you will aid to promote – it is mostly astounding, and it’s really making our son in addition to our family reckon that this subject is cool, which is certainly truly mandatory. Thank you for everything!

  18. #18 by lewisville dentists on 9 de dezembro de 2016 - 5:13 pm

    I’m gone to inform my little brother, that he should also go to see this webpage on regular basis to obtain updated from hottest news update.|

  19. #19 by insurance car on 9 de dezembro de 2016 - 7:36 pm

    Var glad Ã¥t att de finns skickliga inomhus spelare i stan istället för att lipa. Killen har ju vart turneringen spelare 2gÃ¥nger de senaste 4 lm som har vart. Neej inte jag som säger de utan de finns pÃ¥ lm’s hemsida. Derby eller linghem vinner allt

  20. #20 by j & n moving company on 9 de dezembro de 2016 - 8:50 pm

    we like to honor several other world wide web sites on the net, even though they arent linked to us, by linking to them. Below are some webpages worth checking out

  21. #21 by kredit kondition baudarlehen sparkasse on 9 de dezembro de 2016 - 9:59 pm

    This does look promising. I’ll keep coming back for more.

  22. #22 by on 9 de dezembro de 2016 - 10:20 pm

    Rien à voir : mais c’est bein alors Valentine’s day ? j’hésitais à aller le voir mais si ça t’as plu… mais bon, je planquerais bien mon portable !

  23. #23 byänger.html on 9 de dezembro de 2016 - 10:29 pm

    asc wr wb dhamaan walaaha webka iyo masuulka walaalkeen jimcaale intaa ka dib walaal waxaan soo guursaday nin 2 sano ka hor foom buu soo xareestay waala i diiday miyaanan xaq u laheen lamaanaha in la isu keenoU codee: 0  0

  24. #24 by on 9 de dezembro de 2016 - 10:43 pm

    Your articles are for when it absolutely, positively, needs to be understood overnight.

  25. #25 by Balers on 10 de dezembro de 2016 - 12:03 am

    Sites of interest we have a link to

  26. #26 by on 10 de dezembro de 2016 - 3:04 am

    Your answer shows real intelligence.

  27. #27 byög.html on 10 de dezembro de 2016 - 3:21 am

    The problem with White people is we are too damned nice. We don’t see these activities as attacks on us, as a people, because our brains aren’t wired in the devious ways, that our enemies are.

  28. #28 by on 10 de dezembro de 2016 - 3:55 am

    That’s a knowing answer to a difficult question

  29. #29 by on 10 de dezembro de 2016 - 6:57 am

    If I communicated I could thank you enough for this, I’d be lying.

  30. #30 by on 10 de dezembro de 2016 - 7:58 am

    I solve group every the concepts you have untaken for your send. They’re truly credible and will of course labor. At rest, the posts are same remit for beginners. Might immediately you entertain make longer them a bit from subsequently time? Thanks for the post.

  31. #31 by on 10 de dezembro de 2016 - 8:04 am

    The expertise shines through. Thanks for taking the time to answer.

1 181 182 183
(não será publicado)