Java Code Examples for com.jme3.scene.Geometry#setMaterial()

The following examples show how to use com.jme3.scene.Geometry#setMaterial() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestCollisionShapeFactory.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void attachRandomGeometry(Node node, Material mat) {
    Box box = new Box(0.25f, 0.25f, 0.25f);
    Torus torus = new Torus(16, 16, 0.2f, 0.8f);
    Geometry[] boxes = new Geometry[]{
        new Geometry("box1", box),
        new Geometry("box2", box),
        new Geometry("box3", box),
        new Geometry("torus1", torus),
        new Geometry("torus2", torus),
        new Geometry("torus3", torus)
    };
    for (int i = 0; i < boxes.length; i++) {
        Geometry geometry = boxes[i];
        geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
        geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI));
        geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
        geometry.setMaterial(mat);
        node.attachChild(geometry);
    }
}
 
Example 2
Source File: TestResizableApp.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    flyCam.setDragToRotate(true);
    
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
    
    txt = new BitmapText(loadGuiFont(), false);
    txt.setText("Drag the corners of the application to resize it.\n" +
                "Current Size: " + settings.getWidth() + "x" + settings.getHeight());
    txt.setLocalTranslation(0, settings.getHeight(), 0);
    guiNode.attachChild(txt);
}
 
Example 3
Source File: TestSphere.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    Sphere sphMesh = new Sphere(14, 14, 1);
    Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");

    for (int y = -5; y < 5; y++){
        for (int x = -5; x < 5; x++){
            Geometry sphere = new Geometry("sphere", sphMesh);
            sphere.setMaterial(solidColor);
            sphere.setLocalTranslation(x * 2, 0, y * 2);
            rootNode.attachChild(sphere);
        }
    }
    cam.setLocation(new Vector3f(0, 5, 0));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
}
 
Example 4
Source File: TestShaderNodes.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    flyCam.setMoveSpeed(20);
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);
    Box boxshape1 = new Box(1f, 1f, 1f);
    Geometry cube_tex = new Geometry("A Textured Box", boxshape1);
    Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
    mat.selectTechnique(TechniqueDef.DEFAULT_TECHNIQUE_NAME, renderManager);
    Technique t = mat.getActiveTechnique();

    for (Shader.ShaderSource shaderSource : t.getDef().getShader(assetManager, renderer.getCaps(), t.getDynamicDefines()).getSources()) {
        System.out.println(shaderSource.getSource());
    }
    
    mat.setColor("Color", ColorRGBA.Yellow);
    mat.setTexture("ColorMap", tex);
    cube_tex.setMaterial(mat);
    rootNode.attachChild(cube_tex);
}
 
Example 5
Source File: TerrainTestModifyHeight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void createMarker() {
    // collision marker
    Sphere sphere = new Sphere(8, 8, 0.5f);
    marker = new Geometry("Marker");
    marker.setMesh(sphere);
    
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", new ColorRGBA(251f/255f, 130f/255f, 0f, 0.6f));
    mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    
    marker.setMaterial(mat);
    rootNode.attachChild(marker);
    
    
    // surface normal marker
    Arrow arrow = new Arrow(new Vector3f(0,1,0));
    markerNormal = new Geometry("MarkerNormal");
    markerNormal.setMesh(arrow);
    markerNormal.setMaterial(mat);
    rootNode.attachChild(markerNormal);
}
 
Example 6
Source File: CubeField.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
     * Randomly Places a cube on the map between 30 and 90 paces away from player
     */
    private void randomizeCube() {
        Geometry cube = fcube.clone();
        int playerX = (int) player.getLocalTranslation().getX();
        int playerZ = (int) player.getLocalTranslation().getZ();
//        float x = FastMath.nextRandomInt(playerX + difficulty + 10, playerX + difficulty + 150);
        float x = FastMath.nextRandomInt(playerX + difficulty + 30, playerX + difficulty + 90);
        float z = FastMath.nextRandomInt(playerZ - difficulty - 50, playerZ + difficulty + 50);
        cube.getLocalTranslation().set(x, 0, z);

//        playerX+difficulty+30,playerX+difficulty+90

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        if (!solidBox){
            mat.getAdditionalRenderState().setWireframe(true);
        }
        mat.setColor("Color", obstacleColors.get(FastMath.nextRandomInt(0, obstacleColors.size() - 1)));
        cube.setMaterial(mat);

        rootNode.attachChild(cube);
        cubeField.add(cube);
    }
 
