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
ConstructorsConstructorDescriptioncreates a lightScattering filterLightScatteringFilter(Vector3f lightPosition) Creates a lightScatteringFilter -
Method Summary
Modifier and TypeMethodDescriptionfloatreturns the blur start of the scattering seesetBlurStart(float blurStart)floatreturns the blur width
seesetBlurWidth(float blurWidth)floatreturns the light density seesetLightDensity(float lightDensity)returns the light positionprotected MaterialMust return the material used for this filter.intreturns the number of samples for the radial blurprotected voidinitFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.protected booleanOverride this method and return true if your Filter needs the depth textureprotected voidpostQueue(RenderQueue queue) Override this method if you want to make a pre pass, before the actual rendering of the framevoidread(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);voidsetBlurStart(float blurStart) sets the blur start
at which distance from the light source the effect starts default is 0.02voidsetBlurWidth(float blurWidth) sets the blur width default is 0.9voidsetLightDensity(float lightDensity) sets how much the effect is visible over the rendered scene default is 1.4voidsetLightPosition(Vector3f lightPosition) sets the light positionvoidsetNbSamples(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.voidwrite(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:FilterOverride this method and return true if your Filter needs the depth texture- Overrides:
isRequiresDepthTexturein classFilter- Returns:
- true if your Filter need the depth texture
-
getMaterial
Description copied from class:FilterMust return the material used for this filter. this method is called every frame.- Specified by:
getMaterialin classFilter- Returns:
- the material used for this filter.
-
postQueue
Description copied from class:FilterOverride 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:FilterInitialization 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:
initFilterin 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:FilterOverride 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:
writein interfaceSavable- Overrides:
writein classFilter- Parameters:
ex- the exporter (not null)- Throws:
IOException- from the exporter
-
read
Description copied from class:FilterOverride 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:
readin interfaceSavable- Overrides:
readin classFilter- Throws:
IOException
-