LightScatteringFilter : changed the way lightdensity attenuation is computed according to this thread
http://hub.jmonkeyengine.org/forum/topic/light-scattering/#post-207641 Chose the second proposition. git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@11054 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
c5448f9aae
commit
8e65f333d8
@ -37,6 +37,7 @@ import com.jme3.export.JmeExporter;
|
|||||||
import com.jme3.export.JmeImporter;
|
import com.jme3.export.JmeImporter;
|
||||||
import com.jme3.export.OutputCapsule;
|
import com.jme3.export.OutputCapsule;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.Filter;
|
import com.jme3.post.Filter;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
@ -102,7 +103,9 @@ public class LightScatteringFilter extends Filter {
|
|||||||
getClipCoordinates(lightPosition, screenLightPos, viewPort.getCamera());
|
getClipCoordinates(lightPosition, screenLightPos, viewPort.getCamera());
|
||||||
viewPort.getCamera().getViewMatrix().mult(lightPosition, viewLightPos);
|
viewPort.getCamera().getViewMatrix().mult(lightPosition, viewLightPos);
|
||||||
if (adaptative) {
|
if (adaptative) {
|
||||||
innerLightDensity = Math.max(lightDensity - Math.max(screenLightPos.x, screenLightPos.y), 0.0f);
|
float densityX = 1f - FastMath.clamp(FastMath.abs(screenLightPos.x - 0.5f), 0, 1);
|
||||||
|
float densityY = 1f - FastMath.clamp(FastMath.abs(screenLightPos.y - 0.5f), 0, 1);
|
||||||
|
innerLightDensity = lightDensity * densityX * densityY;
|
||||||
} else {
|
} else {
|
||||||
innerLightDensity = lightDensity;
|
innerLightDensity = lightDensity;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user