Example 7
Source File: TestAmbient.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
  float[] eax = new float[]{15, 38.0f, 0.300f, -1000, -3300, 0,
    1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f,
    0.00f, -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f,
    0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f};
  Environment env = new Environment(eax);
  audioRenderer.setEnvironment(env);

  waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false);
  waves.setPositional(true);
  waves.setLocalTranslation(new Vector3f(0, 0,0));
  waves.setMaxDistance(100);
  waves.setRefDistance(5);

  nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
  nature.setVolume(3);
  
  waves.playInstance();
  nature.play();
  
  // just a blue box to mark the spot
  Box box1 = new Box(Vector3f.ZERO, .5f, .5f, .5f);
  Geometry player = new Geometry("Player", box1);
  Material mat1 = new Material(assetManager,
          "Common/MatDefs/Misc/Unshaded.j3md");
  mat1.setColor("Color", ColorRGBA.Blue);
  player.setMaterial(mat1);
  rootNode.attachChild(player);
}
 
Example 8
Source File: TestAppStateLifeCycle.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    geom.setMaterial(mat);
    rootNode.attachChild(geom);

    System.out.println("Attaching test state.");
    stateManager.attach(new TestState());
    
    System.out.println("Attaching test state with an ID.");
    stateManager.attach(new TestState("Test ID"));        
}
 
Example 9
Source File: TestObjLoading.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    // create the geometry and attach it
    Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
    
    // show normals as material
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
    teaGeom.setMaterial(mat);

    rootNode.attachChild(teaGeom);
}
 
Example 10
Source File: TestLineWidthRenderState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    setDisplayFps(false);
    setDisplayStatView(false);
    cam.setLocation(new Vector3f(5.5826545f, 3.6192513f, 8.016988f));
    cam.setRotation(new Quaternion(-0.04787097f, 0.9463123f, -0.16569641f, -0.27339742f));

    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setWireframe(true);
    mat.getAdditionalRenderState().setLineWidth(2);
    geom.setMaterial(mat);
    rootNode.attachChild(geom);

    inputManager.addListener(new ActionListener() {
        @Override
        public void onAction(String name, boolean isPressed, float tpf) {
            if(name.equals("up") && isPressed){
                mat.getAdditionalRenderState().setLineWidth(mat.getAdditionalRenderState().getLineWidth() + 1);
            }
            if(name.equals("down") && isPressed){
                mat.getAdditionalRenderState().setLineWidth(Math.max(mat.getAdditionalRenderState().getLineWidth() - 1, 1));
            }
        }
    }, "up", "down");
    inputManager.addMapping("up", new KeyTrigger(KeyInput.KEY_U));
    inputManager.addMapping("down", new KeyTrigger(KeyInput.KEY_J));
}
 
Example 11
Source File: LightsDebugState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void initialize(Application app) {
    debugNode = new Node("Environment debug Node");
    Sphere s = new Sphere(16, 16, 0.15f);
    debugGeom = new Geometry("debugEnvProbe", s);
    debugMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/reflect.j3md");
    debugGeom.setMaterial(debugMaterial);
    debugBounds = BoundingSphereDebug.createDebugSphere(app.getAssetManager());
    if (scene == null) {
        scene = app.getViewPort().getScenes().get(0);
    }
}
 
