Skip to main content
gamedev.net
🔒 Locked

Gaussian Blur Problems[SOLVED]

Started by Deftoned Jul 20, 2008 at 7:36 AM 0 replies 600+ views
Original Post
Deftoned
Deftoned
Ok so the problem isn't so much with the Gaussian blur, i have it working just fine, the real problem comes when i run my texture, which was obtained through an FBO through a shader which picked out the brighter parts of the texture.
uniform float bloomLimit;    // minimum brightness for bloom
uniform float bloomIntensity; // how bright is the star?
uniform sampler2D sampler0;

void main(void)
{  
    vec4 texel;
    texel =  texture2D(sampler0, gl_TexCoord[0].st);
    vec3 colour = texel.rgb;

    // bright pass: only output colors with some component >= bloomLimit

    //if X < Y then returns Y, else returns X
    //                                X                      Y
    vec3 brightColour = max(colour  - vec3(bloomLimit), vec3(0.0));

    brightColour *= bloomIntensity;

    float bright = dot(brightColour, vec3(1.0));

    bright = smoothstep(0.0, 0.5, bright);

    gl_FragColor = vec4(mix(vec3(0.0),colour , bright), 1.0);
}

When i run this glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F_ARB, FBOWidth, FBOHeight, 0, GL_RGB, GL_FLOAT, 0); texture through the gaussian blur using this method:
glBindTexture(GL_TEXTURE_2D, textHDR);
	glUseProgram(gaussianProg);
	glUniform2fv(offsetsLocBlur, 25, texCoordOffsets);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID2);

	fboStatus = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);

	if(fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT)
	{
		fprintf(stderr, "FBO Incomplete number 2\n");
	}

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 4);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 4);

    glBegin(GL_QUADS);
        glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);
        glVertex2f(-1.0f, -1.0f);
        glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1.0f);
        glVertex2f(-1.0f, 1.0f);
        glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 1.0f);
        glVertex2f(1.0f, 1.0f);
        glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 0.0f);
        glVertex2f(1.0f, -1.0f);
    glEnd();

all i get is a black screen, if i change the texture base and max level to 0 the bright pass still shows up unfortunately it does no blurring. I can only be lead to think that it has something to do with being a 16bit texture, i have no idea though, i will upload a picture if i can manage to get my web space working i can post up pictures of the bright pass. But yeah main problem when the bright pass gets blurred all i get is a black screen. Thanks for any help you can offer. Turns out i wasn't generating mip maps for it...idiot [Edited by - Deftoned on July 20, 2008 8:06:29 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.