Author Topic: Is this scale normal for a town this size?  (Read 5246 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Is this scale normal for a town this size?
« on: August 17, 2015, 06:22:09 pm »
Because I'm having trouble with very blocky shadows. And the shadow map size is already 8192x8192.
As printed by World.getBounds():
-264.87097, 276.26025
-11.555313, 104.79436
-304.63678, 247.57347


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #1 on: August 17, 2015, 09:24:07 pm »
I would expect it to by somewhat larger in scale, like *10. But that's just related to floating point accuracy to improve collision detection and such. For shadows, the scale doesn't matter. If the shadows are too blocky, the only you can do is to reduce the size of the area that the shadows are covering either by moving the light source that causes them closer to the scene or by adjusting it's fov.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #2 on: August 17, 2015, 09:32:18 pm »
That's not an option, so what about adding shadow-emitting lights? That's probably not going to look right, huh?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #3 on: August 17, 2015, 11:28:06 pm »
...So what about adding shadow-emitting lights? That's probably not going to look right, huh?
I'm not sure what you mean...Multiple "shadow sources"?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #4 on: August 18, 2015, 11:39:11 pm »
Yes, is that not possible? I just think that it wouldn't look right, but I haven't tried it yet.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #5 on: August 19, 2015, 07:25:10 am »
No, it's not possible and i also don't think that it would look right. Apart from that, I'm don't see why a 8192*8192 shadow map should look blocky in that scene unless the projector is so far away or the fov so large that the actual scene is very small in the depth map.
Can you render the scene from the projectors point of view and see how much of the actual screen space it really covers?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #6 on: August 19, 2015, 08:29:47 pm »
That's a useful trick. You should suggest it in the docs (maybe on ShadowHelper). It's still blocky, but at least it sees the whole scene, now:


How could I make it less blocky if I want it to see the whole scene?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #7 on: August 20, 2015, 08:46:39 am »
There's not much you can do. You are already at 8192*8192, so increasing the shadow map's resolution isn't really an option. You can try to enable filtering on the shadows (http://www.jpct.net/doc/com/threed/jpct/util/ShadowHelper.html#setFiltering(boolean)), but if that's a good idea or not depends on the hardware and the scene in general.
Do you have a screen shot that shows the actual blockiness of the shadows?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #8 on: August 20, 2015, 09:11:34 am »
Filtering didn't help, in this case. There must be something that you could do to improve this somewhere (even if it comes down to some post-processing on the shadow map...). This is an old video. A lot of it looks better now, but the shadows still look the same:

https://youtu.be/51tx_5Zg4qI?t=169

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #9 on: August 20, 2015, 09:41:12 am »
...but in that video, you don't see the whole scene. So maybe it's an option to let the projector point towards the player and decrease the fov of it?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #10 on: August 20, 2015, 10:22:29 am »
To constantly adjust the projector? Wouldn't that look bizarre as the player ran across the scene?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #11 on: August 20, 2015, 11:30:56 am »
I'm not sure. It might be worth a try.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is this scale normal for a town this size?
« Reply #12 on: August 21, 2015, 09:07:10 am »
With the current camera, I think that your idea works fine, thanks. I narrowed the FOV and yFOV to .5f so that it still covers a fairly big area. I assume that lookAt is probably cheaper than the wider FOV settings, so that's not an issue. The only potential problem I see is if I write a more sophisticated camera which could potentially expose the moving-in-the-distance shadows.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is this scale normal for a town this size?
« Reply #13 on: August 21, 2015, 12:52:26 pm »
lookAt is cheap. Rendering the whole scene into the depth map is more expensive for sure.