ShadowHelper Code Never Completes

Started by AGP, August 18, 2012, 10:03:04 AM

Previous topic - Next topic

EgonOlsen

Could you please render the ground's wireframe in addition? I would like to see if it happens on the borders of polygons or not.


EgonOlsen

Ok...i see no relation to the actual polygons...i'm out of ideas. I need some test case that reflects this problem properly to investigate it.

AGP

I'll send you the first test case with this ground model, then.

EgonOlsen

The test case is missing the actual hero mesh, so i replaced it with the ninja from the Bones examples. It didn't work too well, because all i got to see was the sword and some funny looking ground object. However, i got this:


WARNING: You've exceeded the configured triangle limit for the visibility list. Consider adjusting Config.maxPolysVisible!


If you get that too, it explains a lot. Just do what the warning says and see if it helps. Or switch to compiled objects, which won't cause this problem anyway.

AGP

Yeah, sorry, my program compiles the objects. If I'd known, I would have compiled them on the test case, but alas, that's not the problem. What happened when you compiled the ninja?

EgonOlsen

Hard to tell...with this test case, i don't even see the ninja...just its sword hovering high above some strange looking thing that is supposed to be the ground. It's impossible to tell anything from this, i'm afraid. I'm not even sure what i'm looking at... ???

AGP

#37
I sent you both my character and the ground textures. Should help visualization.

EgonOlsen

Yes, that helps. Now i can see the issue and know what happens here. It's caused by the fact that you are using the center of the ground as lookAt-point, i.e. as the center of the projector's view frustum. You then place the projector a little before/behind (i changed that in the test case to see any shadow) and above the hero. Depending on the angle between the ground plane (simplified to ease thinking...) and the lookAt-vector, the frustum doesn't cover the whole hero mesh. If that's not clear, try to make a simple drawing (it helped me).
If you want to use the shadows that way, either use some point before the hero as the lookAt point instead (like projector.lookAt(position);) or try to setup the projector in a way that it really acts like the sun would do, i.e. the frustum has to cover the whole ground mesh and the position never changes.

AGP

I'm not sure whether I completely get it. Perhaps if you sent me your drawing?

On a separate question, what about Object3D.mergeAll breaks the collision tests? If I store the collision objects as multiple parts, collision works. But then, I have to have a loop for each gameloop iteration to set visibility on then off again. But if I mergeAll, collision stops working.

EgonOlsen

Well...somehow like this:



About merging: It has no effect on collision detection. Collision detection doesn't care about the source of the mesh it's working on. Make sure to enable collision detection for the resulting mesh (merging doesn't do this) and if you use octrees, calculate for the final mesh, not for the source meshes.

AGP

I see your point, thank you. I will play with it. If the problem persists, I will report back.

AGP

How do I make the shadows less blocky now? You mentioned it was supposed to be unfiltered or something, but the result of leaving the light static, while solving most of the getting-all-the character problem, is that the shadow is now a collection of fairly large squares.

EgonOlsen

You have basically three options:


  • Increase the resolution of the shadow map.
  • More the projector closer to the scene.
  • Decrease the fov of the projector (which is similar to 2 in effect)