Example 12
Source File: TestPostFilters.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setupFloor() {
    Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m");
    mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat);
    mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat);
    mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat);
    Box floor = new Box(Vector3f.ZERO, 50, 1f, 50);
    TangentBinormalGenerator.generate(floor);
    floor.scaleTextureCoordinates(new Vector2f(5, 5));
    Geometry floorGeom = new Geometry("Floor", floor);
    floorGeom.setMaterial(mat);
    floorGeom.setShadowMode(ShadowMode.Receive);
    rootNode.attachChild(floorGeom);
}
 
Example 13
Source File: CubeField.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Node createPlayer() {
    Dome b = new Dome(Vector3f.ZERO, 10, 100, 1);
    Geometry playerMesh = new Geometry("Box", b);

    playerMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    playerMaterial.setColor("Color", ColorRGBA.Red);
    playerMesh.setMaterial(playerMaterial);
    playerMesh.setName("player");

    Box floor = new Box(100, 0, 100);
    
    Geometry floorMesh = new Geometry("Box", floor);

    Vector3f translation = Vector3f.ZERO.add(playerMesh.getLocalTranslation().getX(),
            playerMesh.getLocalTranslation().getY() - 1, 0);

    floorMesh.setLocalTranslation(translation);

    floorMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    floorMaterial.setColor("Color", ColorRGBA.LightGray);
    floorMesh.setMaterial(floorMaterial);
    floorMesh.setName("floor");

    Node playerNode = new Node();
    playerNode.attachChild(playerMesh);
    playerNode.attachChild(floorMesh);

    return playerNode;
}
 
Example 14
Source File: TestBatchNodeTower.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void initFloor() {
    Box floorBox = new Box(10f, 0.1f, 5f);
    floorBox.scaleTextureCoordinates(new Vector2f(3, 6));

    Geometry floor = new Geometry("floor", floorBox);
    floor.setMaterial(mat3);
    floor.setShadowMode(ShadowMode.Receive);
    floor.setLocalTranslation(0, 0, 0);
    floor.addControl(new RigidBodyControl(0));
    this.rootNode.attachChild(floor);
    this.getPhysicsSpace().add(floor);
}
 
Example 15
Source File: TestMotionPath.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void createScene() {
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setFloat("Shininess", 1f);
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Black);
    mat.setColor("Diffuse", ColorRGBA.DarkGray);
    mat.setColor("Specular", ColorRGBA.White.mult(0.6f));
    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Black);
    matSoil.setColor("Diffuse", ColorRGBA.Black);
    matSoil.setColor("Specular", ColorRGBA.Black);
    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
    teapot.setName("Teapot");
    teapot.setLocalScale(3);
    teapot.setMaterial(mat);


    rootNode.attachChild(teapot);
    Geometry soil = new Geometry("soil", new Box(50, 1, 50));
    soil.setLocalTranslation(0, -1, 0);
    soil.setMaterial(matSoil);

    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);
}
 
Example 16
Source File: TestMousePick.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** A red ball that marks the last spot that was "hit" by the "shot". */
protected void initMark() {
    Arrow arrow = new Arrow(Vector3f.UNIT_Z.mult(2f));
    arrow.setLineWidth(3);

    //Sphere sphere = new Sphere(30, 30, 0.2f);
    mark = new Geometry("BOOM!", arrow);
    //mark = new Geometry("BOOM!", sphere);
    Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mark_mat.setColor("Color", ColorRGBA.Red);
    mark.setMaterial(mark_mat);
}
 
Example 17
Source File: HelloJME3.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin
    Geometry geom = new Geometry("Box", b);  // create cube geometry from the shape
    Material mat = new Material(assetManager,
      "Common/MatDefs/Misc/Unshaded.j3md");  // create a simple material
    mat.setColor("Color", ColorRGBA.Blue);   // set color of material to blue
    geom.setMaterial(mat);                   // set the cube's material
    rootNode.attachChild(geom);              // make the cube appear in the scene
}
 
