Reputation: 68598
I want to render a scene to the six faces of a cube texture (ie the same scene from six different perpendicular cameras) and then I want to sample from the cube texture from a fragment shader while rendering to the final framebuffer to be presented.
Is the best way to organize that to have a render pass with 7 subpasses? 1 subpass for each face of the cube texture and then the final subpass to sample the cube texture?
Or will that not work?
If it will work, roughly how do I describe the cube texture in the render pass attachments?
If it won't work, what's the best way to organize it?
Upvotes: 2
Views: 763
Reputation: 473252
You need to use two render passes. You would need to read from the cubemap as a cubemap rather than as an input attachment, so you need to break your render pass up to do that.
The cubemap rendering pass should just use a layered attachment and layered rendering functionality to send each primitive to the appropriate layer. The final pass just works as normal.
Upvotes: 2