Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Bloom effect without rendertargets  (Read 2687 times)

0 Members and 1 Guest are viewing this topic.

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Bloom effect without rendertargets
« on: December 24, 2011, 01:50:49 am »
Hi, is there anyway to achieve a bloom effect without the use of renderTargets?
I am currently using an intel graphics card and having a rendertarget makes the progrm crash

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Bloom effect without rendertargets
« Reply #1 on: December 24, 2011, 02:13:25 am »
Im currently using this shader but it doesnt do much, and when i change the values it screws the image

Code: [Select]
#version 120

uniform sampler2D framebuffer;
#define glaresize 0.008 // 0.008 is good
#define power 0.5 // 0.50 is good

void main()
{
   vec4 sum = vec4(0);
   vec4 bum = vec4(0);
   vec2 texcoord = vec2(gl_TexCoord[0]);
   int j;
   int i;

   for( i= -2 ;i < 2; i++)
   {
        for (j = -1; j < 1; j++)
        {
            sum += texture2D(framebuffer, texcoord + vec2(-i, j)*glaresize) * power;
         bum += texture2D(framebuffer, texcoord + vec2(j, i)*glaresize) * power;            
        }
   }
       if (texture2D(framebuffer, texcoord).r < 2.0f)
    {
       gl_FragColor = sum*sum*sum*0.0080+bum*bum*bum*0.0080+ texture2D(framebuffer, texcoord);
    }
}

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Bloom effect without rendertargets
« Reply #2 on: December 24, 2011, 10:57:46 am »
ERhm okay that shouldn't give you bloom effect at all. Bloom is a multi-pass technique. You have to go trough several shaders several times before you can achieve the effect. Now different people do it differently. But yes you have to have several render textures to do it. At least 2 at any time.

The different techniques most common are down sampling, Gaussian blur, brightening and then the combination. If you want I could get you my own bloom technique which is based on Bungies for Halo.

Just from the top of my head I think it was, Down sampling, blur, down sampling, blur brightening and then combination. Not 100% sure. And all my code is at the university so.

And if you apply HDR or SRGB then it becomes even more complex.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Bloom effect without rendertargets
« Reply #3 on: December 24, 2011, 06:29:20 pm »
If thats possible that would be great :)
However if it uses renderTextures I wont be able to use it untill SFML2.1 (or once laurent fixes the intel bug)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Bloom effect without rendertargets
« Reply #4 on: December 24, 2011, 10:43:30 pm »
Well since it's post-render effect you could somehow maybe manage it. If you copy the screen into a texture and bind it in between passes. Then you could do it actually. I think. So you use your screen as the source render texture :P Though that means if it lags, the "progress" of the effect will be visible.... But you can have it like that until the bug is fixed ;)
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

 

anything