Improving the efficiency of my bloom/glow shader
Posted
by
user1157885
on Game Development
See other posts from Game Development
or by user1157885
Published on 2013-10-21T19:56:00Z
Indexed on
2013/10/21
22:05 UTC
Read the original article
Hit count: 248
I'm making a neon style game where everything is glowing but the glow I have is kinda small and I want to know if there's an efficient way to increase the size of it other than increasing the pixel sample iterations.
Right now I have something like this:
float4 glowColor = tex2D(glowSampler, uvPixel);
//Makes the inital lines brighter/closer to white
if (glowColor.r != 0 || glowColor.g != 0 || glowColor.b != 0)
{
glowColor += 0.5;
}
//Loops over the weights and offsets and samples from the pixels based on those numbers
for (int i = 0; i < 20; i++)
{
glowColor += tex2D(glowSampler, uvPixel + glowOffsets[i] + 0.0018) * glowWeights[i];
}
finalColor += glowColor;
for the offsets it moves up, down, left and right (5 times each so it loops over 20 times) and the weights just lower the glow amount the further away it gets.
The method I was using before to increase it was to increase the number of iterations from 20 to 40 and to increase the size of the offset/weight array but my computer started to have FPS drops when I was doing this so I was wondering how can I make the glow bigger/more vibrant without making it so CPU/Gcard intensive?
© Game Development or respective owner