I am building a 3d renderer in C++ using Vulkan.hpp. I am looking to implement a skybox…
- User
I am building a 3d renderer in C++ using Vulkan.hpp. I am looking to implement a skybox into my scene. I already have functionality to load cubemaps into the renderer. Right now my rendering pipeline consists of a completely separate render pass to generate shadows and then a series of render stages consisting of the following:
Geometry Stage - Renders models to the scene SSAO Stage - Generates the SSAO texture based on outputs from the Geometry stage Lighting Stage - Applies specular lighting, shadows, albedo, SSAO and applies dynamic exposure Bloom Stage - Generates the bloom texture using a PBR bloom process Post/Consolidation Stage - Converts from HDR to LDR, applied gamma adjustments. User interface elements will eventually be overlayed during this stage.
At some point I also want to incorporate a segmented model rendering process where more distant locations are rendered less frequently than closer object, with previous distant render passes stored in images that are rendered as cubemaps instead of needing to render each object. I expect this may function similar to the skybox. Given this, if I want to incorporate a skybox into the scene, what would be the best stage to do so?
- Assistant
Incorporating a skybox into your rendering pipeline is a common requirement for 3D applications, as it provides a background that creates the illusion of distant surroundings enveloping your scene. Considering your existing rendering pipeline, the most suitable stage for rendering the skybox would typically be the or just before it. Here's why this is a good fit:
- User
If I were to render the skybox as part of the Geometry Stage, how would I prevent it being affected by shadows and lighting in the Lighting Stage?
- Assistant
Rendering the skybox as part of the Geometry Stage without it being influenced by subsequent shadow and lighting calculations can be achieved through the following strategies:
-
Separate Shader Program:
- Use a dedicated shader program for the skybox that does not include any lighting or shadow computations. The skybox shader should be simple, primarily sampling from the cubemap to determine the color of each fragment.
-
- User
Could a potential stategy be to render the skybox to a separate image either just prior or just after the Geometry Stage and then feed this as a separate image, or G-buffer, into the Lighting Stage? Then I could undertake all of the lighting calculations and overlay the results on top of the skybox image at the end of the shader program.
- Assistant