So I wrote my first 2D filter, attempting to create a nice bloom filter with Gaussian blur (by blurring a lower resolution).
Didn’t work out too well, but I guess it’s a start.
any critique/inefficiency remarks would be appreciated to I can improve!
I also wanted to replace each kernel with a filled circle and attempted using abs(i)*abs(j) < sample_size to determine which pixels are glowing but it didn’t seem to work.
blur_size = how much space the bloom is stretched out across
threshold = minimum pixel value to be able to receive bloom
blur_sample = how much blurring there is
The filter is based on the current display resolution!
You’ll have to have some understanding of GLSL. Here’s a blend file of mine that does sort of what you’re looking for. lightsaber.blend (14.1 MB)
Beware: This piece of junk is NOT optimized. My laptop GPU can’t handle this. It also doesn’t work on the blenderplayer for some reason.
Basically what I did is do a RenderToTexture on the 16:9 plane, where each objects GLSL program is set to black EXCEPT the ones that have the property “saberBlade”. Then I bound the texture to a filter using the glBindTexture function and then did a really expensive blur on that texture, and added it to the main render.
This pixelated bloom 2D filter may actually be what I need to optimize this
Well the filter itself isn’t terribly efficient either. it still runs in standard o(n^2) time which is quite costly, it just allows you to stretch out the result without having to increase the amount of sampling. Other algorithms also exist but require multiple passes, which I’m unsure how to do in GLSL at the moment without running multiple 2d filters?
A really useful intel article sums this up quite well with performance graphs etc. Read more about it here