Package com.jme3.shadow
Class SdsmDirectionalLightShadowFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.shadow.AbstractShadowFilter<SdsmDirectionalLightShadowRenderer>
com.jme3.shadow.SdsmDirectionalLightShadowFilter
- All Implemented Interfaces:
Savable,JmeCloneable,Cloneable
public class SdsmDirectionalLightShadowFilter
extends AbstractShadowFilter<SdsmDirectionalLightShadowRenderer>
SDSM (Sample Distribution Shadow Mapping) filter for directional lights.
This filter uses GPU compute shaders to analyze the depth buffer and compute optimal cascade split positions for rendering shadow maps.
Key benefits over DirectionalLightShadowFilter:
- Better shadow map utilization through sample-based fitting
- Dynamic cascade adaptation to scene geometry
- Reduced shadow pop-in artifacts
Requires OpenGL 4.3+ for compute shader support. Only works for filter-based shadow mapping.
-
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, viewPortFields inherited from class com.jme3.post.Filter
defaultPass, enabled, material, postRenderPasses, processor -
Constructor Summary
ConstructorsConstructorDescriptionFor serialization only.SdsmDirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int splitCount) Creates an SDSM directional light shadow filter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidoverride this method if you have some cleanup to dovoidfloatGets the fit expansion factor.floatGets the frame delay tolerance.getLight()Returns the light used to cast shadows.protected voidinitFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.protected voidpostFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) Override this method if you want to make a pass just after the frame has been rendered and just before the filter renderingprotected 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);voidsetDepthTexture(Texture depthTexture) Override if you want to do something special with the depth texture;voidsetFitExpansionFactor(float factor) Sets the expansion factor for fitted shadow frustums.voidsetFitFrameDelayTolerance(float tolerance) Sets the frame delay tolerance.voidsetLight(DirectionalLight light) Sets the light to use for casting shadows.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.shadow.AbstractShadowFilter
cloneFields, displayFrustum, getEdgeFilteringMode, getEdgesThickness, getMaterial, getNumShadowMaps, getPreShadowForcedRenderState, getShadowCompareMode, getShadowIntensity, getShadowMapSize, getShadowMaterial, getShadowZExtend, getShadowZFadeLength, isFlushQueues, isRenderBackFacesShadows, isRequiresDepthTexture, jmeClone, preFrame, setEdgeFilteringMode, setEdgesThickness, setRenderBackFacesShadows, setShadowCompareMode, setShadowIntensity, setShadowZExtend, setShadowZFadeLengthMethods inherited from class com.jme3.post.Filter
cleanup, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresSceneTexture, postFilter, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Constructor Details
-
SdsmDirectionalLightShadowFilter
public SdsmDirectionalLightShadowFilter()For serialization only. Do not use.- See Also:
-
SdsmDirectionalLightShadowFilter
public SdsmDirectionalLightShadowFilter(AssetManager assetManager, int shadowMapSize, int splitCount) Creates an SDSM directional light shadow filter.- Parameters:
assetManager- the application's asset managershadowMapSize- the size of the rendered shadow maps (512, 1024, 2048, etc.)splitCount- the number of shadow map splits (1-4)- Throws:
IllegalArgumentException- if splitCount is not between 1 and 4
-
-
Method Details
-
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- Overrides:
initFilterin classAbstractShadowFilter<SdsmDirectionalLightShadowRenderer>- Parameters:
manager- the assetManagerrenderManager- the renderManagervp- the viewPort where this filter is renderedw- the width of the filterh- the height of the filter
-
getLight
Returns the light used to cast shadows.- Returns:
- the DirectionalLight
-
setLight
Sets the light to use for casting shadows.- Parameters:
light- a DirectionalLight
-
getFitExpansionFactor
public float getFitExpansionFactor()Gets the fit expansion factor.- Returns:
- the expansion factor
- See Also:
-
setFitExpansionFactor
public void setFitExpansionFactor(float factor) Sets the expansion factor for fitted shadow frustums.- Parameters:
factor- the expansion factor (default 1.0)- See Also:
-
getFitFrameDelayTolerance
public float getFitFrameDelayTolerance()Gets the frame delay tolerance.- Returns:
- the tolerance value
- See Also:
-
setFitFrameDelayTolerance
public void setFitFrameDelayTolerance(float tolerance) Sets the frame delay tolerance.- Parameters:
tolerance- the tolerance (default 0.05)- See Also:
-
setDepthTexture
Description copied from class:FilterOverride if you want to do something special with the depth texture;- Overrides:
setDepthTexturein classFilter- Parameters:
depthTexture- the desired Texture
-
postQueue
Description copied from class:FilterOverride this method if you want to make a pre pass, before the actual rendering of the frame- Overrides:
postQueuein classAbstractShadowFilter<SdsmDirectionalLightShadowRenderer>- Parameters:
queue- the RenderQueue
-
postFrame
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) Description copied from class:FilterOverride this method if you want to make a pass just after the frame has been rendered and just before the filter rendering- Overrides:
postFramein classAbstractShadowFilter<SdsmDirectionalLightShadowRenderer>- Parameters:
renderManager- for renderingviewPort- for renderingprevFilterBuffer- the FrameBuffer of the previous filtersceneBuffer- the FrameBuffer of the scene
-
cleanUpFilter
Description copied from class:Filteroverride this method if you have some cleanup to do- Overrides:
cleanUpFilterin classFilter- Parameters:
r- the renderer
-
displayAllFrustums
public void displayAllFrustums() -
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
-