Alex Fu
Alex Fu

Reputation: 183

How to render into multiple textures in Vulkan?

I want to have an offscreen render pass to render multiple shadow maps for different light sources.

The only ways I can think of are either to have a large number of color attachments or recreate the render pass before render the next shadow map.

I believe there is a more efficient way, like dynamic uniform buffers, that allows me to render into multiple targets with one render pass?

Upvotes: 0

Views: 782

Answers (1)

yangzs
yangzs

Reputation: 26

  1. you can create a multilayer framebuffer, then use geometry shader to generate vertices in different view spaces. use gl_Layer to specify which layer to render.
  2. or you can use mulitview feature(need VK_KHR_multiview extension), specify render layer by gl_ViewIndex in vertex shader. This method is said to be faster than previous one.

Upvotes: 1

Related Questions