dr.setDirection(new Vector3f(0.5f, -0.5f, 0).normalizeLocal());
dr.setDirection(new Vector3f(0.5f, -0.4f, 0).normalizeLocal());
    private void setupTerrain() {        display.getRenderer().setBackgroundColor(                new ColorRGBA(0.5f, 0.5f, 0.5f, 1));        DirectionalLight dr = new DirectionalLight();        dr.setEnabled(true);        dr.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));        dr.setAmbient(new ColorRGBA(.2f, .2f, .2f, .4f));        dr.setDirection(new Vector3f(0.5f, -0.5f, 0).normalizeLocal());        dr.setShadowCaster(true);        CullState cs = display.getRenderer().createCullState();        cs.setCullMode(CullState.CS_BACK);        cs.setEnabled(true);        rootNode.setRenderState(cs);        lightState.detachAll();        lightState.attach(dr);        lightState.setGlobalAmbient(new ColorRGBA(0.99f, 0.99f, 0.99f, 1.0f));        FaultFractalHeightMap heightMap = new FaultFractalHeightMap(257, 32, 0,                255, 0.55f);        Vector3f terrainScale = new Vector3f(10, 1, 10);        heightMap.setHeightScale(0.001f);        page = new TerrainPage("Terrain", 33, heightMap.getSize(),                terrainScale, heightMap.getHeightMap(), false);        page.setDetailTexture(1, 16);        rootNode.attachChild(page);        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(                heightMap);        pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()                .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);        pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()                .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);        pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()                .getResource("jmetest/data/texture/highest.jpg")), 128, 255,                384);        pt.createTexture(512);        TextureState ts = display.getRenderer().createTextureState();        ts.setEnabled(true);        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);        ts.setTexture(t1, 0);        Texture t2 = TextureManager.loadTexture(TestShadowPass.class                .getClassLoader()                .getResource("jmetest/data/texture/Detail.jpg"),                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);        ts.setTexture(t2, 1);        t2.setWrap(Texture.WM_WRAP_S_WRAP_T);        t1.setApply(Texture.AM_COMBINE);        t1.setCombineFuncRGB(Texture.ACF_MODULATE);        t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);        t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);        t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);        t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);        t1.setCombineScaleRGB(1.0f);        t2.setApply(Texture.AM_COMBINE);        t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);        t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);        t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);        t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);        t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);        t2.setCombineScaleRGB(1.0f);        rootNode.setRenderState(ts);        fs = display.getRenderer().createFogState();        fs.setDensity(0.5f);        fs.setEnabled(true);        fs.setColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.5f));        fs.setEnd(1000);        fs.setStart(500);        fs.setDensityFunction(FogState.DF_LINEAR);        fs.setApplyFunction(FogState.AF_PER_VERTEX);        rootNode.setRenderState(fs);    }