LightScatteringFilter Ruins the viewPort Scene rendering

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 !

1 Like

Maybe your parameters are the problem
Maybe the way your methods are called is the problem
Maybe it is something else in your project

Please provide a test case that reproduces your problem.

1 Like

I double checked that , it seems like there are clipping issues when the light beams intersect the terrain , because it works when there’s no terrain ! Please check the videos linked upthere .

If you could make a simple test case then we can help. Otherwise, we’re all going to assume that it’s something that we can’t see.

2 Likes

What’s the simple test case , is there something more simple than this test upthere ?

1 Like

A test case is not “one non-runnable class and a video”.

A test case is “a runnable application, usually one class” that illustrates the problem.

The thing is that we don’t know if it’s something else in your app setup that is the problem. And easily 99 times out of 100, when someone makes a test case they find that the test case works just fine and then they can debug their own app.

For those 1 out of 100 times where it really is a JME bug, the team now has a test case to reproduce the problem and can fix the bug more quickly.

5 Likes

http://www.sscce.org/

3 Likes