Paul Speed 81667f8f45 Fixed the DepthOfFieldFilter to properly get the near/far distance from JME
instead of having it hard-coded.  Previous behavior caused focus to go all out
of whack if you ever changed the near/far plane (and even the default hard-coded
value was not the same as JME's default camera setup.)
While I was here, I made the unfocus threshold configurable and added a debug
toggle that will turn the 'unfocus' amount into grayscale color for better visualizing
where unfocusing is happening.
2018-03-17 02:18:31 -04:00

33 lines
815 B
Plaintext

MaterialDef Depth Of Field {
MaterialParameters {
Int NumSamples
Int NumSamplesDepth
Texture2D Texture
Texture2D DepthTexture
Float FocusRange;
Float FocusDistance;
Float XScale;
Float YScale;
Float BlurThreshold : 0.2;
Boolean DebugUnfocus : false;
}
Technique {
VertexShader GLSL150 GLSL100: Common/MatDefs/Post/Post.vert
FragmentShader GLSL150 GLSL100: Common/MatDefs/Post/DepthOfField.frag
WorldParameters {
FrustumNearFar
}
Defines {
RESOLVE_MS : NumSamples
RESOLVE_DEPTH_MS : NumSamplesDepth
BLUR_THRESHOLD : BlurThreshold
DEBUG_UNFOCUS : DebugUnfocus
}
}
}