PDA

View Full Version : Bad quality bloom



Kdeon0
04-13-2014, 03:35 AM
Hey guys,

Is there a way to make a good quality bloom ?

I have increased the bloom samples because it left trails (interlaced) before with radius 13.37. It looks like a 8-bit bloom ( RadiusY=13.37, intensity = 4 ) :

1264

Direct link : zupimages.net/up/14/15/wb9i.png

The blur shader looks like this (from qeffects-gl) :



static const char g_szVertexShader_BloomBlur[] =
"#extension GL_ARB_texture_rectangle : enable\n"
"precision mediump float;\n"
"uniform vec4 Local0;\n"
"varying vec4 texCoord[16];\n"
"void main(void)\n"
"{\n"
"texCoord[0] = gl_MultiTexCoord0 + Local0;\n"
"texCoord[1] = gl_MultiTexCoord0 + Local0 * 1.250;\n"
"texCoord[2] = gl_MultiTexCoord0 + Local0 * 1.375;\n"
"texCoord[3] = gl_MultiTexCoord0 + Local0 * 1.500;\n"
"texCoord[4] = gl_MultiTexCoord0 + Local0 * 1.625;\n"
"texCoord[5] = gl_MultiTexCoord0 + Local0 * 1.750;\n"
"texCoord[6] = gl_MultiTexCoord0 + Local0 * 1.875;\n"
"texCoord[7] = gl_MultiTexCoord0 + Local0 * 2.000;\n"
"texCoord[8] = gl_MultiTexCoord0 - Local0;\n"
"texCoord[9] = gl_MultiTexCoord0 - Local0 * 1.250;\n"
"texCoord[10] = gl_MultiTexCoord0 - Local0 * 1.375;\n"
"texCoord[11] = gl_MultiTexCoord0 - Local0 * 1.500;\n"
"texCoord[12] = gl_MultiTexCoord0 - Local0 * 1.625;\n"
"texCoord[13] = gl_MultiTexCoord0 - Local0 * 1.750;\n"
"texCoord[14] = gl_MultiTexCoord0 - Local0 * 1.875;\n"
"texCoord[15] = gl_MultiTexCoord0 - Local0 * 2.000;\n"
"gl_Position = ftransform();\n"
"}\n";

static const char g_szFragmentShader_BloomBlur[] =
"#extension GL_ARB_texture_rectangle : enable\n"
"precision mediump float;\n"
"uniform sampler2DRect Texture0;\n"
"varying vec4 texCoord[16];\n"
"void main(void)\n"
"{\n"
"vec3 col1 = texture2DRect(Texture0, texCoord[0].xy).rgb;\n"
"vec3 col2 = texture2DRect(Texture0, texCoord[1].xy).rgb;\n"
"vec3 col3 = texture2DRect(Texture0, texCoord[2].xy).rgb;\n"
"vec3 col4 = texture2DRect(Texture0, texCoord[3].xy).rgb;\n"
"vec3 col5 = texture2DRect(Texture0, texCoord[4].xy).rgb;\n"
"vec3 col6 = texture2DRect(Texture0, texCoord[5].xy).rgb;\n"
"vec3 col7 = texture2DRect(Texture0, texCoord[6].xy).rgb;\n"
"vec3 col8 = texture2DRect(Texture0, texCoord[7].xy).rgb;\n"
"vec3 col9 = texture2DRect(Texture0, texCoord[8].xy).rgb;\n"
"vec3 col10 = texture2DRect(Texture0, texCoord[9].xy).rgb;\n"
"vec3 col11 = texture2DRect(Texture0, texCoord[10].xy).rgb;\n"
"vec3 col12 = texture2DRect(Texture0, texCoord[11].xy).rgb;\n"
"vec3 col13 = texture2DRect(Texture0, texCoord[12].xy).rgb;\n"
"vec3 col14 = texture2DRect(Texture0, texCoord[13].xy).rgb;\n"
"vec3 col15 = texture2DRect(Texture0, texCoord[14].xy).rgb;\n"
"vec3 col16 = texture2DRect(Texture0, texCoord[15].xy).rgb;\n"
"gl_FragColor.rgb = gl_FragColor.rgb / 16.0;"
"gl_FragColor.rgb = (col1 + col2 + col3 + col4 + col5 + col6 + col7 + col8 + col9 + col10 + col11 + col12 + col13 + col14 + col15 + col16) / 16.0;\n"
"gl_FragColor.a = 1.0;\n"
"}\n";


I'm not sure what newest games use to make a perfect high quality performances bloom :S

Any ideas ?

Alphaomega86
05-07-2014, 11:22 AM
Hey,

I am not 100% sure, but i think modern game engines use
special materials on models which should get a bloom effect.

Those materials are RGB textures which contain the luminance factors, the
colors, of the bloom or glow effect. The resulting
scene texture which only contains the luminance factors will get the bloom effect
and will be combined with the diffuse scene texture.

This technique is a pretty simple post processing effect which has actually a good
performance too.

I think gamasutra explains this technique really well:
http://www.gamasutra.com/view/feature/2107/realtime_glow.php

- Daniel