Original Post
This is the shader i am using to satisfy the needs of a final scene colors,
tex1 - 1024x768 texture obtained from frame buffer of the whole scene
tex2 - 1024/2 x 768/2 texture obtained from frame buffer and dowsampled
The issue here is the FPS when combining two of those textures at the end.
I have managed to find out that when i pass
i get around 120FPS in a very dense and ultra detailed scene.
But when i combine both tex1 and tex2 my FPS is getting bottlenecked to ~70FPS.
The texture operation
Takes around 2FPS,
the problem is the last gl_FragColor operation,
why does it slow down so much when it comes up to combine those two textures?
tex1 - 1024x768 texture obtained from frame buffer of the whole scene
tex2 - 1024/2 x 768/2 texture obtained from frame buffer and dowsampled
uniform sampler2D tex2;uniform sampler2D tex1; vec4 finalColor;int KERNEL_SIZE_A=4;int KERNEL_SIZE_B=3; void main(){ float POWER=0.35; vec4 sum = vec4(0); vec2 texcoord = vec2(gl_TexCoord[1]); int j; int i; for( i= -KERNEL_SIZE_A ;i <KERNEL_SIZE_A; i++) { for (j = -KERNEL_SIZE_B; j < KERNEL_SIZE_B; j++) { sum += texture2D(tex1, texcoord + vec2(j, i)*0.004) * POWER; } } if (texture2D(tex1, texcoord).r < 0.3) { finalColor = sum*sum*0.012 + texture2D(tex1, texcoord); } else { if (texture2D(tex1, texcoord).r < 0.5) { finalColor = sum*sum*0.009 + texture2D(tex1, texcoord); } else { finalColor = sum*sum*0.0075 + texture2D(tex1, texcoord); } } gl_FragColor= texture2D(tex2, gl_TexCoord[2])* finalColor;}The issue here is the FPS when combining two of those textures at the end.
I have managed to find out that when i pass
//set the 1024x768 normal texture without bloom appliedgl_FragColor= texture2D(tex2, gl_TexCoord[2]);i get around 120FPS in a very dense and ultra detailed scene.
But when i combine both tex1 and tex2 my FPS is getting bottlenecked to ~70FPS.
The texture operation
float POWER=0.35; vec4 sum = vec4(0); vec2 texcoord = vec2(gl_TexCoord[1]); int j; int i; for( i= -KERNEL_SIZE_A ;i <KERNEL_SIZE_A; i++) { for (j = -KERNEL_SIZE_B; j < KERNEL_SIZE_B; j++) { sum += texture2D(tex1, texcoord + vec2(j, i)*0.004) * POWER; } } if (texture2D(tex1, texcoord).r < 0.3) { finalColor = sum*sum*0.012 + texture2D(tex1, texcoord); } else { if (texture2D(tex1, texcoord).r < 0.5) { finalColor = sum*sum*0.009 + texture2D(tex1, texcoord); } else { finalColor = sum*sum*0.0075 + texture2D(tex1, texcoord); } } Takes around 2FPS,
the problem is the last gl_FragColor operation,
why does it slow down so much when it comes up to combine those two textures?