Class SoftBloomFilter
- All Implemented Interfaces:
com.jme3.export.Savable
Compared to BloomFilter, this filter produces much higher quality
results that feel much more natural.
This implementation, unlike BloomFilter, has no brightness threshold, meaning all aspects of the scene glow, although only very bright areas will noticeably produce glow. For this reason, this filter should only be used if HDR is also being utilized, otherwise BloomFilter should be preferred.
This filter uses the PBR bloom algorithm presented in this article.
- Author:
- codex
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.post.Filter
com.jme3.post.Filter.Pass -
Field Summary
Fields inherited from class com.jme3.post.Filter
defaultPass, enabled, material, postRenderPasses, processor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatGets the glow factor.protected com.jme3.material.MaterialintGets the number of downsampling/upsampling passes per step.protected voidinitFilter(com.jme3.asset.AssetManager am, com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp, int w, int h) booleanReturns true if pass textures use bilinear filtering.voidread(com.jme3.export.JmeImporter im) voidsetBilinearFiltering(boolean bilinearFiltering) Sets pass textures to use bilinear filtering.voidsetGlowFactor(float factor) Sets the factor at which the glow result texture is merged with the scene texture.voidsetNumSamplingPasses(int numSamplingPasses) Sets the number of sampling passes in each step.voidwrite(com.jme3.export.JmeExporter ex) Methods inherited from class com.jme3.post.Filter
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresDepthTexture, isRequiresSceneTexture, postFilter, postFrame, postQueue, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Constructor Details
-
SoftBloomFilter
public SoftBloomFilter()Creates filter with default settings.
-
-
Method Details
-
initFilter
protected void initFilter(com.jme3.asset.AssetManager am, com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp, int w, int h) - Specified by:
initFilterin classcom.jme3.post.Filter
-
getMaterial
protected com.jme3.material.Material getMaterial()- Specified by:
getMaterialin classcom.jme3.post.Filter
-
setNumSamplingPasses
public void setNumSamplingPasses(int numSamplingPasses) Sets the number of sampling passes in each step.Higher values produce more glow with higher resolution, at the cost of more passes. Lower values produce less glow with lower resolution.
The total number of passes is
2n+1: n passes for downsampling (13 texture reads per pass per fragment), n passes for upsampling and blur (9 texture reads per pass per fragment), and 1 pass for blending (2 texture reads per fragment). Though, it should be noted that for each downsampling pass the number of fragments decreases by 75%, and for each upsampling pass, the number of fragments quadruples (which restores the number of fragments to the original resolution).Setting this after the filter has been initialized forces reinitialization.
default=5
- Parameters:
numSamplingPasses- The number of passes per donwsampling/upsampling step. Must be greater than zero.- Throws:
IllegalArgumentException- if argument is less than or equal to zero
-
setGlowFactor
public void setGlowFactor(float factor) Sets the factor at which the glow result texture is merged with the scene texture.Low values favor the scene texture more, while high values make glow more noticeable. This value is clamped between 0 and 1.
default=0.05f
- Parameters:
factor-
-
setBilinearFiltering
public void setBilinearFiltering(boolean bilinearFiltering) Sets pass textures to use bilinear filtering.If true, downsampling textures are set to
min=BilinearNoMipMapsand upsampling textures are set tomag=Bilinear, which produces better quality glow. If false, textures use their default filters.default=true
- Parameters:
bilinearFiltering- true to use bilinear filtering
-
getNumSamplingPasses
public int getNumSamplingPasses()Gets the number of downsampling/upsampling passes per step.- Returns:
- number of downsampling/upsampling passes
- See Also:
-
getGlowFactor
public float getGlowFactor()Gets the glow factor.- Returns:
- glow factor
- See Also:
-
isBilinearFiltering
public boolean isBilinearFiltering()Returns true if pass textures use bilinear filtering.- Returns:
- See Also:
-
write
- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classcom.jme3.post.Filter- Throws:
IOException
-
read
- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classcom.jme3.post.Filter- Throws:
IOException
-