float Cycles = 25;
float c = 1.0f / (3.14159f * BlurAmount);
float4 Blur = float4(0, 0, 0, 1);
if (BlurAmount < 2) return SceneTextureLookup(UV, floor(BufferIndex), true);
[unroll(Cycles)]
for (int i = 0; i < Cycles; ++i) {
float e = -(i * i) / (BlurAmount);
float falloff = (c * exp(e));
float e2 = -((i + 1) * (i + 1)) / (BlurAmount);
float falloff2 = (c * exp(e2));
float combinedFalloff = falloff + falloff2;
float Offset = falloff2 / combinedFalloff;
float2 UVOffset = PixelSize * (i + Offset);
Blur +=
(SceneTextureLookup(UV + float2(UVOffset.x, 0), BufferIndex, true)
+ SceneTextureLookup(UV + float2(0, UVOffset.y), BufferIndex, true)
+ SceneTextureLookup(UV + float2(UVOffset.x, UVOffset.y), BufferIndex, true)
+ SceneTextureLookup(UV + float2(UVOffset.x, -UVOffset.y), BufferIndex, true)) * combinedFalloff;
}
return (Blur * clamp(13 - BlurAmount, 2, 12) * BlurAmount) / (32 + BlurAmount / Cycles);
Hey everyone!
So i’m trying to use this code with a material exactly like you pictured (had no luck putting it into material function, it complains about SceneTexture node). And what i get as a result is that editor crashes when i enter post process volume with this mat assigned. Can anyone help?