This was more of prototype and never saw the light of day in our end applications. But the idea was fairly straight forward and bred from the issue we were having with mobile hardware running so many directional light shadow calculations on our enclosed spaces.
My thought here was simply to make one large assumption: The room is intrinsically in shadow, so why bother with the shadow map sampling when for the most part we don't need it, and we're just wasting those precious milliseconds. So I came up with the idea to use code to generate a mesh that encased any portal to the outside and travel down to the floor along the direction of our sun, creating a tight fitting bounds where directional lighting mattered.
What we can then do is utilize our stencil buffer, and have the mesh use a special shader to do nothing but write a specific value to the stencil buffer. Our main forward rendering shaders would then reference the stencil buffer for that value, and only perform directional lighting calculations on those pixels. You can see from the video above where the mesh was created and how in the different rendering views wherever turns green is where in practice we're not doing any directional lighting computation.
This gives us some big wins on performance for interior spaces when hardware limitations are abundant, and maintains all of the quality that was previously there.
The only real downside is in the fact that the stencil buffer is screen space. This means that any pixel passing the value check will perform directional lighting, and that includes geometry that's directly behind or in front of the generated stencil buffer mesh. A more robust implementation may have been able to figure something out with depth or possible bounds intersection.