Rendering only SceneDepth in SceneCapture

Hello!

I want to render my own “shadow map”, which I will later use in materials to create a specific reaction to “light”.

I planned to use SceneCapture for this. But as it turned out, even if you set “SceneDepth in A” in “CaptureSource”, the scene will still be rendered completely.

You can check this by turning on FPS display. There is no performance difference between “SceneDepth in A” and “SceneColor (HDR)”

Yes, you can disable the checkboxes for rendering individual elements of the scene, but this does not solve the problem. The performance impact is still catastrophic. This solution cannot even come close to comparing with standard ShadowMap, which at its core also deals with depth buffer rendering.

Perhaps there are some other, more optimized ways to render a depth map? Or maybe there is a way to optimize SceneCapture so that it does not render anything other than depth?

I will be grateful for your help!

Another observation:
the CubeRenderTarget resolution for SceneCaptureCube does not affect performance. It looks like SceneCaptureCube always renders the scene at the highest resolution possible (2048), no matter what resolution the target texture is at. And then it simply compresses the result to the one specified in our texture.

Otherwise, I don’t know how to explain the complete lack of difference in performance between rendering 128/128/6 cubemaps and 2048/2048/6

Not without modification to the engine I believe. This thread seems to have a pull request where that modification was implemented.

Yes, I read this, unfortunately the Pull Request was rejected, and the FDeferredShadingSceneRenderer::Render method itself is already very different from what it was in 4.18, which is why it won’t be possible to change the code like there :frowning:

UPD. Plus this doesn’t solve the problem that performance doesn’t change depending on texture resolution, which is very strange