Search in sources :

Example 1 with FadeFilter

use of com.jme3.post.filters.FadeFilter in project jmonkeyengine by jMonkeyEngine.

the class TestCinematic method createScene.

private void createScene() {
    model = (Spatial) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
    model.center();
    model.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(model);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Cyan);
    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
    teapot.setLocalTranslation(10, 0, 10);
    teapot.setMaterial(mat);
    teapot.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(teapot);
    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Gray);
    matSoil.setColor("Diffuse", ColorRGBA.Green);
    matSoil.setColor("Specular", ColorRGBA.Black);
    Geometry soil = new Geometry("soil", new Box(50, 1, 50));
    soil.setLocalTranslation(0, -6, 0);
    soil.setMaterial(matSoil);
    soil.setShadowMode(ShadowMode.Receive);
    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);
    fpp = new FilterPostProcessor(assetManager);
    fade = new FadeFilter();
    fpp.addFilter(fade);
    if (renderer.getCaps().contains(Caps.GLSL100)) {
        PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
        pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
        pssm.setShadowIntensity(0.4f);
        viewPort.addProcessor(pssm);
        viewPort.addProcessor(fpp);
    }
}
Also used : Geometry(com.jme3.scene.Geometry) PssmShadowRenderer(com.jme3.shadow.PssmShadowRenderer) DirectionalLight(com.jme3.light.DirectionalLight) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material) Box(com.jme3.scene.shape.Box) FilterPostProcessor(com.jme3.post.FilterPostProcessor) FadeFilter(com.jme3.post.filters.FadeFilter)

Example 2 with FadeFilter

use of com.jme3.post.filters.FadeFilter in project jmonkeyengine by jMonkeyEngine.

the class TestPostFilters method setupFilters.

public void setupFilters() {
    if (renderer.getCaps().contains(Caps.GLSL100)) {
        fpp = new FilterPostProcessor(assetManager);
        //     fpp.setNumSamples(4);
        // fpp.setNumSamples(4);
        //fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
        fpp.addFilter(new RadialBlurFilter());
        fade = new FadeFilter(1.0f);
        fpp.addFilter(fade);
        viewPort.addProcessor(fpp);
    }
}
Also used : FilterPostProcessor(com.jme3.post.FilterPostProcessor)

Aggregations

FilterPostProcessor (com.jme3.post.FilterPostProcessor)2 DirectionalLight (com.jme3.light.DirectionalLight)1 Material (com.jme3.material.Material)1 Vector3f (com.jme3.math.Vector3f)1 FadeFilter (com.jme3.post.filters.FadeFilter)1 Geometry (com.jme3.scene.Geometry)1 Box (com.jme3.scene.shape.Box)1 PssmShadowRenderer (com.jme3.shadow.PssmShadowRenderer)1