Author Topic: ShadowHelper Code Never Completes  (Read 12772 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #30 on: September 22, 2012, 11:14:59 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #31 on: September 22, 2012, 11:35:47 pm »
Here you go:


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #32 on: September 23, 2012, 12:00:29 am »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #33 on: September 23, 2012, 12:03:36 am »
I'll send you the first test case with this ground model, then.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #34 on: September 23, 2012, 08:19:50 pm »
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:

Code: [Select]
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #35 on: September 23, 2012, 08:35:22 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #36 on: September 23, 2012, 08:54:52 pm »
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... ???

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #37 on: September 23, 2012, 09:07:52 pm »
I sent you both my character and the ground textures. Should help visualization.
« Last Edit: September 23, 2012, 09:15:07 pm by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #38 on: September 23, 2012, 10:14:19 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #39 on: September 23, 2012, 11:28:06 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #40 on: September 24, 2012, 02:50:28 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #41 on: September 24, 2012, 08:00:53 pm »
I see your point, thank you. I will play with it. If the problem persists, I will report back.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: ShadowHelper Code Never Completes
« Reply #42 on: November 19, 2012, 05:45:09 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ShadowHelper Code Never Completes
« Reply #43 on: November 19, 2012, 08:59:56 pm »
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)