Shadowmaps and Unit Motion

Shadowmaps and Unit Motion

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Shadowmaps and Unit Motion

Post by Argh »

Shadowmaps aren't being updated for Units in motion properly. I was trying to figure out why certain things weren't working perfectly, and have now observed and tested that the shadowmaps aren't using the same projection from rendered frame to rendered frame, causing a "flashing" effect.

It's a lot more noticable with my GLSL shadowmap implementation, which I now have working about as well as it's going to.

But it's clearly effecting stuff using the ARB shadows as well. You can watch shadows on a tank that's in motion change when it stops, if you observe closely. Something weird is going on there- it's almost like it reverses the shadowmap very briefly every sim frame.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shadowmaps and Unit Motion

Post by Argh »

In case people aren't following the Normalmap thread... here's a screen, showing a normal, ARB-generated shadowmap projection going wrong on Unit that's moving:

Image

You have to look carefully (click to zoom in) but it's obvious that the shadow on the Unit geometry doesn't match the shadow on the ground.

So... it really is borked engine-side, it wasn't just my imagination.

There are other things wrong with the shadowmaps currently, which I think (ok, "vaguely theorize" might be more appropriate) are due to incorrect creation of the projection taking the POV into account. I think there's something wrong with the depth component, basically. If you need to see screenshots of shadows warping or "floating" before this is credible, let me know- I usually avoid taking screens of these issues, for obvious reasons :P

See this source code, for an example of doing shadowmaps prior to rendering (in this case, with GLSL, but it's not necessary) using FBOs:

http://fabiensanglard.net/shadowmapping/index.php
Post Reply

Return to “Engine”