[SOLVED]Filter - antialiasing turns everything black

I’ve been learning shaders and made something incredibly simple - a fake chromatic aberration shader. Here it is in action with the effect turned up high so it’s obvious

Only problem is when I turn on AA at any level in the settings screen upon launch I get an entirely black screen. There are no errors or printouts concerning it.

I set the samples like so:

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    int numSamples = getContext().getSettings().getSamples();
    if( numSamples > 0 ) {
        fpp.setNumSamples(numSamples); 
    }

    chromatic = new ChromaticAberrationFilter();
    fpp.addFilter(chromatic);

  viewPort.addProcessor(fpp);

As it’s my first attempt I wondered if I am doing something wrong? None of the code in the filter or shader that I’ve written mentions samples, can post if neccesary.

Don’t turn on AA…

would be my normal troll response, however in this case, I would just not use AA and try using the FXAA filter instead. This gets around the problem all together, and should be faster and gives you more flexibility later down the track, should someone implement a different AA method that is more suitable. Soon you may find yourself wanting to control when in the post process you want AA applied.

It was my fault. I am using render to texture and it has no anti aliasing at all. I no longer need render to texture anyway so it doesn’t matter.

I do like the FXAA edges, really nice, but unfortunately it blurs my background images slightly too.

SMAA won’t blur your background images :wink:

1 Like

Ahaha, it’s funny I was literally 10 minutes ago looking at SMAA, and glsl ports of it. Seemed like a bit of a large step for me to try and get it working in JME at the moment though :stuck_out_tongue:

I’d like to ask you, if you know, supposing I have both the MSAA you chose on startup working and the FXAA filter working - would you give the option of both at once, or is that counter productive it any way?

EDIT: Also could it not help to have some sort of sharpening filter after FXAA?

doesn’t look like FXAA actually uses multisampling, so I would say it’s pointless using both? @nehon

You could try, I have an unsharp mask filter i use but I haven’t thought about how it interacts with AA.

SMAA use edge detection to only AA the edges. FXAA 3 may be better than what is currently there, I have no idea, and I also don’t know what improvements it brings. Both of these are on my todo list right now.

2 Likes

Well… technically you can… But FXAA is made to be a cheap AA solution to not use MSAA, that is quite expensive… usually peope using FXAA do it to not use MSAA… Not sure what’s the render will look like though…

1 Like

Thank you both. I guess I’ll play with it and find out.