Render a multi-layered effect

"Hello everyone, I’d like to render a multi-layered effect. My plan is to use multiple subpasses.

  • Subpass 1: Render the base color.
  • Subpass 2: Take the color attachment from Subpass 1 as input, and add additional special colors.
  • Subpass 3: Take the color attachment from Subpass 2 as input and continue adding colors.

Can subpasses be used in this way?

That’s just blending; you don’t even need subpasses for that. Just render to the same image.

If the blending functions are too simple for your needs, or you have some reason to specifically need to write to new images, you can use input attachments to do what you’re trying to do.

I’m sure you can achieve the effect you want without it, but yes, you can use subpasses to do it. Keep in mind that if you need to sample from other pixels (not just the same one) you’ll need multiple renderpasses, not just subpasses.