r/vulkan•
radicalbit

Renderer design

I'm trying to figure out how the pieces should fit so that I can have the following features:

- Shadowmapping
- HDR Lighting / Tonemapping
- An additional overlay that isn't tonemapped
- Multisampling

Here's my design.

1st pass
- render shadow map to tex (srgb, single sample)

2nd pass (use HDR multisample attachment and resolve to single sample)
- 1st subpass render lit scene
- 2nd subpass perform tonemapping/postprocessing
- 3rd subpass draw UI/overlay

Q1: Does my design generally make sense?
Q2: Does my shadow map texture also need to be multisampled to look good? If so, can I render to a multisampled texture but not resolve it, and then use it as an input to my second pass?
Q3: I have been using dynamic rendering, but it seems like I can't do multisampling with that unless I have the VK_EXT_multisampled_render_to_single_sampled extension, which seems pretty thinly supported right now. So that's why I'm going to use regular renderpasses/subpasses. Does this make sense?

Thank you!

Posted Oct 3, 2022, 7:46 PM UTC

119
GeenzCat•

Curious- why use sRGB for your shadow map? If you’re working with depth- that should generally be agnostic to any sort of color space. I assume you’re looking for a specific sampling characteristic from the sRGB gamma?

3
radicalbitOP•

Ah good point. My terminology might be weird, but I was just trying to say that it wouldn't be a 16bit floating point texture like I need for color. So I was just trying to say it was a 'regular texture'. But now that I think about it, it's grayscale information, so I don't need R G and B.

1
snerp•

Q1: yeah, that's basically the same process I use for my game engine

Q2: it shouldn't need to be multisampled, idk for sure though because I don't use multi-sampling, I use super resolution instead.

Q3: someone else will have to answer this one

2
radicalbitOP•

Awesome, thanks! Is there a particular reason why you went with super resolution rather than multi sampling?

1
snerp•

It's a little more adjustable and plays nicer with other parts of the pipeline, but the main reason I went that way is that I initially did not care about multisampling, and then I got super-resolution for free when I added upscaling.

1
issleepingrobot•

How much dynamic lighting is planned. I still think the goto is...

  1. depth pass (combining the whole culling phase in here if needed - depth pyramid blah blah )
  2. deferred gbuffer pass
  3. lighting pass (iterative with a shadow filter buffer or something of the likes) maybe a GI phase
  4. translucency with or without some kind of volumetrics of lighting / shadowing
  5. Post FX - FXAA
  6. UI etc on top

This is just the deferred pass standard. The forward+ is a thing but I'm still not fond of it, its still yet to make its way into a AAA engine to my knowledge.

I saw you mention subpass too. I'm not sure the vulkan's community view on this, but I'd ignore subpasses entirely until you know what you are dealing with.

1
Khalv•

Uhm, Forward+ has been used in major game engines for the last half a decade at least. Clustered Forward Rendering is a further development of Forward+ which is ubiquitous by now. Doom (2016), Just Cause 3 and Detroit: Become Human all use it, not to mention Unity's Universal Render Pipeline, and i believe also Unreal's forward renderer.

Here's a great blog post on Doom's renderer: https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/

1
issleepingrobot•

Interesting, I suppose they each must have had their reasons. For just cause 3 it certainly makes sense to reduce a heavy g buffer pass with all that potential foliage, the rest are more curious choices.

I'm not saying forward+ has no place. I just personally find it picking the wrong direction for how I like things. More flexible lights versus more flexible material response to lights (which logically is fairly limited in itself).

1
Khalv•

There are several benefits of Forward+; you can use MSAA, it requires less VRAM, and it can support an infinite amount of shading models whereas in Deferred you need lots of branching for that. It's also better with transparency.

Deferred is better with decals, lots of lights, screen-space effects (you can only do physically correct SSAO with deferred), and it also reduces the cost of overdraw (so technically it should be better for foliage). I personally prefer deferred, but Forward+ certainly has its uses.

2