Package com.jme3.post.ssao
Class SSAOFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.post.ssao.SSAOFilter
- All Implemented Interfaces:
Savable
SSAO stands for screen space ambient occlusion
It's a technique that fakes ambient lighting by computing shadows that nearby objects would cast on each other.
under the effect of an ambient light
more info on this in this blog post http://jmonkeyengine.org/2010/08/16/screen-space-ambient-occlusion-for-jmonkeyengine-3-0/
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.post.Filter
Filter.Pass
-
Field Summary
Fields inherited from class com.jme3.post.Filter
defaultPass, enabled, material, postRenderPasses, processor
-
Constructor Summary
ConstructorDescriptionCreate a Screen Space Ambient Occlusion FilterSSAOFilter
(float sampleRadius, float intensity, float scale, float bias) Create a Screen Space Ambient Occlusion Filter -
Method Summary
Modifier and TypeMethodDescriptionprotected void
override this method if you have some cleanup to dofloat
getBias()
Return the bias
seesetBias(float bias)
float
returns the ambient occlusion intensityprotected Material
Must return the material used for this filter.float
returns the sample radius
see {link setSampleRadius(float sampleRadius)}float
getScale()
returns the scale
seesetScale(float scale)
protected void
initFilter
(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.boolean
protected boolean
Override this method and return true if your Filter needs the depth textureboolean
isUseAo()
debugging only , will be removedboolean
debugging only , will be removedprotected void
postQueue
(RenderQueue queue) Override this method if you want to make a pre pass, before the actual rendering of the framevoid
read
(JmeImporter im) Override this method if you want to load extra properties when the filter is loaded else only basic properties of the filter will be loaded This method should always begin by super.read(im);void
setApproximateNormals
(boolean approximateNormals) void
setBias
(float bias) Sets the width of the occlusion cone considered by the occludee default is 0.1fvoid
setIntensity
(float intensity) Sets the Ambient occlusion intensity default is 1.5void
setSampleRadius
(float sampleRadius) Sets the radius of the area where random samples will be picked default 5.1fvoid
setScale
(float scale) Returns the distance between occluders and occludee.void
setUseAo
(boolean useAo) debugging only , will be removedvoid
setUseOnlyAo
(boolean useOnlyAo) debugging only , will be removedvoid
write
(JmeExporter ex) Override this method if you want to save extra properties when the filter is saved else only basic properties of the filter will be saved This method should always begin by super.write(ex);Methods inherited from class com.jme3.post.Filter
cleanup, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresSceneTexture, postFilter, postFrame, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Constructor Details
-
SSAOFilter
public SSAOFilter()Create a Screen Space Ambient Occlusion Filter -
SSAOFilter
public SSAOFilter(float sampleRadius, float intensity, float scale, float bias) Create a Screen Space Ambient Occlusion Filter- Parameters:
sampleRadius
- The radius of the area where random samples will be picked. default 5.1fintensity
- intensity of the resulting AO. default 1.2fscale
- distance between occluders and occludee. default 0.2fbias
- the width of the occlusion cone considered by the occludee. default 0.1f
-
-
Method Details
-
isRequiresDepthTexture
protected boolean isRequiresDepthTexture()Description copied from class:Filter
Override this method and return true if your Filter needs the depth texture- Overrides:
isRequiresDepthTexture
in classFilter
- Returns:
- true if your Filter need the depth texture
-
postQueue
Description copied from class:Filter
Override this method if you want to make a pre pass, before the actual rendering of the frame -
getMaterial
Description copied from class:Filter
Must return the material used for this filter. this method is called every frame.- Specified by:
getMaterial
in classFilter
- Returns:
- the material used for this filter.
-
initFilter
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Description copied from class:Filter
Initialization of filter subclasses. This method is called once when the filter is added to the FilterPostProcessor It should contain Material initializations and extra passes initialization- Specified by:
initFilter
in classFilter
- Parameters:
manager
- the assetManagerrenderManager
- the renderManagervp
- the viewPort where this filter is renderedw
- the width of the filterh
- the height of the filter
-
cleanUpFilter
Description copied from class:Filter
override this method if you have some cleanup to do- Overrides:
cleanUpFilter
in classFilter
- Parameters:
r
- the renderer
-
getBias
public float getBias()Return the bias
seesetBias(float bias)
- Returns:
- bias
-
setBias
public void setBias(float bias) Sets the width of the occlusion cone considered by the occludee default is 0.1f- Parameters:
bias
- the desired width (default=0.1)
-
getIntensity
public float getIntensity()returns the ambient occlusion intensity- Returns:
- intensity
-
setIntensity
public void setIntensity(float intensity) Sets the Ambient occlusion intensity default is 1.5- Parameters:
intensity
- the desired intensity (default=1.5)
-
getSampleRadius
public float getSampleRadius()returns the sample radius
see {link setSampleRadius(float sampleRadius)}- Returns:
- the sample radius
-
setSampleRadius
public void setSampleRadius(float sampleRadius) Sets the radius of the area where random samples will be picked default 5.1f- Parameters:
sampleRadius
- the desired radius (default=5.1)
-
getScale
public float getScale()returns the scale
seesetScale(float scale)
- Returns:
- scale
-
setScale
public void setScale(float scale) Returns the distance between occluders and occludee. default 0.2f- Parameters:
scale
- the desired distance (default=0.2)
-
isUseAo
public boolean isUseAo()debugging only , will be removed- Returns:
- true if using ambient occlusion
-
setUseAo
public void setUseAo(boolean useAo) debugging only , will be removed- Parameters:
useAo
- true to enable, false to disable (default=true)
-
setApproximateNormals
public void setApproximateNormals(boolean approximateNormals) -
isApproximateNormals
public boolean isApproximateNormals() -
isUseOnlyAo
public boolean isUseOnlyAo()debugging only , will be removed- Returns:
- useOnlyAo
-
setUseOnlyAo
public void setUseOnlyAo(boolean useOnlyAo) debugging only , will be removed- Parameters:
useOnlyAo
- true to enable, false to disable (default=false)
-
write
Description copied from class:Filter
Override this method if you want to save extra properties when the filter is saved else only basic properties of the filter will be saved This method should always begin by super.write(ex);- Specified by:
write
in interfaceSavable
- Overrides:
write
in classFilter
- Parameters:
ex
- the exporter (not null)- Throws:
IOException
- from the exporter
-
read
Description copied from class:Filter
Override this method if you want to load extra properties when the filter is loaded else only basic properties of the filter will be loaded This method should always begin by super.read(im);- Specified by:
read
in interfaceSavable
- Overrides:
read
in classFilter
- Throws:
IOException
-