Skip to content

Commit 6ea2db0

Browse files
committed
-Dev: procedural sky pass almost done. Vignette moved to pass.h
1 parent 3cb7c49 commit 6ea2db0

25 files changed

+359
-158
lines changed

include/engine/common.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,29 @@ typedef enum TextWidgetType
654654
BULLET,
655655
} TextWidgetType;
656656

657+
enum EnviromentType
658+
{
659+
IMAGE_BASED_ENV = 0,
660+
PROCEDURAL_ENV = 1,
661+
};
662+
typedef enum class SkyAerosolType
663+
{
664+
BACKGROUND = 0,
665+
DESERT_DUST = 1,
666+
MARITIME_CLEAN = 2,
667+
MARITIME_MINERAL = 3,
668+
POLAR_ANTARCTIC = 4,
669+
POLAR_ARCTIC = 5,
670+
REMOTE_CONTINENTAL = 6,
671+
RURAL = 7,
672+
URBAN = 8
673+
} AerosolType;
674+
enum class UpdateType
675+
{
676+
PER_FRAME = 0,
677+
ON_DEMAND = 1
678+
};
679+
657680
VULKAN_ENGINE_NAMESPACE_END
658681

659682
#endif

include/engine/core/passes/bloom_pass.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class BloomPass : public BasePass
3333
{
3434
protected:
3535
ColorFormatType m_colorFormat = SRGBA_32F;
36-
Mesh* m_vignette;
3736

3837
Graphics::DescriptorSet m_imageDescriptorSet;
3938

@@ -50,9 +49,8 @@ class BloomPass : public BasePass
5049
std::vector<Graphics::Framebuffer> m_bloomFramebuffers;
5150

5251
public:
53-
BloomPass(Graphics::Device* ctx, Extent2D extent, Mesh* vignette, bool isDefault = false)
54-
: BasePass(ctx, extent, 1, 1, isDefault, "BLOOM")
55-
, m_vignette(vignette) {
52+
BloomPass(Graphics::Device* ctx, Extent2D extent, bool isDefault = false)
53+
: BasePass(ctx, extent, 1, 1, isDefault, "BLOOM") {
5654
}
5755

5856
inline float get_bloom_strength() const {

include/engine/core/passes/composition_pass.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class CompositionPass : public GraphicPass
5151
{
5252
/*Setup*/
5353
ColorFormatType m_colorFormat;
54-
Mesh* m_vignette;
5554

5655
/*Descriptors*/
5756
struct FrameDescriptors {
@@ -74,14 +73,9 @@ class CompositionPass : public GraphicPass
7473
void create_prev_frame_image();
7574

7675
public:
77-
CompositionPass(Graphics::Device* ctx,
78-
VkExtent2D extent,
79-
ColorFormatType colorFormat,
80-
Mesh* vignette,
81-
bool isDefault = true)
76+
CompositionPass(Graphics::Device* ctx, VkExtent2D extent, ColorFormatType colorFormat, bool isDefault = true)
8277
: BasePass(ctx, extent, 1, 1, isDefault, "COMPOSITION")
83-
, m_colorFormat(colorFormat)
84-
, m_vignette(vignette) {
78+
, m_colorFormat(colorFormat) {
8579
}
8680

8781
inline void set_SSR_settings(SSR settings) {

include/engine/core/passes/enviroment_pass.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ This pass does three things:
2424
class EnviromentPass : public GraphicPass
2525
{
2626
ColorFormatType m_format;
27-
Mesh* m_vignette;
2827
Graphics::DescriptorSet m_envDescriptorSet;
2928
Graphics::Buffer m_captureBuffer;
3029
Extent2D m_irradianceResolution;
3130

3231
public:
33-
EnviromentPass(Graphics::Device* ctx, Mesh* vignette)
32+
EnviromentPass(Graphics::Device* ctx)
3433
: BasePass(ctx, {1, 1}, 2, CUBEMAP_FACES, false)
35-
, m_vignette(vignette)
3634
, m_format(SRGBA_32F)
3735
, m_irradianceResolution({1, 1}) {
3836
}
@@ -59,6 +57,8 @@ class EnviromentPass : public GraphicPass
5957

6058
void render(Graphics::Frame& currentFrame, Scene* const scene, uint32_t presentImageIndex = 0);
6159

60+
void link_previous_images(std::vector<Graphics::Image> images);
61+
6262
void cleanup();
6363
};
6464

include/engine/core/passes/pass.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ class BasePass
187187
*/
188188
virtual void cleanup();
189189
#pragma endregion
190+
191+
/*
192+
Public static member.
193+
Vignette for rendering textures onto screen.*/
194+
static Core::Geometry* vignette;
190195
};
191196

192197
#pragma region IMAGE DEP

include/engine/core/passes/postprocess_pass.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@ class PostProcessPass : public GraphicPass
2121
{
2222
protected:
2323
ColorFormatType m_colorFormat;
24-
Mesh* m_vignette;
2524
Graphics::DescriptorSet m_imageDescriptorSet;
2625
std::string m_shaderPath;
2726

2827
public:
2928
PostProcessPass(Graphics::Device* ctx,
3029
Extent2D extent,
3130
ColorFormatType colorFormat,
32-
Mesh* vignette,
3331
std::string shaderPath,
3432
std::string name = "POST-PROCESS",
3533
bool isDefault = true)
3634
: BasePass(ctx, extent, 1, 1, isDefault, name)
3735
, m_colorFormat(colorFormat)
38-
, m_vignette(vignette)
3936
, m_shaderPath(shaderPath) {
4037
}
4138

include/engine/core/passes/precomposition_pass.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ future lighting passes.
3838
*/
3939
class PreCompositionPass : public GraphicPass
4040
{
41-
Mesh* m_vignette;
4241
/*Descriptors*/
4342
struct FrameDescriptors {
4443
Graphics::DescriptorSet globalDescritor;
@@ -55,9 +54,8 @@ class PreCompositionPass : public GraphicPass
5554
void create_samples_kernel();
5655

5756
public:
58-
PreCompositionPass(Graphics::Device* ctx, VkExtent2D extent, Mesh* vignette)
59-
: BasePass(ctx, extent, 2, 1, false, "PRE-COMPOSITION")
60-
, m_vignette(vignette) {
57+
PreCompositionPass(Graphics::Device* ctx, VkExtent2D extent)
58+
: BasePass(ctx, extent, 2, 1, false, "PRE-COMPOSITION") {
6159
}
6260

6361
inline void set_SSAO_settings(AO settings) {

include/engine/core/passes/sky_pass.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@ VULKAN_ENGINE_NAMESPACE_BEGIN
1414

1515
namespace Core {
1616
/*
17-
Procedural Physically Based Sky generation pass.
17+
Procedural Physically Based Sky generation pass. Based on "A Scalable and Production Ready Sky and Atmosphere Rendering Technique"
18+
by Sébastien Hillaire (2020).
19+
20+
Transmittance LUT is based on "Precomputed Atmospheric Scattering" by Eric Bruneton and Fabrice Neyret (2008).
21+
22+
Implementation by Fernando García Liñán 2023
1823
*/
1924
class SkyPass : public GraphicPass
2025
{
2126
protected:
22-
Mesh* m_vignette;
23-
Graphics::DescriptorSet m_LUTdescriptor;
27+
Graphics::DescriptorSet m_imageDescriptor;
2428

2529
public:
26-
SkyPass(Graphics::Device* ctx, Extent2D extent, Mesh* vignette)
27-
: BasePass(ctx, extent, 2, 1, false, "SKY GENERATION")
28-
, m_vignette(vignette) {
30+
SkyPass(Graphics::Device* ctx, Extent2D extent)
31+
: BasePass(ctx, extent, 3, 1, false, "SKY GENERATION") {
2932
}
3033

34+
void create_framebuffer();
35+
3136
virtual void setup_attachments(std::vector<Graphics::AttachmentInfo>& attachments,
3237
std::vector<Graphics::SubPassDependency>& dependencies);
3338

include/engine/core/passes/tonemapping_pass.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ class TonemappingPass : public PostProcessPass
3535
TonemappingPass(Graphics::Device* ctx,
3636
Extent2D extent,
3737
ColorFormatType colorFormat,
38-
Mesh* vignette,
3938
bool isDefault = true)
4039
: PostProcessPass(ctx,
4140
extent,
4241
colorFormat,
43-
vignette,
4442
ENGINE_RESOURCES_PATH "shaders/misc/tonemapping.glsl",
4543
"TONEMAPPING",
4644
isDefault) {

include/engine/core/resource_manager.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <engine/core/textures/textureLDR.h>
1717
#include <engine/core/windows/window.h>
1818
#include <engine/core/windows/windowGLFW.h>
19+
#include <engine/core/passes/pass.h>
1920

2021
#include <engine/graphics/device.h>
2122

@@ -39,11 +40,7 @@ class ResourceManager
3940
static std::vector<Core::ITexture*> textureResources;
4041
static Core::Texture* FALLBACK_TEXTURE;
4142
static Core::Texture* FALLBACK_CUBEMAP;
42-
/*
43-
Vignette for RTT
44-
*/
45-
static Core::Mesh* VIGNETTE;
46-
43+
4744
/*
4845
Creates and initiates basic rendering resources such as fallback textures and a vignette
4946
*/

0 commit comments

Comments
 (0)