Skip to content

Commit d434abd

Browse files
committed
feat : LDR Bloom 구현중
1 parent 0b007c0 commit d434abd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+288
-97
lines changed

EngineCopy.bat

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
xcopy /s /y /exclude:exclude_list.txt ".\Project\Engine\*.h" ".\External\Include\Engine"
2-
xcopy /s /y /exclude:exclude_list.txt ".\Project\Engine\*.inl" ".\External\Include\Engine"
3-
xcopy /s /y /exclude:exclude_list.txt ".\Project\Engine\*.fx" ".\OutputFile\content\shader"
4-
xcopy /s /y /exclude:exclude_list.txt ".\Project\Engine\*.hlsl" ".\OutputFile\content\shader"
5-
xcopy /s /y /exclude:exclude_list.txt ".\Project\Engine\*.hlsli" ".\OutputFile\content\shader"
1+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\Project\Engine\*.h" ".\External\Include\Engine"
2+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\Project\Engine\*.inl" ".\External\Include\Engine"
3+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\Project\Engine\*.fx" ".\OutputFile\content\shader"
4+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\Project\Engine\*.hlsl" ".\OutputFile\content\shader"
5+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\Project\Engine\*.hlsli" ".\OutputFile\content\shader"
File renamed without changes.

External/Include/Engine/CRenderMgr.h

+14-6
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,17 @@ class CRenderMgr : public CSingleton<CRenderMgr>
4646
CGameObject* m_PostEffectObj;
4747

4848
// Post Process
49-
int bloomLevels;
50-
vector<Ptr<CTexture>> m_BloomTextures;
51-
vector<CGameObject*> m_BloomDownFilters;
52-
vector<CGameObject*> m_BloomUpFilters;
49+
int m_bloomLevels;
50+
51+
vector<Ptr<CTexture>> m_BloomTextures_LDRI;
52+
CGameObject* m_SamplingObj;
53+
CGameObject* m_BlurXObj;
54+
CGameObject* m_BlurYObj;
55+
CGameObject* m_CombineObj;
56+
57+
vector<Ptr<CTexture>> m_BloomTextures_HDRI;
58+
vector<CGameObject*> m_BloomDownFilters_HDRI; // 객체하나로 수정 필요
59+
vector<CGameObject*> m_BloomUpFilters_HDRI; // 객체하나로 수정 필요
5360
CGameObject* m_ToneMappingObj;
5461

5562
// Render function pointer
@@ -87,8 +94,8 @@ class CRenderMgr : public CSingleton<CRenderMgr>
8794
void Clear_Buffers(const Vec4& Color);
8895

8996
void CopyRTTexToRTCopyTex();
90-
void CopyToPostProcessTex_HDRI();
9197
void CopyToPostProcessTex_LDRI();
98+
void CopyToPostProcessTex_HDRI();
9299
void Resize(Vec2 Resolution);
93100

94101
Ptr<CTexture> GetRTCopyTex() const { return m_RTCopyTex; }
@@ -106,7 +113,8 @@ class CRenderMgr : public CSingleton<CRenderMgr>
106113
void CreateBloomTextures(Vec2 Resolution);
107114

108115
public:
109-
void render_postprocess();
116+
void render_postprocess_LDRI();
117+
void render_postprocess_HDRI();
110118

111119
private:
112120
void render_play();
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

External/Library/Engine/BloomUpPS.cso

0 Bytes
Binary file not shown.

External/Library/Engine/BlurXPS.cso

-684 Bytes
Binary file not shown.

External/Library/Engine/BlurYPS.cso

-684 Bytes
Binary file not shown.

External/Library/Engine/Combine.cso

0 Bytes
Binary file not shown.

External/Library/Engine/CombinePS.cso

28.6 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

External/Library/Engine/Engine_d.idb

0 Bytes
Binary file not shown.

External/Library/Engine/Engine_d.lib

64 KB
Binary file not shown.
0 Bytes
Binary file not shown.

External/Library/Engine/IDMapPS.cso

