Cartoon Edge Filter deletes Background

Hello,



does someone know why the cartoon edge filter deletes my background?

See attached images…



Without Cartoon Filter…



With Cartoon Filter…





Thanks.

Regards,

Equi

is your background a quad ?

Are you using a different viewport for the background?

Possibly, you should to put your “Background” code into simpleUpdate() method…???

Hello,



yes indeed, the background is a simple quad and it is added to a background node with an own viewport. Does this matter?

My update method and some init method looks like this…

[java]

@Override

public void update() {

try {

if (speed == 0 || paused) {

return;

}



super.update();

float tpf = timer.getTimePerFrame() * speed;



secondCounter += timer.getTimePerFrame();

int fps = (int) timer.getFrameRate();

if (secondCounter >= 1.0f) {

fpsText.setText(framesPerSecond + fps);

secondCounter = 0.0f;

}



// update states

stateManager.update(tpf);



// simple update and root node

/**********************************************************

  • UPDATE Code START

    /

    /

  • UPDATE Code END

    /

    backgroundNode.updateLogicalState(tpf);

    rootNode.updateLogicalState(tpf);

    guiNode.updateLogicalState(tpf);



    backgroundNode.updateGeometricState();

    rootNode.updateGeometricState();

    guiNode.updateGeometricState();



    // render states

    stateManager.render(renderManager);

    renderManager.render(tpf);

    /

  • RENDER Code START

    /

    /

  • RENDER Code END

    **********************************************************/

    stateManager.postRender();



    } catch (Exception exception) {

    LOG.log(Level.SEVERE, "Update exception. {0}n{1}", new Object[]{exception.getMessage(), exception.getStackTrace()});//NOI18N

    }

    }



    private void initBackgroundNode() {



    Camera backgroundCamera = new Camera(settings.getWidth(), settings.getHeight());



    backgroundCamera.setFrustumPerspective(45f, (float) backgroundCamera.getWidth() / backgroundCamera.getHeight(), 1f, 1000f);

    backgroundCamera.setLocation(new Vector3f(0f, 0f, 10f));

    backgroundCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

    backgroundCamera.setParallelProjection(true);



    ViewPort backgroundViewPort = renderManager.createPreView("Background ViewPort", backgroundCamera);//NOI18N

    backgroundViewPort.setClearFlags(true, true, true);





    backgroundNode.setQueueBucket(Bucket.Gui);

    backgroundNode.setCullHint(CullHint.Never);



    backgroundViewPort.attachScene(backgroundNode);

    }



    private void initGUINode() {

    guiNode.setQueueBucket(Bucket.Gui);

    guiNode.setCullHint(CullHint.Never);

    guiViewPort.attachScene(guiNode);

    }

    [/java]

    Thanks a lot.



    Regards,

    Equi

The quad has 0 width.

So cartoon edge filter may think you want it “covered”.

I have never used it so i cant answer with certainty.

Filters work on a single viewport, so if you attach a filter to a viewport that has a black back ground the resulting image will have a black background.



try this for your gradient background, that’s a better solution http://hub.jmonkeyengine.org/groups/general-2/forum/topic/background-gradient/?topic_page=2&num=15#post-118379



it will be in the same viewport and it will render fine with filters

Hello,



works perfectly, thanks a lot.

Some other short questions.



1.) Does it matter if I put my “BackgroundGradient” geometry to the root node or to any other node below the root node? It seems to have no effect on the result. why? Because everything is rendered to “infinity”, to the “sky”?



2.) If I remove my background gradient, I have to set clearColor flag in my ViewPort. Is this correct?



3.) I have now realized that I have to put a geometry to queuebucket sky and to cullhint never. If I use a vertexcolormesh material on my geometry and color the indices in my mesh (which is set to sky and never) it is not shown. I used the shader proposed by Nehon



http://hub.jmonkeyengine.org/groups/general-2/forum/topic/background-gradient/?topic_page=2&num=15#post-118379



but I want to be more flxible and let the user vary the colors. So why not use a vertexcolor material and set the vertex colors in my mesh I thought. However, this does not work. why?



thanks a lot again.



Regards,

Equi

  1. yes it acts exactly like a skybox

    2.yes

    3.You’ll have to do this in the shader gradient.frag, for now it’s pretty basic it just use the vertex position as the color, but you can do what ever you want in it.

    Like fetching a texture, or change the color according to the texCoord fo example