We use ambient occlusion (SSAO) in scenes with no directional sunlight; for example, to simulate a gloomy indoor scene, a narrow street, or a gray, overcast day.
You activate ambient occlusion as follows:
Make a copy of
Main.java
and name the classShadowSSAO.java
. Remember to also refactor the first line of themain()
method toShadowSSAO app = new ShadowSSAO()
.Add
FilterPostProcessor
as a class field, and initialize it in thesimpleInitApp()
method. AddFilterPostProcessor
toviewPort
of yourSimpleApplication
:private FilterPostProcessor fpp; public void simpleInitApp() { FilterPostProcessor fpp = new FilterPostProcessor(assetManager); viewPort.addProcessor(fpp);
Create an
SSAOFilter
object (fromcom.jme3.post.ssao
), and add it to yourFilterPostProcessor
to activateSSAOFilter
:SSAOFilter ssaoFilter = new SSAOFilter(12.94f,43.93f,.33f,.60f); fpp.addFilter(ssaoFilter);
Add at least one ambient light source to the scene:
AmbientLight ambientLight...