External Publication
Visit Post

CartoonEdgeFilter makes the entire background black

jMonkeyEngine Hub February 20, 2026
Source

I forked it, but preserving the alpha does not work. It seems to be 1.0 already.

Here is how I tested that:

At the start of the main routine of the shader I did this:

    vec4 orig = getColor(m_Texture, texCoord);
    vec3 color = orig.rgb;

So now orig.a is alpha. Then the shader does some magic with the color vec and at the end I do this:

gl_FragColor = vec4( orig.a, color.g , color.b, 0.5);

The image below is the result: and as you can see, red is always there. So it is save to say orig.a - the original alpha - is always 1.0f

And to be complete: i did set the background to be transparent:

        ViewPort offView = renderManager.createPreView("OffscreenView", cam.clone());
        offView.setClearFlags(false, true, true);
        offView.setBackgroundColor(new ColorRGBA(0, 0, 0, 0)); // Transparant!

So, why does it give me alpha is 1.0?

Discussion in the ATmosphere

Loading comments...