FXAA: quality regression fix
FXAA wants input texture to use bilinear filtering so it can be smoothed further, so allow filters to request bilinear filtering.
This commit is contained in:
parent
4fef16ee9f
commit
4a37a8f851
@ -409,6 +409,19 @@ public abstract class Filter implements Savable {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method and return true if you want the scene (input) texture
|
||||
* to use bilinear filtering or false to use nearest filtering.
|
||||
*
|
||||
* Typically filters that perform samples <em>in between</em> pixels
|
||||
* should enable filtering.
|
||||
*
|
||||
* @return true to use linear filtering, false to use nearest filtering.
|
||||
*/
|
||||
protected boolean isRequiresBilinear() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the list of the postRender passes
|
||||
* @return
|
||||
|
@ -38,6 +38,7 @@ import com.jme3.renderer.*;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image.Format;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture2D;
|
||||
import com.jme3.ui.Picture;
|
||||
import com.jme3.util.SafeArrayList;
|
||||
@ -284,6 +285,12 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
||||
mat.clearParam("NumSamples");
|
||||
}
|
||||
}
|
||||
|
||||
boolean wantsBilinear = filter.isRequiresBilinear();
|
||||
if (wantsBilinear) {
|
||||
tex.setMagFilter(Texture.MagFilter.Bilinear);
|
||||
tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
|
||||
}
|
||||
|
||||
buff = outputBuffer;
|
||||
if (i != lastFilterIndex) {
|
||||
@ -293,6 +300,11 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
||||
}
|
||||
renderProcessing(r, buff, mat);
|
||||
filter.postFilter(r, buff);
|
||||
|
||||
if (wantsBilinear) {
|
||||
tex.setMagFilter(Texture.MagFilter.Nearest);
|
||||
tex.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,12 @@ public class FXAAFilter extends Filter {
|
||||
protected Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRequiresBilinear() {
|
||||
// FXAA wants the input texture to be filtered.
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setSpanMax(float spanMax) {
|
||||
this.spanMax = spanMax;
|
||||
|
Loading…
x
Reference in New Issue
Block a user