Example 18
Source File: TestCrossHatch.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    // put the camera in a bad position
    cam.setLocation(new Vector3f(-2.336393f, 11.91392f, -7.139601f));
    cam.setRotation(new Quaternion(0.23602544f, 0.11321983f, -0.027698677f, 0.96473104f));
    //cam.setFrustumFar(1000);


    Material mat = new Material(assetManager,"Common/MatDefs/Light/Lighting.j3md");
    mat.setFloat("Shininess", 15f);
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Yellow.mult(0.2f));
    mat.setColor("Diffuse", ColorRGBA.Yellow.mult(0.2f));
    mat.setColor("Specular", ColorRGBA.Yellow.mult(0.8f));




    Material matSoil = new Material(assetManager,"Common/MatDefs/Light/Lighting.j3md");
    matSoil.setFloat("Shininess", 15f);
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Gray);
    matSoil.setColor("Diffuse", ColorRGBA.Black);
    matSoil.setColor("Specular", ColorRGBA.Gray);
   


    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
    teapot.setLocalTranslation(0,0,10);

    teapot.setMaterial(mat);
    teapot.setShadowMode(ShadowMode.CastAndReceive);
    teapot.setLocalScale(10.0f);
    rootNode.attachChild(teapot);

  

    Geometry soil = new Geometry("soil", new Box(800, 10, 700));
    soil.setLocalTranslation(0, -13, 550);
    soil.setMaterial(matSoil);
    soil.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(soil);

    DirectionalLight light=new DirectionalLight();
    light.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);

    // load sky
    Spatial sky = SkyFactory.createSky(assetManager, 
            "Textures/Sky/Bright/FullskiesBlueClear03.dds",
            EnvMapType.CubeMap);
    sky.setCullHint(Spatial.CullHint.Never);
    rootNode.attachChild(sky);

    fpp=new FilterPostProcessor(assetManager);
    
    int numSamples = getContext().getSettings().getSamples();
    if( numSamples > 0 ) {
        fpp.setNumSamples(numSamples); 
    }
    
    CrossHatchFilter chf=new CrossHatchFilter();
    
   

    viewPort.addProcessor(fpp);
    fpp.addFilter(chf);
    initInputs();

}
 
Example 19
Source File: TestRenderToMemory.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setupOffscreenView(){
        offCamera = new Camera(width, height);

        // create a pre-view. a view that is rendered before the main view
        offView = renderManager.createPreView("Offscreen View", offCamera);
        offView.setBackgroundColor(ColorRGBA.DarkGray);
        offView.setClearFlags(true, true, true);
        
        // this will let us know when the scene has been rendered to the 
        // frame buffer
        offView.addProcessor(this);

        // create offscreen framebuffer
        offBuffer = new FrameBuffer(width, height, 1);

        //setup framebuffer's cam
        offCamera.setFrustumPerspective(45f, 1f, 1f, 1000f);
        offCamera.setLocation(new Vector3f(0f, 0f, -5f));
        offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

        //setup framebuffer's texture
//        offTex = new Texture2D(width, height, Format.RGBA8);

        //setup framebuffer to use renderbuffer
        // this is faster for gpu -> cpu copies
        offBuffer.setDepthBuffer(Format.Depth);
        offBuffer.setColorBuffer(Format.RGBA8);
//        offBuffer.setColorTexture(offTex);
        
        //set viewport to render to offscreen framebuffer
        offView.setOutputFrameBuffer(offBuffer);

        // setup framebuffer's scene
        Box boxMesh = new Box(Vector3f.ZERO, 1,1,1);
        Material material = assetManager.loadMaterial("Interface/Logo/Logo.j3m");
        offBox = new Geometry("box", boxMesh);
        offBox.setMaterial(material);

        // attach the scene to the viewport to be rendered
        offView.attachScene(offBox);
    }
 
