Horde3D
http://horde3d.org/forums/

[solved] Strange issue with shadows
http://horde3d.org/forums/viewtopic.php?f=3&t=1266
Page 1 of 2

Author:  worstplayer [ 02.10.2010, 15:45 ]
Post subject:  [solved] Strange issue with shadows

Shadows seem to appear and disappear depending on, well, something.

http://www.youtube.com/watch?v=VFdhYGNAJW4
(deferred lighting, but forward does the same)

Can anyone tell me what I'm doing wrong?

EDIT: example http://www.mediafire.com/?mpjoq02wzdegjoz

Author:  marciano [ 03.10.2010, 09:15 ]
Post subject:  Re: Strange issue with shadows

Hm, how many shadow cascades are you using? In case you have several, does the problem appear as well if you set the light's ShadowMapCount to 1? And what is the FOV angle of your light?

Author:  worstplayer [ 03.10.2010, 09:23 ]
Post subject:  Re: Strange issue with shadows

Tried multiple FOVs and ShadowMapCounts, happens with all of them. This particular scene is 60 and 1.

Author:  worstplayer [ 03.10.2010, 10:59 ]
Post subject:  Re: Strange issue with shadows

This is strange...putting the whole scene inside a big sphere seems to fix the problem, even though the sphere is well outside camera's (and any light's) range, with normals pointing away.

EDIT: or not, now this happens: http://www.youtube.com/watch?v=ffWP8aAIEos
some kind of minimum distance?

Author:  marciano [ 03.10.2010, 19:09 ]
Post subject:  Re: Strange issue with shadows

This looks really weird. Is there a quick way to reproduce the problem in our samples? (different assets would be ok)

Author:  worstplayer [ 03.10.2010, 20:11 ]
Post subject:  Re: Strange issue with shadows

Modify chicago sample so the light is attached to the camera, half unit or so to the side

Code:
H3DNode light = h3dAddLightNode( _cam, "Light1", lightMatRes, "LIGHTING", "SHADOWMAP" );
h3dSetNodeTransform( light, -0.5, 0, 0, 0, 0, 0, 1, 1, 1 );


and replace platform with attached one.

it's visible when you look at the base of the pillar, like this:
Image

Attachments:
platform.zip [1.67 KiB]
Downloaded 967 times

Author:  marciano [ 03.10.2010, 23:28 ]
Post subject:  Re: Strange issue with shadows

Thanks for the test case.

I assume the problem you show in the screenshot comes from the fact that the light source is left besides the camera, so if you hide behind the pillar, the light frustum can clip the geometry although the player camera does not.
Anyway, this is just half of the issue. There is definitely a problem with the way the post-projective scene AABB was computed. The attached patch should make it better.

Attachments:
ShadowFix.zip [1.08 KiB]
Downloaded 956 times

Author:  worstplayer [ 04.10.2010, 11:02 ]
Post subject:  Re: Strange issue with shadows

Yes, it looks much better now. Thanks a lot.

Author:  worstplayer [ 13.10.2010, 00:58 ]
Post subject:  Re: [solved] Strange issue with shadows

Another (related?) problem.

http://www.youtube.com/watch?v=ax10JQ3Ks0A
(look at bottom right corner)

Can't reproduce it in Chicago no matter what I do, but only way i could "de-reproduce" it from game was

frustMinX=-0.01;
frustMaxX=0.01;
frustMinY=-0.01;
frustMaxY=0.01;
frustMinZ=-0.01;
frustMaxZ=0.01;

(ew, did i just write that? I feel dirty :lol: )

EDIT: oops, the video was set to "private", should work now.

Author:  marciano [ 13.10.2010, 23:47 ]
Post subject:  Re: [solved] Strange issue with shadows

It is difficult to judge just from the video what might go wrong. Could you try removing the two fabsf in the code to see if it makes any difference?

Author:  worstplayer [ 14.10.2010, 00:52 ]
Post subject:  Re: [solved] Strange issue with shadows

Removing the first one doesn't seem to do anything, removing the second one (or both) makes larger parts of shadow disappear under same angles that caused it previously.

EDIT: did some more testing in game, and this time, removing sky-sphere fixes it, as well as making it smaller. It also only appears with shadowMapCount 1.

EDIT2: And here's another one... this happens when you put attached platform into otherwise unmodified Chicago sample: If you subdivide the model or put the light further away it becomes less visible.
Image
I don't know if it's really a bug or just the way shadow maps work and the problem is in my models.

Attachments:
platform.zip [1.2 KiB]
Downloaded 971 times

Author:  marciano [ 16.10.2010, 00:02 ]
Post subject:  Re: [solved] Strange issue with shadows

Thanks for the repro case, the problem shown in the screenshot was easy to fix. It was caused by the fact that the distance computed in the vertex shader is not getting interpolated properly accross a huge polygon due to the non-linearity of the data (vector length computation empolys a square root).

As for the other issue, if you somehow manage to put together a test case, we can take a look at the problem. BTW, it would be good to disable shadows for the skybox anyway as a lot of shadow map space will be wasted. This will require the setNodeFlags function though with some NO_CAST_SHADOW flag.

Author:  worstplayer [ 16.10.2010, 02:06 ]
Post subject:  Re: [solved] Strange issue with shadows

Yeah that fixed it (and that cutout thing in post #4 too). Thanks again, You're the greatest. I'll definitely make a repro case if I find the second bug in some repeatable setting. And yeah, skybox was just temporary, i'll remove shadows and lighting from it or remove it completely.

Author:  marciano [ 17.10.2010, 22:16 ]
Post subject:  Re: [solved] Strange issue with shadows

Great that it is working now for you!

We finally added the long announced scene node flags, so it is easily possible now to disable shadows for a mesh or a whole model.

Author:  worstplayer [ 20.10.2010, 17:21 ]
Post subject:  Re: [solved] Strange issue with shadows

Found a setting where this bug appears consistently. Or maybe it's a different one, I don't know.
Image
Same modifications, different platform.geo (attached)
Code:
   H3DNode light = h3dAddLightNode( _cam, "Light1", lightMatRes, "LIGHTING", "SHADOWMAP" );
   h3dSetNodeTransform( light, -0.5, 0, 0, 0, 0, 0, 1, 1, 1 );


I'm probably getting incredibly annoying at this point :lol:

Attachments:
platform.zip [4.77 KiB]
Downloaded 935 times

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/