Class LightScatteringFilter

java.lang.Object
com.jme3.post.Filter
com.jme3.post.filters.LightScatteringFilter
All Implemented Interfaces:
Savable

public class LightScatteringFilter extends Filter
LightScattering filters create rays coming from light sources This is often referred to as god rays.
  • Constructor Details

    • LightScatteringFilter

      public LightScatteringFilter()
      creates a lightScattering filter
    • LightScatteringFilter

      public LightScatteringFilter(Vector3f lightPosition)
      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 class Filter
      Returns:
      true if your Filter need the depth texture
    • getMaterial

      protected Material getMaterial()
      Description copied from class: Filter
      Must return the material used for this filter. this method is called every frame.
      Specified by:
      getMaterial in class Filter
      Returns:
      the material used for this filter.
    • 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 Filter
      Parameters:
      queue - the RenderQueue
    • 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 class Filter
      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
    • getBlurStart

      public float getBlurStart()
      returns the blur start of the scattering see setBlurStart(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
      see setBlurWidth(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 see setLightDensity(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

      public Vector3f getLightPosition()
      returns the light position
      Returns:
      the pre-existing vector
    • setLightPosition

      public void setLightPosition(Vector3f lightPosition)
      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

      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