com.jme3.post.filters
Class CrossHatchFilter

java.lang.Object
  extended by com.jme3.post.Filter
      extended by com.jme3.post.filters.CrossHatchFilter
All Implemented Interfaces:
Savable

public class CrossHatchFilter
extends Filter

A Post Processing filter that makes the screen look like it was drawn as diagonal lines with a pen. Try combining this with a cartoon edge filter to obtain manga style visuals. Based on an article from Geeks3D: http://www.geeks3d.com/20110219/shader-library-crosshatching-glsl-filter/


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
CrossHatchFilter()
          Creates a crossHatch filter
CrossHatchFilter(ColorRGBA lineColor, ColorRGBA paperColor)
          Creates a crossHatch filter
 
Method Summary
 float getColorInfluenceLine()
          Returns current influence of image colors on lines
 float getColorInfluencePaper()
          Returns current influence of image colors on paper background
 float getFillValue()
          Returns line/paper color ratio for blobs
 ColorRGBA getLineColor()
          Returns line color
 float getLineDistance()
          Returns minimum distance between lines
 float getLineThickness()
          Returns the thickness of the lines drawn
 float getLuminance1()
          Returns treshold for lines 1
 float getLuminance2()
          Returns treshold for lines 2
 float getLuminance3()
          Returns treshold for lines 3
 float getLuminance4()
          Returns treshold for lines 4
 float getLuminance5()
          Returns treshold for blobs
protected  Material getMaterial()
          Must return the material used for this filter.
 ColorRGBA getPaperColor()
          Returns paper background color
protected  void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h)
          Initialization of sub classes filters This method is called once when the filter is added to the FilterPostProcessor It should contain Material initializations and extra passes initialization
protected  boolean isRequiresDepthTexture()
          Override this method and return true if your Filter needs the depth texture
 void setColorInfluenceLine(float colorInfluenceLine)
          Sets color influence of original image on lines drawn
 void setColorInfluencePaper(float colorInfluencePaper)
          Sets color influence of original image on non-line areas
 void setFillValue(float fillValue)
          Sets line/paper color ratio for areas with values < luminance5, really dark areas get no lines but a filled blob instead
 void setLineColor(ColorRGBA lineColor)
          Sets color used to draw lines
 void setLineDistance(float lineDistance)
          Sets minimum distance between lines drawn Primary lines are drawn at 2*lineDistance Secondary lines are drawn at lineDistance
 void setLineThickness(float lineThickness)
          Sets the thickness of lines drawn
 void setLuminanceLevels(float luminance1, float luminance2, float luminance3, float luminance4, float luminance5)
          Sets minimum luminance levels for lines drawn
 void setPaperColor(ColorRGBA paperColor)
          Sets color used as background
 
Methods inherited from class com.jme3.post.Filter
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresSceneTexture, postFrame, postQueue, preFrame, read, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossHatchFilter

public CrossHatchFilter()
Creates a crossHatch filter


CrossHatchFilter

public CrossHatchFilter(ColorRGBA lineColor,
                        ColorRGBA paperColor)
Creates a crossHatch filter

Parameters:
lineColor - the colors of the lines
paperColor - the paper color
Method Detail

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

initFilter

protected void initFilter(AssetManager manager,
                          RenderManager renderManager,
                          ViewPort vp,
                          int w,
                          int h)
Description copied from class: Filter
Initialization of sub classes filters 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

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.

setLineColor

public void setLineColor(ColorRGBA lineColor)
Sets color used to draw lines

Parameters:
lineColor -

setPaperColor

public void setPaperColor(ColorRGBA paperColor)
Sets color used as background

Parameters:
paperColor -

setColorInfluenceLine

public void setColorInfluenceLine(float colorInfluenceLine)
Sets color influence of original image on lines drawn

Parameters:
colorInfluenceLine -

setColorInfluencePaper

public void setColorInfluencePaper(float colorInfluencePaper)
Sets color influence of original image on non-line areas

Parameters:
colorInfluencePaper -

setFillValue

public void setFillValue(float fillValue)
Sets line/paper color ratio for areas with values < luminance5, really dark areas get no lines but a filled blob instead

Parameters:
fillValue -

setLuminanceLevels

public void setLuminanceLevels(float luminance1,
                               float luminance2,
                               float luminance3,
                               float luminance4,
                               float luminance5)
Sets minimum luminance levels for lines drawn

Parameters:
luminance1 - Top-left to down right 1
luminance2 - Top-right to bottom left 1
luminance3 - Top-left to down right 2
luminance4 - Top-right to bottom left 2
luminance5 - Blobs

setLineThickness

public void setLineThickness(float lineThickness)
Sets the thickness of lines drawn

Parameters:
lineThickness -

setLineDistance

public void setLineDistance(float lineDistance)
Sets minimum distance between lines drawn Primary lines are drawn at 2*lineDistance Secondary lines are drawn at lineDistance

Parameters:
lineDistance -

getLineColor

public ColorRGBA getLineColor()
Returns line color

Returns:

getPaperColor

public ColorRGBA getPaperColor()
Returns paper background color

Returns:

getColorInfluenceLine

public float getColorInfluenceLine()
Returns current influence of image colors on lines


getColorInfluencePaper

public float getColorInfluencePaper()
Returns current influence of image colors on paper background


getFillValue

public float getFillValue()
Returns line/paper color ratio for blobs


getLineThickness

public float getLineThickness()
Returns the thickness of the lines drawn


getLineDistance

public float getLineDistance()
Returns minimum distance between lines


getLuminance1

public float getLuminance1()
Returns treshold for lines 1


getLuminance2

public float getLuminance2()
Returns treshold for lines 2


getLuminance3

public float getLuminance3()
Returns treshold for lines 3


getLuminance4

public float getLuminance4()
Returns treshold for lines 4


getLuminance5

public float getLuminance5()
Returns treshold for blobs