/** * The method loads fog for the scene. * NOTICE! Remember to manually set the distance and density of the fog. * Unfortunately blender's fog parameters in no way fit to the JME. * @param worldStructure * the world's structure * @return fog filter or null if scene does not define it */ public FogFilter toFog(Structure worldStructure) { FogFilter result = null; int mode = ((Number) worldStructure.getFieldValue("mode")).intValue(); if ((mode & MODE_MIST) != 0) { LOGGER.fine("Loading fog."); result = new FogFilter(); result.setName("FIfog"); result.setFogColor(this.toBackgroundColor(worldStructure)); } return result; }
private void setupFog() { // use fog to give more sense of depth FilterPostProcessor fpp; FogFilter fog; fpp=new FilterPostProcessor(assetManager); fog=new FogFilter(); fog.setFogColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f)); fog.setFogDistance(poiRadius); fog.setFogDensity(2.0f); fpp.addFilter(fog); viewPort.addProcessor(fpp); }
public static FogFilter cloneFogFilter(FogFilter fogFilter){ FogFilter filterClone = new FogFilter(); filterClone.setFogColor(fogFilter.getFogColor()); filterClone.setFogDensity(fogFilter.getFogDensity()); filterClone.setFogDistance(fogFilter.getFogDistance()); filterClone.setName(fogFilter.getName() + " Clone"); return filterClone; }
public void simpleInitApp() { this.flyCam.setMoveSpeed(50); Node mainScene=new Node(); cam.setLocation(new Vector3f(-34.74095f, 95.21318f, -287.4945f)); cam.setRotation(new Quaternion(0.023536969f, 0.9361278f, -0.016098259f, -0.35050195f)); // load sky mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); createTerrain(mainScene); DirectionalLight sun = new DirectionalLight(); Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f); sun.setDirection(lightDir); sun.setColor(ColorRGBA.White.clone().multLocal(2)); mainScene.addLight(sun); rootNode.attachChild(mainScene); fpp=new FilterPostProcessor(assetManager); //fpp.setNumSamples(4); int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples); } fog=new FogFilter(); fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f)); fog.setFogDistance(155); fog.setFogDensity(1.0f); fpp.addFilter(fog); viewPort.addProcessor(fpp); initInputs(); }