0 Bytes
Binary file not shown.

External/Library/Engine/IDMapVS.cso

0 Bytes
Binary file not shown.

External/Library/Engine/MirrorPS.cso

0 Bytes
Binary file not shown.

External/Library/Engine/MirrorVS.cso

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
30.7 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

External/Library/Engine/SkyBoxVS.cso

0 Bytes
Binary file not shown.

External/Library/Engine/SkyboxPS.cso

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

LibraryCopy.bat

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
xcopy /s /y /exclude:exclude_list.txt ".\External\Library\assimp\*.dll" ".\OutputFile\bin"
2-
xcopy /s /y /exclude:exclude_list.txt ".\External\Library\FMOD\*.dll" ".\OutputFile\bin"
3-
xcopy /s /y /exclude:exclude_list.txt ".\External\Library\FontEngine\*.dll" ".\OutputFile\bin"
1+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\External\Library\assimp\*.dll" ".\OutputFile\bin"
2+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\External\Library\FMOD\*.dll" ".\OutputFile\bin"
3+
xcopy /s /y /exclude:Engine_exclude_list.txt ".\External\Library\FontEngine\*.dll" ".\OutputFile\bin"
Binary file not shown.
Binary file not shown.
Binary file not shown.

Project/Client/x64/Debug/vc143.idb

0 Bytes
Binary file not shown.

