I am doing custom shadow mapping using depth map generated by scene capture. Using render doc I noticed that scene capture is rendering everything and when I set its output to depth in R. It is absolutely unnecessary to render everything when I need only depth buffer. With simple “if(ViewFamily.SceneCaptureSource == SCS_SceneDepth) { … return; }” after prepass in core Render() function I could save dozens of ms and make scene capture depth rendering actually usable (tested in custom engine build). Other scene capture modes could be probably optimized too.
And even if they don’t merge it, it makes it very easy for anyone to just quickly cherry pick that improvement, when needed.
I do need to use scene capture rendering with depth only, and I was not aware of this yet, so thanks very much for mentioning that here! Will definitely help my performance
I am not really sure, what you are referring to as
The controls, what to render, are on scene capture itself.
When capture is set to SCS_SceneDepth, the rendering will be done with simplified depth shader.
But yeah, if you feel like it could be an improvement, definitely submit a PR.
Yes, many features can be toggled with flags however there is no full control. There is great performance improvement with forced full depth prepass only for scene capture in SCS_SceneDepth mode. Base pass is the bottleneck.
I just did quick test:
Very simple scene, All rendering flags disabled (except static meshes), SCS_SceneDepth, 4096x4096 (launcher 4.18)
vs
Very simple scene, All rendering flags disabled (except static meshes), SCS_SceneDepth, 4096x4096, Depth prepass only (custom build, 4.18)
I’m just wondering, will this still work if the game doesn’t actually do a depth prepass for the regular camera? It’s expensive, so I made sure that I don’t use any features that require that. So can the depth prepass be disabled for all normal cameras and be enabled for one scene capture individually?
If scene capture is in SCS_SceneDepth mode, then I am forcing it for scene captures only in code and I am also forcing full prepass, so no objects are ignored. However, I am not sure how good is this for different platforms, that’s why I was a bit sceptic when It comes to PR. I will do some improvements, tweaking and then do the PR.
Even if it isn’t beautiful enough to get integrated into the engine, the PR can be used by others in their own projects if they happen to have the same need as you did.