Hi! This is an open-ended question about how one would approach an engine modification to allow for what we’re trying to do.
For context, we are developing a rendering stack that uses the composition of a pre-rendered background (which is composed of multiple “light contribution” layers which bake high-quality light and shadow interaction for a given light), and a small amount of dynamically rendered 3D geometry (like the player pawn). The 3D geometry is currently rendered with deferred rendering, but it could be forward rendered as well.
We also define invisible shadow proxy geometry for anything that is present in the pre-rendered background and that should cast shadows onto dynamic 3D geometry.
What I’m looking to resolve is the ability for :
- Environment shadow proxies to cast shadows onto 3D geometry
- For these, shadow depths should contain both 3D geometry (for self-shadows) and shadow proxies
- Dynamic 3D geometry to cast shadows onto the pre-rendered environment
- For these, shadow depths should only contain 3D geometry, since the pre-renders already contain high-quality baked shadows
We had a working prototype using the ES3.1 Mobile Renderer, CSM and whole-scene shadow maps, where I added a bMovableSubjectsOnly flag in FProjectedShadowInfo, and modified ComputeWholeSceneShadowCacheModes to ask for generation of a “duplicate” shadowmap which contains only movable subjects (3D geometry).
Then, FLightSceneInfo::SetupMobileMovableLocalLightShadowParameters was modified to feed the right shadow map to shader uniforms for deferred shading of 3D geometry, and I manually sampled the movable-subjects-only shadow map when compositing the pre-rendered background.
We are now transitioning to the non-mobile Deferred Renderer, and we’d like to support Virtual Shadow Maps. This poses a few problems :
- Is it possible a single light to have more than 1 set of VSM tiles, with different primitive gathering settings? Would that be using separate physical page pools, or a second FVirtualShadowMapArray? Is there something like that already implemented in the engine that I could use as a reference?
- Since VSM tiles are generated based on view culling results, and the pre-rendered background isn’t made of geometry (it’s injected as a fullscreen pass), how can I make sure that I have shadow depths generated for the entire screen?
- Would it be required to have a separate shadow mask generated for the background, or is it possible sample VSM “inline” in screen-space as I’m performing compositing, similarly to how I did it in the CSM+Mobile setup?
- Would this approach be compatible with VSM caching at all?
I’m not looking for exact implementation steps, but I’m curious about the general best approach to do this, and whether I’m going in a dangerous/overly complex direction to begin with. My working proof-of-concept Mobile implementation made me think this was viable, but in the VSM world it may be a different story.
Thank you!
[Attachment Removed]