White shadows using ShadowedRenderPass

Hello,



I am having trouble with shadows in jME2. I am trying to render shadows in a simple application (two boxes and two dynamic Nodes (one box and one sphere) don't think it minds but jut in case…), but I am getting "lighted" shadows instead of dark/black ones…  :?



I am using code partially borrowed from flagrust's lesson9 and the forums, by using a passmanager and two passed: first one RenderPass and then ShadowedRenderPass:



        // ---- Passes and passmanager
        passManager = new BasicPassManager();

        //RenderPass (to render SkyBox first as it is only 10x10x10)
        RenderPass rPass = new RenderPass();
        rPass.add(skybox);
        passManager.add(rPass);

        //ShadowPass
        ShadowedRenderPass shadowPass = new ShadowedRenderPass();
        shadowPass.add(rootNode);
        shadowPass.addOccluder(shadowTester);     // jME's Box
        shadowPass.addOccluder(phyBall);                // jME-Physic's dynamic node
        shadowPass.setRenderShadows(true);
        shadowPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Modulative);
        passManager.add(shadowPass);



I have been playing with a ShadowTweaker to test it and I have success (dark shadows) by changing the parametres to:

Blend for Light Passes (S/D)

  • DestinationColor (default)

  • Zero or OneMinusDestinationAlpha instead of OneMinusSourceAlpha



Blend for Texture Pass (S/D)

  • DestinationColor (default)

  • Zero (default)



Are default blending parameters wrong or I am missing something? I know I'd rather use DirectionalShadowMapPass but in the future I'd like to cast shadows from near point lights (like a torch or something).

A screenshot is attached.

Thank you all!

Try lowering the global ambient values of the lightstate. There is also a shadow tweaker in the example I believe, poke around.

Hello,



Thank you for your response. These are my ambient values:



light.setAmbient( new ColorRGBA( 0.1f, 0.1f, 0.1f, 1.0f ) );
lightState.setGlobalAmbient(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));



I think they are low enough to cast dark shadows ;)

I have been already trying the shadow tweaker and changing one parameter it works (see my previos post), but in the example there's no need to change any value in it...

use additive lighting not modulative

ShadowedRenderPass.LightingMethod.Additive

or do this:


light.setAmbient( new ColorRGBA( 1f, 1f, 1f, 0.0f ) );
lightState.setGlobalAmbient(new ColorRGBA(1f, 1f, 1f, 0f));



lights with 0 as alpha will cast correct shadows.

Hello,



I've moved to a new flat so I've been disconnected from the internet for a while (a month and a half…) :stuck_out_tongue:



blue_veek, I've tryed changing alpha values and it works as it should. Thnks

joliver82 said:

Hello,
I've moved to a new flat so I've been disconnected from the internet for a while (a month and a half...) :P
blue_veek, I've tryed changing alpha values and it works as it should. Thnks


happy to help.  :D