Class 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.

  • 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 manager
      shadowMapSize - 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: 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
      Overrides:
      initFilter in class AbstractShadowFilter<SdsmDirectionalLightShadowRenderer>
      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
    • getLight

      public DirectionalLight getLight()
      Returns the light used to cast shadows.
      Returns:
      the DirectionalLight
    • setLight

      public void setLight(DirectionalLight light)
      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

      public void setDepthTexture(Texture depthTexture)
      Description copied from class: Filter
      Override if you want to do something special with the depth texture;
      Overrides:
      setDepthTexture in class Filter
      Parameters:
      depthTexture - the desired Texture
    • postQueue

      protected void postQueue(RenderQueue queue)
      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 AbstractShadowFilter<SdsmDirectionalLightShadowRenderer>
      Parameters:
      queue - the RenderQueue
    • postFrame

      protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer)
      Description copied from class: Filter
      Override this method if you want to make a pass just after the frame has been rendered and just before the filter rendering
      Overrides:
      postFrame in class AbstractShadowFilter<SdsmDirectionalLightShadowRenderer>
      Parameters:
      renderManager - for rendering
      viewPort - for rendering
      prevFilterBuffer - the FrameBuffer of the previous filter
      sceneBuffer - the FrameBuffer of the scene
    • cleanUpFilter

      protected void cleanUpFilter(Renderer r)
      Description copied from class: Filter
      override this method if you have some cleanup to do
      Overrides:
      cleanUpFilter in class Filter
      Parameters:
      r - the renderer
    • displayAllFrustums

      public void displayAllFrustums()
    • write

      public void write(JmeExporter ex) throws 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
      Parameters:
      ex - the exporter (not null)
      Throws:
      IOException - from the exporter
    • read

      public void read(JmeImporter im) throws 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:
      IOException