com.jme3.post.filters
Class DepthOfFieldFilter

java.lang.Object
  extended by com.jme3.post.Filter
      extended by com.jme3.post.filters.DepthOfFieldFilter
All Implemented Interfaces:
Savable

public class DepthOfFieldFilter
extends Filter

A post-processing filter that performs a depth range blur using a scaled convolution filter.


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
DepthOfFieldFilter()
          Creates a DepthOfField filter
 
Method Summary
 float getBlurScale()
          returns the blur scale
 float getFocusDistance()
          returns the focus distance
 float getFocusRange()
          returns the focus range
protected  Material getMaterial()
          Must return the material used for this filter.
protected  void initFilter(AssetManager assets, RenderManager renderManager, ViewPort vp, int w, int h)
          Initialization of sub classes filters This method is called once when the filter is added to the FilterPostProcessor It should contain Material initializations and extra passes initialization
protected  boolean isRequiresDepthTexture()
          Override this method and return true if your Filter needs the depth texture
 void setBlurScale(float f)
          Sets the blur amount by scaling the convolution filter up or down.
 void setFocusDistance(float f)
          Sets the distance at which objects are purely in focus.
 void setFocusRange(float f)
          Sets the range to either side of focusDistance where the objects go gradually out of focus.
 
Methods inherited from class com.jme3.post.Filter
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresSceneTexture, postFrame, postQueue, preFrame, read, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DepthOfFieldFilter

public DepthOfFieldFilter()
Creates a DepthOfField filter

Method Detail

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 class Filter
Returns:
true if your Filter need the depth texture

getMaterial

protected Material getMaterial()
Description copied from class: Filter
Must return the material used for this filter. this method is called every frame.

Specified by:
getMaterial in class Filter
Returns:
the material used for this filter.

initFilter

protected void initFilter(AssetManager assets,
                          RenderManager renderManager,
                          ViewPort vp,
                          int w,
                          int h)
Description copied from class: Filter
Initialization of sub classes filters 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 class Filter
Parameters:
assets - the assetManager
renderManager - the renderManager
vp - the viewPort where this filter is rendered
w - the width of the filter
h - the height of the filter

setFocusDistance

public void setFocusDistance(float f)
Sets the distance at which objects are purely in focus.


getFocusDistance

public float getFocusDistance()
returns the focus distance

Returns:

setFocusRange

public void setFocusRange(float f)
Sets the range to either side of focusDistance where the objects go gradually out of focus. Less than focusDistance - focusRange and greater than focusDistance + focusRange, objects are maximally "blurred".


getFocusRange

public float getFocusRange()
returns the focus range

Returns:

setBlurScale

public void setBlurScale(float f)
Sets the blur amount by scaling the convolution filter up or down. A value of 1 (the default) performs a sparse 5x5 evenly distribubted convolution at pixel level accuracy. Higher values skip more pixels, and so on until you are no longer blurring the image but simply hashing it. The sparse convolution is as follows: %MINIFYHTMLc3d0cd9fab65de6875a381fd3f83e1b338%* Where 'x' is the texel being modified. Setting blur scale higher than 1 spaces the samples out.


getBlurScale

public float getBlurScale()
returns the blur scale

Returns: