Package com.jme3.shadow
Class DirectionalLightShadowFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.shadow.AbstractShadowFilter<DirectionalLightShadowRenderer>
com.jme3.shadow.DirectionalLightShadowFilter
- All Implemented Interfaces:
Savable
,JmeCloneable
,Cloneable
public class DirectionalLightShadowFilter
extends AbstractShadowFilter<DirectionalLightShadowRenderer>
This Filter does basically the same as a DirectionalLightShadowRenderer
except it renders the post shadow pass as a fullscreen quad pass instead of a
geometry pass. It's mostly faster than PssmShadowRenderer as long as you have
more than about ten shadow receiving objects. The expense is the drawback
that the shadow Receive mode set on spatial is ignored. So basically all and
only objects that render depth in the scene receive shadows.
API is basically the same as the PssmShadowRenderer.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.post.Filter
Filter.Pass
-
Field Summary
Fields inherited from class com.jme3.shadow.AbstractShadowFilter
shadowRenderer, viewPort
Fields inherited from class com.jme3.post.Filter
defaultPass, enabled, material, postRenderPasses, processor
-
Constructor Summary
ConstructorDescriptionFor serialization only.DirectionalLightShadowFilter
(AssetManager assetManager, int shadowMapSize, int nbSplits) Creates a DirectionalLightShadowFilter. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the lambda parameter.getLight()
Returns the light used to cast shadows.boolean
Returns true if stabilization is enabled.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
setEnabledStabilization
(boolean stabilize) Enables the stabilization of the shadow's edges.void
setLambda
(float lambda) Adjusts the partition of the shadow extend into shadow maps.void
setLight
(DirectionalLight light) Sets the light to use to cast shadows.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.shadow.AbstractShadowFilter
cloneFields, getEdgeFilteringMode, getEdgesThickness, getMaterial, getNumShadowMaps, getPreShadowForcedRenderState, getShadowCompareMode, getShadowIntensity, getShadowMapSize, getShadowMaterial, getShadowZExtend, getShadowZFadeLength, initFilter, isFlushQueues, isRenderBackFacesShadows, isRequiresDepthTexture, jmeClone, postFrame, postQueue, preFrame, setEdgeFilteringMode, setEdgesThickness, setRenderBackFacesShadows, setShadowCompareMode, setShadowIntensity, setShadowZExtend, setShadowZFadeLength
Methods inherited from class com.jme3.post.Filter
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresSceneTexture, postFilter, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Constructor Details
-
DirectionalLightShadowFilter
public DirectionalLightShadowFilter()For serialization only. Do not use. -
DirectionalLightShadowFilter
Creates a DirectionalLightShadowFilter.- Parameters:
assetManager
- the application's asset managershadowMapSize
- the size of the rendered shadow maps (512, 1024, 2048, etc...)nbSplits
- the number of shadow maps rendered (more shadow maps = better quality, but slower)- Throws:
IllegalArgumentException
- if the provided 'nbSplits' is not within the valid range of 1 to 4.
-
-
Method Details
-
getLight
Returns the light used to cast shadows.- Returns:
- the DirectionalLight
-
setLight
Sets the light to use to cast shadows.- Parameters:
light
- a DirectionalLight
-
getLambda
public float getLambda()Returns the lambda parameter.- Returns:
- lambda
- See Also:
-
setLambda
public void setLambda(float lambda) Adjusts the partition of the shadow extend into shadow maps. Lambda is usually between 0 and 1.A low value gives a more linear partition, resulting in consistent shadow quality over the extend, but near shadows could look very jagged. A high value gives a more logarithmic partition, resulting in high quality for near shadows, but quality decreases rapidly with distance.
The default value is 0.65 (the theoretical optimum).
- Parameters:
lambda
- the lambda value
-
isEnabledStabilization
public boolean isEnabledStabilization()Returns true if stabilization is enabled.- Returns:
- true if stabilization is enabled
-
setEnabledStabilization
public void setEnabledStabilization(boolean stabilize) Enables the stabilization of the shadow's edges. (default is true) This prevents shadow edges from flickering when the camera moves. However, it can lead to some loss of shadow quality in particular scenes.- Parameters:
stabilize
- true to stabilize, false to disable stabilization
-
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 classAbstractShadowFilter<DirectionalLightShadowRenderer>
- 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 classAbstractShadowFilter<DirectionalLightShadowRenderer>
- Throws:
IOException
-