Is this scale normal for a town this size?

Started by AGP, August 17, 2015, 06:22:09 PM

Previous topic - Next topic

AGP

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


EgonOlsen

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.

AGP

That's not an option, so what about adding shadow-emitting lights? That's probably not going to look right, huh?

EgonOlsen

Quote from: AGP on August 17, 2015, 09:32:18 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"?

AGP

Yes, is that not possible? I just think that it wouldn't look right, but I haven't tried it yet.

EgonOlsen

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?

AGP

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?

EgonOlsen

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?

AGP

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

EgonOlsen

...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?

AGP

To constantly adjust the projector? Wouldn't that look bizarre as the player ran across the scene?

EgonOlsen


AGP

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.

EgonOlsen

lookAt is cheap. Rendering the whole scene into the depth map is more expensive for sure.