Package com.jme3.post.filters
Class LightScatteringFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.post.filters.LightScatteringFilter
- All Implemented Interfaces:
Savable
LightScattering filters create rays coming from light sources
This is often referred to 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
ConstructorDescriptioncreates a lightScattering filterLightScatteringFilter
(Vector3f lightPosition) Creates a lightScatteringFilter -
Method Summary
Modifier and TypeMethodDescriptionfloat
returns the blur start of the scattering seesetBlurStart(float blurStart)
float
returns the blur width
seesetBlurWidth(float blurWidth)
float
returns the light density seesetLightDensity(float lightDensity)
returns the light positionprotected Material
Must return the material used for this filter.int
returns the number of samples for the radial blurprotected void
initFilter
(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.protected boolean
Override this method and return true if your Filter needs the depth textureprotected 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
setBlurStart
(float blurStart) sets the blur start
at which distance from the light source the effect starts default is 0.02void
setBlurWidth
(float blurWidth) sets the blur width default is 0.9void
setLightDensity
(float lightDensity) sets how much the effect is visible over the rendered scene default is 1.4void
setLightPosition
(Vector3f lightPosition) sets the light positionvoid
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 performance.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, isRequiresBilinear, isRequiresSceneTexture, postFilter, postFrame, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Constructor Details
-
LightScatteringFilter
public LightScatteringFilter()creates a lightScattering filter -
LightScatteringFilter
Creates a lightScatteringFilter- Parameters:
lightPosition
- the desired location (in world coordinates, alias created)
-
-
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
-
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.
-
postQueue
Description copied from class:Filter
Override this method if you want to make a pre pass, before the actual rendering of the frame -
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
-
getBlurStart
public float getBlurStart()returns the blur start of the scattering seesetBlurStart(float blurStart)
- Returns:
- the start distance
-
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
- the desired start distance (in world units, default=0.02)
-
getBlurWidth
public float getBlurWidth()returns the blur width
seesetBlurWidth(float blurWidth)
- Returns:
- the width
-
setBlurWidth
public void setBlurWidth(float blurWidth) sets the blur width default is 0.9- Parameters:
blurWidth
- the desired width (default=0.9)
-
getLightDensity
public float getLightDensity()returns the light density seesetLightDensity(float lightDensity)
- Returns:
- the density
-
setLightDensity
public void setLightDensity(float lightDensity) sets how much the effect is visible over the rendered scene default is 1.4- Parameters:
lightDensity
- the desired density (default=1.4)
-
getLightPosition
returns the light position- Returns:
- the pre-existing vector
-
setLightPosition
sets the light position- Parameters:
lightPosition
- the desired location (in world coordinates, alias created)
-
getNbSamples
public int getNbSamples()returns the number of samples for the radial blur- Returns:
- count (≥0)
-
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 performance.- Parameters:
nbSamples
- the desired number of samples (default=50)
-
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
-