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;
|
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
|
* returns the list of the postRender passes
|
||||||
* @return
|
* @return
|
||||||
|
@ -38,6 +38,7 @@ import com.jme3.renderer.*;
|
|||||||
import com.jme3.renderer.queue.RenderQueue;
|
import com.jme3.renderer.queue.RenderQueue;
|
||||||
import com.jme3.texture.FrameBuffer;
|
import com.jme3.texture.FrameBuffer;
|
||||||
import com.jme3.texture.Image.Format;
|
import com.jme3.texture.Image.Format;
|
||||||
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
import com.jme3.ui.Picture;
|
import com.jme3.ui.Picture;
|
||||||
import com.jme3.util.SafeArrayList;
|
import com.jme3.util.SafeArrayList;
|
||||||
@ -285,6 +286,12 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean wantsBilinear = filter.isRequiresBilinear();
|
||||||
|
if (wantsBilinear) {
|
||||||
|
tex.setMagFilter(Texture.MagFilter.Bilinear);
|
||||||
|
tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
|
||||||
|
}
|
||||||
|
|
||||||
buff = outputBuffer;
|
buff = outputBuffer;
|
||||||
if (i != lastFilterIndex) {
|
if (i != lastFilterIndex) {
|
||||||
buff = filter.getRenderFrameBuffer();
|
buff = filter.getRenderFrameBuffer();
|
||||||
@ -293,6 +300,11 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
}
|
}
|
||||||
renderProcessing(r, buff, mat);
|
renderProcessing(r, buff, mat);
|
||||||
filter.postFilter(r, buff);
|
filter.postFilter(r, buff);
|
||||||
|
|
||||||
|
if (wantsBilinear) {
|
||||||
|
tex.setMagFilter(Texture.MagFilter.Nearest);
|
||||||
|
tex.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,12 @@ public class FXAAFilter extends Filter {
|
|||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isRequiresBilinear() {
|
||||||
|
// FXAA wants the input texture to be filtered.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSpanMax(float spanMax) {
|
public void setSpanMax(float spanMax) {
|
||||||
this.spanMax = spanMax;
|
this.spanMax = spanMax;
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user