Example 20
Source File: TestPointDirectionalAndSpotLightShadows.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    flyCam.setMoveSpeed(10);
    cam.setLocation(new Vector3f(0.040581334f, 1.7745866f, 6.155161f));
    cam.setRotation(new Quaternion(4.3868728E-5f, 0.9999293f, -0.011230096f, 0.0039059948f));


    Node scene = (Node) assetManager.loadModel("Models/Test/CornellBox.j3o");
    scene.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
    rootNode.attachChild(scene);
    rootNode.getChild("Cube").setShadowMode(RenderQueue.ShadowMode.Receive);
    lightNode = (Node) rootNode.getChild("Lamp");
    Geometry lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
    //Geometry  lightMdl = new Geometry("Light", new Box(.1f,.1f,.1f));
    lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
    lightMdl.setShadowMode(RenderQueue.ShadowMode.Off);
    lightNode.attachChild(lightMdl);
    //lightMdl.setLocalTranslation(lightNode.getLocalTranslation());


    Geometry box = new Geometry("box", new Box(0.2f, 0.2f, 0.2f));
    //Geometry  lightMdl = new Geometry("Light", new Box(.1f,.1f,.1f));
    box.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
    box.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
    rootNode.attachChild(box);
    box.setLocalTranslation(-1f, 0.5f, -2);

    scene.getLocalLightList().get(0).setColor(ColorRGBA.Red);
    
    plsr = new PointLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
    plsr.setLight((PointLight) scene.getLocalLightList().get(0));
    plsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);



    plsf = new PointLightShadowFilter(assetManager, SHADOWMAP_SIZE);
    plsf.setLight((PointLight) scene.getLocalLightList().get(0));     
    plsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
    plsf.setEnabled(useFilter);

    //DIRECTIONAL LIGHT
    DirectionalLight directionalLight = new DirectionalLight();
    rootNode.addLight(directionalLight);
    directionalLight.setColor(ColorRGBA.Blue);
    directionalLight.setDirection(new Vector3f(-1f, -.2f, 0f));
    dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE*2, 4);
    dlsr.setLight(directionalLight);
    dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
    
    dlsf = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE*2, 4);
    dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
    dlsf.setLight(directionalLight);        
    dlsf.setEnabled(useFilter);
    
    //SPOT LIGHT
    spotLight = new SpotLight();
    spotLight.setDirection(new Vector3f(1f,-1f,0f));
    spotLight.setPosition(new Vector3f(-1f,3f,0f));
    spotLight.setSpotOuterAngle(0.5f);
    spotLight.setColor(ColorRGBA.Green);
    Sphere sphere = new Sphere(8, 8, .1f);
    Geometry sphereGeometry = new Geometry("Sphere", sphere);
    sphereGeometry.setLocalTranslation(-1f, 3f, 0f);
    sphereGeometry.setMaterial(assetManager.loadMaterial("Common/Materials/WhiteColor.j3m"));
    rootNode.attachChild(sphereGeometry);
    rootNode.addLight(spotLight);
    
    slsr = new SpotLightShadowRenderer(assetManager, SHADOWMAP_SIZE);
    slsr.setLight(spotLight);
    slsr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
    
    slsf = new SpotLightShadowFilter(assetManager, SHADOWMAP_SIZE);
    slsf.setLight(spotLight);
    slsf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
    slsf.setEnabled(useFilter);
    
    
    
    if (!useFilter)viewPort.addProcessor(slsr);
    if (!useFilter)viewPort.addProcessor(plsr);
    if (!useFilter)viewPort.addProcessor(dlsr);
    
    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    fpp.addFilter(plsf);
    fpp.addFilter(dlsf);
    fpp.addFilter(slsf);
    viewPort.addProcessor(fpp);
          
    ShadowTestUIManager uiMan = new ShadowTestUIManager(assetManager, plsr, plsf, guiNode, inputManager, viewPort);
    ShadowTestUIManager uiManPls = new ShadowTestUIManager(assetManager, plsr, plsf, guiNode, inputManager, viewPort);
    ShadowTestUIManager uiManDls = new ShadowTestUIManager(assetManager, dlsr, dlsf, guiNode, inputManager, viewPort);
    ShadowTestUIManager uiManSls = new ShadowTestUIManager(assetManager, slsr, slsf, guiNode, inputManager, viewPort);
  
}