Ugly shadows

Hey,



I have some issues with shadows, I draw a sphere on a plane and put some shadows and here is the results :







Pretty ugly as you can see…Here is my code to set up the shadows :

[java]private void initShadows() {

BasicShadowRenderer bSR = new BasicShadowRenderer(assetManager, 256);

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

viewPort.addProcessor(bSR);

rootNode.setShadowMode(ShadowMode.Off);

}[/java]



And i call the initShadows() method in my main then… It’s quite light (no bad joke) but that’s what I found in the tutorials but I rendered better in those.



Any idea to improve this ?

use the PSSMShadowRenderer instead of the BasicShadowRenderer

No shadows anymore O_o… wt* ? What are the size order for the parameters values ? I tried PssmShadowRenderer(assetManager, 256, 256), is this OK ?



Btw, the BasicShadowRenderer seemed to have decent render in the “HelloPhysics” tutorial there must be a way to use it right… I guess.

s4milli4 said:
No shadows anymore O_o... wt* ? What are the size order for the parameters values ? I tried PssmShadowRenderer(assetManager, 256, 256), is this OK ?

nope the second parameter is the number of splits you want to have it's maxed et 4, for your scene 512,1 should work fine.
Have you got any error in the log?

s4milli4 said:
Btw, the BasicShadowRenderer seemed to have decent render in the “HelloPhysics” tutorial there must be a way to use it right… I guess.

256 is very low for a shadow map, if you stick with the basic renderer, try 512 or 1024

With BasicShadowRenderer(assetManager, 1024) :







So not much better (if its not the same). I really can’t explain why.

And regarding the PssmShadowRenderer(assetManager, 512, 1), I still have no shadows at all which is even more weird. :frowning:

Have you got an error in the output with pssm?

Nope it seems to work normally except the fact that there is no shadows Oo.

Actually I may have this :


Mar 15, 2011 10:45:03 AM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation
INFO: Uniform g_WorldViewMatrix is not declared in shader.
Mar 15, 2011 10:45:03 AM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation
INFO: Uniform m_HardwareShadows is not declared in shader.
Mar 15, 2011 10:45:03 AM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation
INFO: Uniform m_FilterMode is not declared in shader.
Mar 15, 2011 10:45:03 AM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation
INFO: Uniform m_PCFEdge is not declared in shader.
Mar 15, 2011 10:45:03 AM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation
INFO: Uniform m_VertexColor is not declared in shader.


but it's not an error so...

try to set the compare mode of the pssmRenderer to software



pssmRenderer.setCompareMode(CompareMode.Software);

Still no shadow/error.

Oo it works now with BasicShadowRenderer(assetsManager, 512)…







I don’t know why it works now and it didn’t earlier… so freak !

Well at this stage, I’ll need a test case to help.

wait what?

basic shadow renderer doesn’t have this constructor signature “BasicShadowRenderer(assetsManager, 512, 1)”

You sure it’s not pssm?

I’ve mistaken myself I’ve edited. It was BasicShadowRenderer(assetsManager, 512).