Project/Engine/BlurXPS.hlsl

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ static const float weights[5] = { 0.0545, 0.2442, 0.4026, 0.2442, 0.0545 };
77
float4 main(PS_IN input) : SV_TARGET
88
{
99
float3 color = float3(0.f, 0.f, 0.f);
10-
float dx = 1.0 / g_RenderResolution.x;
11-
float dy = 1.0 / g_RenderResolution.y;
10+
float width;
11+
float height;
12+
g_tex_0.GetDimensions(width, height);
13+
float dx = 1.0 / width;
14+
float dy = 1.0 / height;
15+
16+
//float dx = 1.0 / g_RenderResolution.x;
17+
//float dy = 1.0 / g_RenderResolution.y;
1218

1319
for (int i = 0; i < 5; i++)
1420
{
15-
color += weights[i] * g_postprocess_Tex.Sample(g_PointSampler, input.vUV + (float2(dx, 0.0) * float(i - 2))).rgb;
21+
color += weights[i] * g_tex_0.Sample(g_LinearClampSampler, input.vUV + (float2(dx, 0.0) * float(i - 2))).rgb;
1622
}
1723

1824
return float4(color, 1.f);

Project/Engine/BlurYPS.hlsl

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ static const float weights[5] = { 0.0545, 0.2442, 0.4026, 0.2442, 0.0545 };
77
float4 main(PS_IN input) : SV_TARGET
88
{
99
float3 color = float3(0.f, 0.f, 0.f);
10-
float dx = 1.0 / g_RenderResolution.x;
11-
float dy = 1.0 / g_RenderResolution.y;
10+
float width;
11+
float height;
12+
g_tex_0.GetDimensions(width, height);
13+
float dx = 1.0 / width;
14+
float dy = 1.0 / height;
15+
16+
//float dx = 1.0 / g_RenderResolution.x;
17+
//float dy = 1.0 / g_RenderResolution.y;
1218

1319
for (int i = 0; i < 5; i++)
1420
{
15-
color += weights[i] * g_postprocess_Tex.Sample(g_PointSampler, input.vUV + (float2(0.0, dy) * float(i - 2))).rgb;
21+
color += weights[i] * g_tex_0.Sample(g_LinearClampSampler, input.vUV + (float2(0.0, dy) * float(i - 2))).rgb;
1622
}
1723

1824
return float4(color, 1.f);

Project/Engine/CAssetMgr_init.cpp

+32-4
Original file line numberDiff line numberDiff line change
@@ -489,21 +489,41 @@ void CAssetMgr::CreateDefaultGraphicsShader()
489489
AddAsset(L"IDMapShader", pShader);
490490
}
491491

492+
// =================================
493+
// Sampling Shader
494+
// =================================
495+
{
496+
Ptr<CGraphicsShader> pShader = new CGraphicsShader;
497+
pShader->CreateVertexShader(L"shader\\postprocessVS.hlsl", "main");
498+
pShader->CreatePixelShader(L"shader\\SamplingPS.hlsl", "main");
499+
500+
pShader->SetRSType(RS_TYPE::CULL_BACK);
501+
pShader->SetDSType(DS_TYPE::NO_TEST_NO_WRITE);
502+
503+
pShader->SetDomain(SHADER_DOMAIN::DOMAIN_POSTPROCESS);
504+
505+
pShader->AddScalarParam(FLOAT_0, "Threshold");
506+
507+
pShader->AddTexParam(TEX_0, "Sampling Texture");
508+
509+
pShader->SetName(L"SamplingShader");
510+
AddAsset(L"SamplingShader", pShader);
511+
}
512+
492513
// =================================
493514
// Combine Shader
494515
// =================================
495516
{
496517
Ptr<CGraphicsShader> pShader = new CGraphicsShader;
497518
pShader->CreateVertexShader(L"shader\\postprocessVS.hlsl", "main");
498-
pShader->CreatePixelShader(L"shader\\Combine.hlsl", "main");
519+
pShader->CreatePixelShader(L"shader\\CombinePS.hlsl", "main");
499520

500521
pShader->SetRSType(RS_TYPE::CULL_BACK);
501522
pShader->SetDSType(DS_TYPE::NO_TEST_NO_WRITE);
502523

503524
pShader->SetDomain(SHADER_DOMAIN::DOMAIN_POSTPROCESS);
504525

505526
pShader->AddScalarParam(FLOAT_0, "Strength");
506-
pShader->AddScalarParam(FLOAT_1, "Threshold");
507527

508528
pShader->AddTexParam(TEX_0, "Render Texture");
509529
pShader->AddTexParam(TEX_1, "Bloom Texture");
@@ -843,12 +863,20 @@ void CAssetMgr::CreateDefaultMaterial()
843863
AddAsset<CMaterial>(L"SpotLightMtrl", pMtrl);
844864
}
845865

866+
// Sampling
867+
{
868+
Ptr<CMaterial> pMtrl = new CMaterial(true);
869+
pMtrl->SetShader(FindAsset<CGraphicsShader>(L"SamplingShader"));
870+
pMtrl->SetScalarParam(FLOAT_1, 0.5f); // Threshold
871+
pMtrl->SetName(L"SamplingMtrl");
872+
AddAsset<CMaterial>(L"SamplingMtrl", pMtrl);
873+
}
874+
846875
// Combine
847876
{
848877
Ptr<CMaterial> pMtrl = new CMaterial(true);
849878
pMtrl->SetShader(FindAsset<CGraphicsShader>(L"CombineShader"));
850-
pMtrl->SetScalarParam(FLOAT_0, 1.f); // Strength
851-
pMtrl->SetScalarParam(FLOAT_1, 0.5f); // Threshold
879+
pMtrl->SetScalarParam(FLOAT_0, 0.f); // Strength
852880
pMtrl->SetName(L"CombineMtrl");
853881
AddAsset<CMaterial>(L"CombineMtrl", pMtrl);
854882
}

Project/Engine/CCamera.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,13 @@ void CCamera::render()
197197
// 후처리
198198
CDevice::GetInst()->SetFloatRenderTarget();
199199
render_postprocess_HDRI();
200-
CRenderMgr::GetInst()->render_postprocess();
200+
CRenderMgr::GetInst()->render_postprocess_HDRI();
201201
}
202202
else
203203
{
204204
CDevice::GetInst()->SetRenderTarget();
205205
render_postprocess_LDRI();
206+
CRenderMgr::GetInst()->render_postprocess_LDRI();
206207
}
207208

208209
// Clear

0 commit comments

Comments
 (0)