Camera Casting Shadow?

I’m having an issue where it seems that getting too close to an object results on a shadow being rendered from the bottom of the viewport to an area parallel to the bottom. Any ideas as to what’s causing this [and how to stop it] would be much appreciated!



http://i.imgur.com/Bo2uD.png

Hey, I have this problem too! It seems intermittent for me; sometimes it works perfectly fine and sometimes it doesn’t.



http://www.youtube.com/watch?v=7F8aWJDMcP8



Does TestTransparentSSAO work for you?

Yep, both are working for me on a 2010 MacBook Pro with the GT330M.



I was thinking that had something to do with my near frustum as it was parallel with the bottom of the viewport, but changing the value didn’t have any result on this particular issue.

So I solved the problem, my camera’s aspect ratio was incorrect (was passing in 0, d’oh!)



Interestingly, while creating a test case, the case now exhibits the problem and the correct aspect ratio doesn’t fix it! Code below:



[java]

import com.jme3.app.SimpleApplication;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.queue.RenderQueue.ShadowMode;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.shadow.BasicShadowRenderer;

import com.jme3.shadow.PssmShadowRenderer;

import com.jme3.shadow.PssmShadowRenderer.CompareMode;

import com.jme3.shadow.PssmShadowRenderer.FilterMode;



/**

  • @author Skye Book

    *

    */

    public class ShadowGlitchTest extends SimpleApplication {

    public static final float NEAR_FRUSTUM = .001f;

    public static final float FAR_FRUSTUM = 350f;



    /**

    *

    /

    public ShadowGlitchTest() {

    }



    public void loadStuff(){



    // turn off shadows for the entire scene, set it up on an as-needed basis

    rootNode.setShadowMode(ShadowMode.Off);



    Material matSoil = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");

    matSoil.setColor("Color", ColorRGBA.Cyan);

    Geometry soil = new Geometry("soil", new Box(new Vector3f(0, 0, 0), 100, .01f, 100));

    soil.setMaterial(matSoil);

    soil.setShadowMode(ShadowMode.Receive);

    rootNode.attachChild(soil);



    }



    /
    (non-Javadoc)
  • @see com.jme3.app.SimpleApplication#simpleInitApp()

    */

    @Override

    public void simpleInitApp() {

    settings.setFrameRate(30);

    float aspect = (float) getContext().getSettings().getWidth() /getContext().getSettings().getHeight();

    // Parameters of the frustum for perspective : field of view (angle of view in the Y direction), aspect, near, far

    cam.setFrustumPerspective( 45.0f, aspect, NEAR_FRUSTUM, FAR_FRUSTUM);



    ColorRGBA diffuseLightColor = new ColorRGBA(1f, 1f, 1f, 1f);



    ColorRGBA diffuseLightColor2 = new ColorRGBA(.3f,.4f,.45f,.3f);



    DirectionalLight directionalLight = new DirectionalLight();

    directionalLight.setDirection(new Vector3f(.25f, -.85f, .75f)); //previously 1, -.85f, 0

    directionalLight.setColor(diffuseLightColor);



    DirectionalLight directionalLight2 = new DirectionalLight();

    directionalLight2.setDirection(new Vector3f(-.25f,.85f,-.75f));//previously -1f,.85f,0)

    directionalLight2.setColor(diffuseLightColor2);



    rootNode.addLight(directionalLight);

    rootNode.addLight(directionalLight2);



    loadStuff();

    flyCam.setMoveSpeed(30f);



    setupShadows(true);

    }



    private void setupShadows(boolean usePSSM){

    if(usePSSM){

    PssmShadowRenderer pssmRenderer = new PssmShadowRenderer(assetManager,4096,8);

    pssmRenderer.setDirection(new Vector3f(.25f, -.85f, .75f).normalizeLocal());

    pssmRenderer.setLambda(0.55f);

    pssmRenderer.setShadowIntensity(.6f);

    //pssmRenderer.setEdgesThickness(0);

    pssmRenderer.setCompareMode(CompareMode.Hardware);

    pssmRenderer.setFilterMode(FilterMode.Nearest);

    //pssmRenderer.displayDebug();

    viewPort.addProcessor(pssmRenderer);

    }

    else{

    BasicShadowRenderer bsr = new BasicShadowRenderer(assetManager, 4096);

    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());

    viewPort.addProcessor(bsr);

    }

    }



    /**
  • @param args

    */

    public static void main(String[] args) {

    ShadowGlitchTest main = new ShadowGlitchTest();

    main.start();

    }

    }



    [/java]

LOOL!

That kickass knife can move concrete car blocks xP

For some reason I couldn’t get your test case to work … Maybe its some of my local changes :o

You couldn’t get it to work as in it wouldn’t run or it wouldn’t reproduce the problem?

I get a black screen

have you tried moving around a bit? If you move the camera directly up you should be able to see a light blue quad on the screen