Horde3D

Next-Generation Graphics Engine
It is currently 28.03.2024, 09:35

All times are UTC + 1 hour




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 02.10.2010, 15:45 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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


Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 09:15 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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?


Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 09:23 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
Tried multiple FOVs and ShadowMapCounts, happens with all of them. This particular scene is 60 and 1.


Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 10:59 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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?


Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 19:09 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
This looks really weird. Is there a quick way to reproduce the problem in our samples? (different assets would be ok)


Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 20:11 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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 945 times
Top
 Profile  
Reply with quote  
PostPosted: 03.10.2010, 23:28 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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 919 times
Top
 Profile  
Reply with quote  
PostPosted: 04.10.2010, 11:02 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
Yes, it looks much better now. Thanks a lot.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2010, 00:58 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2010, 23:47 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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?


Top
 Profile  
Reply with quote  
PostPosted: 14.10.2010, 00:52 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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 937 times
Top
 Profile  
Reply with quote  
PostPosted: 16.10.2010, 00:02 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 16.10.2010, 02:06 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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.


Top
 Profile  
Reply with quote  
PostPosted: 17.10.2010, 22:16 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 20.10.2010, 17:21 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
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 906 times
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group