Hi, i have made a simple MotionEffect class that uses LightScatteringFilter as a Nitro effect(Production of blur as a simulation of high speed motion), So it works with the Open Space Free Roaming world(Map without a base Terrain) ,but when i used it with Mars Map(Map with a Terrain) it ruined the render :
MotionEffect within Mars Map:
MotionEffect within the Space Map :
Code :
package main_WorldMap;
import com.jme3.asset.AssetManager;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.LightScatteringFilter;
import com.jme3.renderer.ViewPort;
/**
*
* @author Pavly
*/
public class MotionEffect {
private final AssetManager assetManager;
private final ViewPort viewPort;
private FilterPostProcessor fpp;
private LightScatteringFilter light;
public MotionEffect(AssetManager assetManager,ViewPort viewPort){
this.assetManager=assetManager;
this.viewPort=viewPort;
}
public void add(Vector3f directionOfEffect,float blurStart,float blurWidth,boolean state){
fpp=new FilterPostProcessor(assetManager);
light = new LightScatteringFilter(directionOfEffect);
light.setBlurStart(blurStart);
light.setBlurWidth(blurWidth);
fpp.addFilter(light);
viewPort.addProcessor(fpp);
light.setEnabled(state);
}
public void run(Vector3f directionOfEffect,float lightDensity,boolean state){
try{
light.setLightPosition(directionOfEffect);
light.setLightDensity(lightDensity);
light.setEnabled(state);
}catch(Exception e){
System.err.println(e.getMessage());
}
}
public void removeProcessorEffect(){
try{
light.setEnabled(false);
}catch(Exception e){
System.err.println(e.getMessage());
}
}
}
So , whats problem ?
Thank you !