com.jme3.post.filters
Class LightScatteringFilter

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

public class LightScatteringFilter
extends Filter

LightScattering filters creates rays comming from a light sources This is often reffered as god rays.


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
LightScatteringFilter()
          creates a lightScaterring filter
LightScatteringFilter(Vector3f lightPosition)
          Creates a lightScatteringFilter
 
Method Summary
 float getBlurStart()
          returns the blur start of the scattering see setBlurStart(float blurStart)
 float getBlurWidth()
          returns the blur width
see setBlurWidth(float blurWidth)
 float getLightDensity()
          retiurns the light density
see setLightDensity(float lightDensity)
 Vector3f getLightPosition()
          returns the light position
protected  Material getMaterial()
          Must return the material used for this filter.
 int getNbSamples()
          returns the nmber of samples for the radial blur
protected  void initFilter(AssetManager manager, 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
protected  void postQueue(RenderManager renderManager, ViewPort viewPort)
          Override this method if you want to make a pre pass, before the actual rendering of the frame
 void 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 setBlurStart(float blurStart)
          sets the blur start
at which distance from the light source the effect starts default is 0.02
 void setBlurWidth(float blurWidth)
          sets the blur width default is 0.9
 void setLightDensity(float lightDensity)
          sets how much the effect is visible over the rendered scene default is 1.4
 void setLightPosition(Vector3f lightPosition)
          sets the light position
 void setNbSamples(int nbSamples)
          sets the number of samples for the radial blur default is 50 the higher the value the higher the quality, but the slower the performances.
 void 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, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresSceneTexture, postFrame, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightScatteringFilter

public LightScatteringFilter()
creates a lightScaterring filter


LightScatteringFilter

public LightScatteringFilter(Vector3f lightPosition)
Creates a lightScatteringFilter

Parameters:
lightPosition -
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.

postQueue

protected void postQueue(RenderManager renderManager,
                         ViewPort viewPort)
Description copied from class: Filter
Override this method if you want to make a pre pass, before the actual rendering of the frame

Overrides:
postQueue in class Filter

initFilter

protected void initFilter(AssetManager manager,
                          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:
manager - 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

getBlurStart

public float getBlurStart()
returns the blur start of the scattering see setBlurStart(float blurStart)

Returns:

setBlurStart

public void setBlurStart(float blurStart)
sets the blur start
at which distance from the light source the effect starts default is 0.02

Parameters:
blurStart -

getBlurWidth

public float getBlurWidth()
returns the blur width
see setBlurWidth(float blurWidth)

Returns:

setBlurWidth

public void setBlurWidth(float blurWidth)
sets the blur width default is 0.9

Parameters:
blurWidth -

getLightDensity

public float getLightDensity()
retiurns the light density
see setLightDensity(float lightDensity)

Returns:

setLightDensity

public void setLightDensity(float lightDensity)
sets how much the effect is visible over the rendered scene default is 1.4

Parameters:
lightDensity -

getLightPosition

public Vector3f getLightPosition()
returns the light position

Returns:

setLightPosition

public void setLightPosition(Vector3f lightPosition)
sets the light position

Parameters:
lightPosition -

getNbSamples

public int getNbSamples()
returns the nmber of samples for the radial blur

Returns:

setNbSamples

public void setNbSamples(int nbSamples)
sets the number of samples for the radial blur default is 50 the higher the value the higher the quality, but the slower the performances.

Parameters:
nbSamples -

write

public void write(JmeExporter ex)
           throws java.io.IOException
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 interface Savable
Overrides:
write in class Filter
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
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 interface Savable
Overrides:
read in class Filter
Throws:
java.io.IOException