diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index bbc4a72679..aec38731aa 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -107,7 +107,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { private boolean multiView = false; private AppProfiler prof; - private Format fbFormat = Format.RGB111110F; + private Format fbFormat = null; private Format depthFormat = Format.Depth; /** @@ -206,13 +206,16 @@ public void initialize(RenderManager rm, ViewPort vp) { } // Determine optimal framebuffer format based on renderer capabilities - if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { - if (renderer.getCaps().contains(Caps.FloatColorBufferRGB)) { - fbFormat = Format.RGB16F; - } else if (renderer.getCaps().contains(Caps.FloatColorBufferRGBA)) { - fbFormat = Format.RGBA16F; - } else { - fbFormat = Format.RGB8; + if (fbFormat == null) { + fbFormat = Format.RGB111110F; + if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { + if (renderer.getCaps().contains(Caps.FloatColorBufferRGB)) { + fbFormat = Format.RGB16F; + } else if (renderer.getCaps().contains(Caps.FloatColorBufferRGBA)) { + fbFormat = Format.RGBA16F; + } else { + fbFormat = Format.RGB8; + } } } @@ -231,11 +234,11 @@ public void initialize(RenderManager rm, ViewPort vp) { } /** - * Returns the default color buffer format used for the internal rendering - * passes of the filters. This format is determined during initialization - * based on the renderer's capabilities. + * Returns the default color buffer format used for the internal rendering passes of the filters. This + * format is determined during initialization based on the renderer's capabilities. * - * @return The default `Format` for the filter pass textures. + * @return The default `Format` for the filter pass textures or null if set to be determined + * automatically. */ public Format getDefaultPassTextureFormat() { return fbFormat; @@ -701,10 +704,11 @@ public void setAssetManager(AssetManager assetManager) { } /** - * Sets the preferred `Image.Format` to be used for the internal frame buffer's - * color buffer. + * Sets the preferred `Image.Format` to be used for the internal frame buffer's color buffer. * - * @param fbFormat The desired `Format` for the color buffer. + * @param fbFormat + * The desired `Format` for the color buffer or null to let the processor determine the optimal + * format based on renderer capabilities. */ public void setFrameBufferFormat(Format fbFormat) { this.fbFormat = fbFormat;