Shadow rendering on dynamic objects

Yes, I think your optimization a good one. The stencil test should touch all the pixels which were previously written, so just resetting the stencil during the test seems like a good idea.

Just out of interest, you mention that this was a huge bottleneck, can you give some more detail (e.g. how many milliseconds roughly)? How many of these per-object shadowmaps are you rendering per frame - presumably quite a few?

In any case, we’ll probably look to bring this into a future release. Thanks for the heads-up.