both half-res and full-res transparency passes

Hello,

We have some objects in the transparency pass doing heavy ray marching. Naturally, we want to render them half resolution. However, other transparency effects needs to be full resolution. Currently UE doesn’t support two passes with different resolutions for different objects. Are there any plans for such feature, and is it difficult to implement?

Our case is a bit more complicated, since we need to sample the scene depth texture for this ray marching. So doing custom rendering in FWorldSceneViewExtension::PostRenderBasePassDeferred_RenderThread() will probably not work, because the depth buffer is attached as render target. Am I correct?

Thanks,

Ivo

Hi,

I started investigating this and unless I’m misunderstanding something, I think this use case could be handled by enabling Custom Depth on the meshes which require ray marching. This will write depth info for only those meshes to a separate buffer which can be sampled in a custom half-resolution post-process pass. There is also a property called “Allow Custom Depth Writes” within “Translucency”, setting it to true will compile additional shaders to enable custom depth.

To render the effect at half resolution, there are multiple ways to achieve that (for examples, see this thread):

  • user scene textures (save the scene texture to a temporary render target which supports downscaling and use it as an input for further post processing)
  • modifying the usf shader (some examples are linked here by following the Github branch links)
  • modifying engine source

Some more info on using Custom Depth (and different use cases) can be found at this link: https://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/

Would this approach work for your case?

Best,

Sam

Hi! I see you already found r.SeparateTranslucencyScreenPercentage, which is currently the only thing we provide to change the resolution of the translucency pass. But as you say it will change it for all your translucencies. We want to improve this and provide a fullres+halfres (or something like that) translucency pipeline out of the box, but it’s not planned for the short term.

If should be fairly easy to implement as you say, but there will certainly be some considerations as to compositing the half res back into the full res buffer - I’m not sure you have access to that from a plugin but you could always do the engine modification if that’s the case.

// Kevin

Sorry, didn’t have time to work on that.

I don’t like the idea to render everything in custom depth pass, it will be expensive. Also, I want to have the flexibility to add this pass between the base pass and the translucency pass, not just as post-processing. I’m thinking to try FWorldSceneViewExtension::PostRenderBasePassDeferred_RenderThread(), get the depth from there, downsample, and render the volumes with raymarching in new color render target. Then upsample and combine with the main render target. Should work in this way, right? I was mainly interested if Epic has plans to add such feature in the engine, since this is a common optimization “cheat”, but I find r.SeparateTranslucencyScreenPercentage not very useful, since you will have translucency objects that just need to be full res.

BTW, one other complication is that ideally, you want clever upscale algorithm. So this feature becomes quite complex.

Hi,

thank you for your suggestions. I’m not familiar enough with the performance implications of inserting passes and upscaling them, but I will pass your request on to Epic as a feature request, so someone with more knowledge on this matter can reply.

Best regards,

Sam