Shadows looks a bit strange

Hi!

First post. Started to play around with jMonkeyEngine today. Got a little question.



Using the code here

I get this:

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



And that looks a bit odd if you ask me. Is this the expected result of the above code, or is this an issue with my macbook pro running OSX 10.8.2? (AMD Radeon HD 6490M 256 MB)

@deps81 said:
Hi!
First post. Started to play around with jMonkeyEngine today. Got a little question.

Using the code here
I get this:
http://i.imgur.com/QaboT.png

And that looks a bit odd if you ask me. Is this the expected result of the above code, or is this an issue with my macbook pro running OSX 10.8.2? (AMD Radeon HD 6490M 256 MB)


You're using the BasicShadow renderer here. This is actually doing just what it should. The test model is a worst-case scenario for self shadowing. Try using the PSSMShadow renderer.

Thanks for the quick reply!

I changed the code to use a PssmShadowRenderer and got this:

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

Looks a bit different, but still a bit odd.

Replaced the teapot with a cube instead, as you wrote that the teapot might not be the best model to test stuff with, and it too looks a bit odd at some angles:

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



If this is expected, then fine. Just that I get a bit paranoid that something is wrong with my beloved mac. :slight_smile:

@deps81 said:
Thanks for the quick reply!
I changed the code to use a PssmShadowRenderer and got this:
http://i.imgur.com/bRdJF.png
Looks a bit different, but still a bit odd.
Replaced the teapot with a cube instead, as you wrote that the teapot might not be the best model to test stuff with, and it too looks a bit odd at some angles:
http://i.imgur.com/exbHk.png

If this is expected, then fine. Just that I get a bit paranoid that something is wrong with my beloved mac. :)


Nope! nothing wrong with your machine... Quick explanation as to what you're seeing:

Shadow maps are rendered from the light's perspective... the odd looking "pulling" at the edge of the self shadow is due to the shadow map being stretch over an area of the object that is not present in the shadow map... i.e. no depth is rendered for that area because it is not visible from the light's perspective. @nehon has done a ton of work with the PSSMShadow renderer and there are a ton of different options for "smoothing out the rough edges" for this particular problem.

The edges of the cast shadow can be significantly improved by picking any number of options available for shadow edges as well. Also, increasing the default size of the shadow map from 512 to 1024 makes a huge difference, however, the larger the shadow map, the slower the frame rate (potentially).
1 Like

Thanks for the explanation!

I have been using the free version of unity and is not used to shadows and stuff so much yet. :slight_smile:

Will fiddle around with the settings and see where it leads me.

That’s not your mac, that’s “normal”. The bandings on the cube are a bit strange though.



There are some issues with pssm and some light direction angles (usually very steep angle).

Could you please test TestPssmShadows and TestTransparentShadows?

Also you are using nearest filtering from the look of it, consider trying with PCF

1 Like
@nehon said:
That's not your mac, that's "normal". The bandings on the cube are a bit strange though.

There are some issues with pssm and some light direction angles (usually very steep angle).
Could you please test TestPssmShadows and TestTransparentShadows?
Also you are using nearest filtering from the look of it, consider trying with PCF

Played around with setFilterMode and can probably come up with something that will work in the end. Thanks!
Netbeans wasn't too helpful when I tried to use a render called TestPssmShadows, where can I find more information about it?

It’s actually in the same package as the TestShadow you linked before

http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/

1 Like

I thought that it was some kind of experimental renderer. :slight_smile:

It works like a charm, except that pcfpoission crashes the game.

Tried to add the stacktrace here a couple of times, but every time I press submit the site tells me that there was an error posting, and threw away everything.