External Publication
Visit Post

CartoonEdgeFilter makes the entire background black

jMonkeyEngine Hub February 20, 2026
Source

I have a working solution now, at the end of the shader I did this:

   float alpha=fetchTextureSample(m_DepthTexture,   texCoord, 0).r;
   if (alpha>.99f ) alpha=edgeAmount;
   else alpha=1;

    gl_FragColor = vec4( color,  alpha);

What it does, is reading the depth and if that is beyond a certain treshold, then I cut it of. Otherwise I set it to 1. When cutting of, I use the calculated edge value to smoothen the cutoff.

I don’t like this solution, I can not stand that the color buffer has no transparancy. I just don’t understand where that went wrong.

Discussion in the ATmosphere

Loading comments...