Hi all,

I'm still struggling with this and just wanted to add some extra details.

The problem is that the blur around text near the camera is not being combined 
with blur further back. It's almost like the blur is being drawn from front to 
back while text (rendered as glyphs with alpha channel) are being drawn from 
back to front. Is that possible?

I imagine that this would need to be fixed on the shader side. ie, in 
depth_of_field_fp.glsl (?):


Code:
void main(void)
{
    vec2 inTex = gl_TexCoord[0].st;

    // compute distance to the viewer
    float a = zFar / ( zFar - zNear );
    float b = zFar * zNear / ( zNear - zFar );

    float depth = texture2D( texDepthMap, inTex ).x;
    float dist = b / ( depth - a );

    // get color map and blurred color map values
    vec4 colorValue = texture2D (texColorMap, inTex).rgba;
    vec4 blurredValue1 = texture2D ( texBlurredColorMap, inTex).rgba;
    vec4 blurredValue2 = texture2D ( texStrongBlurredColorMap, inTex).rgba;

    // now compute the bluriness value
    float blur = clamp(abs(dist - focalLength) / focalRange, 0.0, 1.0);
    float factor1 = 1.0;
    float factor2 = 0.0;

    // compute blend factors
    if (blur > 0.5)
        factor2 = (blur - 0.5) * 2.0;
    else
        factor1 = blur * 2.0;

    // the resulting color value is the combination of blurred and non-blurred 
map
    vec4 result = mix(colorValue, blurredValue1, factor1);
    gl_FragColor = mix(result, blurredValue2, factor2);
}



ie, will gl_FragColor correctly combine previously drawn alpha values?

Any help would be greatly appreciated.

-Mike

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48497#48497





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to