hi everyone, after 2 month learning unreal engine, it s time to share a bit to a community that teach me a lot.
so here are a few HLSL blurs code for the material editor’s custom node.
those are non kernel non ponderated blurs for now.
you can find them here : http://expose-pictures.fr/unrealengine/blurs.zip
here is hot to setup them :
and a sample render of the box blur :
what you have to know :
- i’m no hlsl pro coder
-there are of 2 types alpha and non alpha.
the non alpha will blur the whole frame, and the alpha only where alpha > 0(the samples are reduced to 1 where alpha = 0 getting the computation lower on the non blurred parts) - the box blur is a bit slow to render has it takes a lot of samples (2*samples²+1). so it my not be used during gameplay tasks.
-the sample amount is limited to 12 to avoid driver crashes as some blurs use lots of samples.
-the clamp aim at reducing the artifacts generated by the borders as the scene texture UV are non 0-1 range (for the screen ). i did this cause calculating the UV requires a lot of calculations, but if you have an other idea to fix it just tell me.
Things to add :
in the future , i will add a ponderation (probably sin based) of the samples to achieve a gaussian-like look.
if you have any idea of what i can add, feel free to ask ! and thanks for all you have shared for us !