here is a simple implementation of adjacency aware blur running over texture seams.
“` #bind layer src? val=0 #bind layer &tmp val=0 #bind layer adjacency? val=0 #bind layer &blur
@KERNEL { if (@Iteration==0) { @tmp.set(@src); } else { float4 sum=(float4)(0); for (int i=-@pixels; i<=@pixels;i++) { float2 uv= (@adjacency.bufferIndex((int2)(@ix+i,@iy)).xy); float4 px= (@blur.bufferSample(uv*(float2)(@xres,@yres)-(float2)(0.5f,0.5f))); sum+=px; } sum/=@pixels+@pixels+1;
@tmp.set(sum); } }
@WRITEBACK {
float4 sum=(float4)(0); for (int i=-@pixels; i<=@pixels;i++) { float2 uv= (@adjacency.bufferIndex((int2)(@ix,@iy+i)).xy); float4 px= (@tmp.bufferSample(uv*(float2)(@xres,@yres)-(float2)(0.5f,0.5f))); sum+=px; } sum/=@pixels+@pixels+1;
@blur.set(sum); } “`
bind “pixels” as int in the bindings tab. src and adjacency as inputs blur and tmp as outputs. enable writeback and include iterations.
you need the adjacency rasterizer i made a while back for the adjacency input…
now this is a pretty dogshit blur implementation mostly as proof of concept but it does blur the image so there’s that.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20253311/07/25/houdini_XnfFGtckSi.mp4