From 5e4a65e1c8113a45188d756221a9efa796d235ac Mon Sep 17 00:00:00 2001 From: Chanbin Kim <127280695+JinhoBa@users.noreply.github.com> Date: Sun, 14 Dec 2025 14:56:42 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[add]=20=EC=88=A8=EA=B2=A8=EC=A7=84=20?= =?UTF-8?q?=EC=83=81=EC=9E=90=20=EC=B6=94=EA=B0=80=20[add]=20=EC=83=81?= =?UTF-8?q?=EC=9E=90=20=EC=9D=B4=ED=8E=99=ED=8A=B8=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?[fix]=20Fog=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Default/Client.vcxproj | 4 + .../Client/Default/Client.vcxproj.filters | 18 + .../Client/Private/Effect_Container.cpp | 1 - .../Client/Private/InfoInstance.cpp | 4 + .../Client/Private/Level_GamePlay.cpp | 4 +- Jusin154_Team3D/Client/Private/Light_Main.cpp | 4 +- Jusin154_Team3D/Client/Private/Loader.cpp | 21 +- .../Client/Private/MapElement_Chest.cpp | 340 ++++++++++++++++++ .../Client/Private/MapElement_Chest_Lid.cpp | 207 +++++++++++ Jusin154_Team3D/Client/Private/MapInfo.cpp | 92 +++++ Jusin154_Team3D/Client/Public/Client_Macro.h | 1 + Jusin154_Team3D/Client/Public/InfoInstance.h | 1 + .../Client/Public/MapElement_Chest.h | 79 ++++ .../Client/Public/MapElement_Chest_Lid.h | 60 ++++ Jusin154_Team3D/Client/Public/MapInfo.h | 1 + .../Data/Map/Hiden/Element_Chest_Info.xml | 60 ++++ .../SM_Chest_RewardContainer_C.bin | 3 + .../SM_Chest_RewardContainer_C_Lid.bin | 3 + .../SM_Chest_RewardContainer_C_Lid_Lod1.bin | 3 + .../SM_Chest_RewardContainer_C_Lid_Lod2.bin | 3 + .../SM_Chest_RewardContainer_C_Lod1.bin | 3 + .../SM_Chest_RewardContainer_C_Lod2.bin | 3 + .../SM_Chest_RewardContainer_C_Lod3.bin | 3 + .../ShaderFiles/Shader_Deferred.hlsl | 10 +- .../Resources/ShaderFiles/Shader_VtxMesh.hlsl | 15 +- .../Editor/Private/Level_MapViewer.cpp | 2 +- Jusin154_Team3D/Editor/Private/MainLight.cpp | 4 +- .../Editor/Private/MapElement_Chest.cpp | 100 +++++- .../Editor/Private/MapElement_Chest_Lid.cpp | 23 +- .../Editor/Public/MapElement_Chest.h | 6 + .../Editor/Public/MapElement_Chest_Lid.h | 1 + .../ShaderFiles/Shader_Deferred.hlsl | 10 +- Jusin154_Team3D/Engine/Private/Fog.cpp | 4 +- 33 files changed, 1053 insertions(+), 40 deletions(-) create mode 100644 Jusin154_Team3D/Client/Private/MapElement_Chest.cpp create mode 100644 Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp create mode 100644 Jusin154_Team3D/Client/Public/MapElement_Chest.h create mode 100644 Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 9b89c04a8..e25130553 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -196,6 +196,8 @@ call Update_Resources.bat + + @@ -375,6 +377,8 @@ call Update_Resources.bat + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 65a1fb3e5..272017214 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -554,6 +554,12 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Environment\03.MapElement\Chest + + + 02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid + 02.GameObjects\Item\Potion @@ -1176,6 +1182,12 @@ {b09f9ada-6cf4-41a4-ad28-f00855509825} + + {160d0631-ff04-40ee-b27b-b2ea167b8da5} + + + {70c01ca8-ae1b-43aa-b4f4-efa40994e3e9} + {ace6c64f-901a-424e-99da-53f281413d77} @@ -1680,6 +1692,12 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Environment\03.MapElement\Chest + + + 02.GameObjects\Environment\03.MapElement\Chest\Chest_Lid + 02.GameObjects\Item\Potion diff --git a/Jusin154_Team3D/Client/Private/Effect_Container.cpp b/Jusin154_Team3D/Client/Private/Effect_Container.cpp index fb9f1c131..e19971e54 100644 --- a/Jusin154_Team3D/Client/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Client/Private/Effect_Container.cpp @@ -38,7 +38,6 @@ HRESULT CEffect_Container::Initialize(void* pArg) if (FAILED(Ready_Child())) return E_FAIL; - m_bVisible = false; return S_OK; diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index ff405a87d..ba6775b4e 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -127,6 +127,10 @@ HRESULT CInfoInstance::Load_DoorElemet(const _char* pFileName) { return m_pMapInfo->Load_DoorElemet(pFileName); } +HRESULT CInfoInstance::Load_ChestElemet(const _char* pFileName) +{ + return m_pMapInfo->Load_ChestElemet(pFileName); +} #pragma endregion #pragma region SPELL_INFO diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index e620c010d..3a0483b0a 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -280,7 +280,9 @@ HRESULT CLevel_GamePlay::Ready_Background() /* Doors */ CInfoInstance::GetInstance()->Load_DoorElemet("Element_Door_Info"); - + /* Chests */ + CInfoInstance::GetInstance()->Load_ChestElemet("Element_Chest_Info"); + if (FAILED(Ready_IntstanceProp())) return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 92375b4cf..2d456f634 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -79,9 +79,9 @@ HRESULT CLight_Main::Ready_Components() } m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); - - _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + _float4 vColor = _float4(0.7f, 0.7f, 0.7f, 0.3f); m_pGameInstance->Set_FogColor(vColor); + m_pGameInstance->Set_FogDensity(5.f); return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 369f5e58d..9848585ba 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -166,6 +166,8 @@ #include "MapElement_Door.h" #include "Land.h" #include "Unified.h" +#include "MapElement_Chest.h" +#include "MapElement_Chest_Lid.h" #pragma endregion @@ -613,6 +615,11 @@ HRESULT CLoader::Loading_For_GamePlay() "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/Chairs", ".bin", false )); + /* Object Interactables (Chest)*/ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables", + ".bin", false + )); } } } @@ -1166,6 +1173,10 @@ HRESULT CLoader::Loading_For_GamePlay() } #pragma endregion + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Levioso_Noise"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Effect/Noises/VFX_T_NoiseCaustics02_Color_D.png"), 0)))) { + return E_FAIL; + } #pragma region EFFECT @@ -1422,7 +1433,7 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } - //Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; + Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; } @@ -2157,6 +2168,14 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_MapElement_Chest */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + /* For.Prototype_GameObject_MapElement_Chest_Lid */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Chest_Lid::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Unified */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp new file mode 100644 index 000000000..4d7d802b7 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Chest.cpp @@ -0,0 +1,340 @@ +#include "pch.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" +#include "Terrain.h" +#include "Layer.h" +#include "MapElement_Chest_Lid.h" +#include "Player.h" + +CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest::CMapElement_Chest(const CMapElement_Chest& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest::Initialize(void* pArg) +{ + ELEMENT_CHEST_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]); + //m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_eCurState = m_ePreState = CHEST_STATE::IDLE; + m_fRimLightPower = pDesc->fRimLightPow; + m_fRimLightStrength = pDesc->fRimLightStrength; + m_vRimLightColor = pDesc->vRimLightColor; + + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f)); + m_pTransformCom->Set_Scale(pDesc->vScale); + m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z)); + + /* 뚜껑 */ + if (FAILED(Ready_Lid(pDesc))) + return E_FAIL; + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + + static_cast(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize); + static_cast(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition); + + return S_OK; +} + +void CMapElement_Chest::Priority_Update(_float fTimeDelta) +{ + m_pLid->Priority_Update(fTimeDelta); +} + +void CMapElement_Chest::Update(_float fTimeDelta) +{ +#ifdef _DEBUG + /*if(CHEST_STATE::OPENED != m_eCurState) + { + _vector vPlayerPos = m_pGameInstance->Get_Layer(g_iStaticLevel, LAYER_PLAYER)->Get_Object()->Get_WorldPostion(); + + _float fDistance = XMVectorGetX(XMVector3Length(vPlayerPos - m_pTransformCom->Get_State(STATE::POSITION))); + + if (CHEST_STATE::IDLE == m_eCurState && fDistance < 10.f) + m_eCurState = CHEST_STATE::FOUND; + else if (fDistance < 1.5f) + m_eCurState = CHEST_STATE::OPENED; + }*/ +#endif // _DEBUG + + switch (m_eCurState) + { + case CMapElement_Chest::CHEST_STATE::IDLE: + break; + + case CMapElement_Chest::CHEST_STATE::FOUND: + m_fTimeAcc += fTimeDelta * 0.03f; + + if (0.f <= m_fTimeAcc && 0.06f > m_fTimeAcc) + { + m_fCurRimLightStrength = m_fRimLightStrength * m_fTimeAcc / 0.06f; + } + else if (0.3f <= m_fTimeAcc) + { + m_fTimeAcc = 0.f; + m_fCurRimLightStrength = 0.f; + m_eCurState = CHEST_STATE::IDLE; + } + else + { + m_fCurRimLightStrength = m_fRimLightStrength; + } + break; + + case CMapElement_Chest::CHEST_STATE::OPENED: + break; + + default: + break; + } + + Chage_State(); + + m_pLid->Update(fTimeDelta); +} + +void CMapElement_Chest::Late_Update(_float fTimeDelta) +{ + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { + + if (CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState) + { + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this); + } + else + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + + m_pLid->Late_Update(fTimeDelta); + } +} + +HRESULT CMapElement_Chest::Render() +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(m_iShaderPass_Index))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + +#ifdef _DEBUG + if (FAILED(m_pRigidBody->Render())) { + return E_FAIL; + } +#endif // _DEBUG + + if (FAILED(m_pLid->Render(m_iShaderPass_Index))) + return E_FAIL; + + return S_OK; +} + +HRESULT CMapElement_Chest::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + CModel* pModel = { nullptr }; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i], + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_pModelComs.push_back(pModel); + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + /* Com_Texture */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Levioso_Noise"), + reinterpret_cast(&m_pNoiseTextureCom)))) + return E_FAIL; + + ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast(pArg); + + // RIGID_BODY + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + + + return S_OK; +} + +HRESULT CMapElement_Chest::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTimeAcc, sizeof(_float)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fCurRimLightStrength, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float4)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CMapElement_Chest::Ready_Lid(ELEMENT_CHEST_DESC* pArg) +{ + m_pLid = m_pGameInstance->Clone_Prototype(g_iStaticLevel, pArg, this); + + if (nullptr == m_pLid) + return E_FAIL; + + return S_OK; +} + +void CMapElement_Chest::Chage_State() +{ + if (m_ePreState != m_eCurState) + { + switch (m_eCurState) + { + case CMapElement_Chest::CHEST_STATE::IDLE: + m_fCurRimLightStrength = 0.f; + m_fTimeAcc = 0.f; + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case CMapElement_Chest::CHEST_STATE::FOUND: + m_iShaderPass_Index = 21; //ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + break; + + case CMapElement_Chest::CHEST_STATE::OPENED: + m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + m_pLid->Open(); + break; + + default: + break; + } + m_ePreState = m_eCurState; + } +} + +CMapElement_Chest* CMapElement_Chest::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest* pInstance = new CMapElement_Chest(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest::Free() +{ + if (nullptr != m_pRigidBody) { + m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor()); + } + __super::Free(); + + if (m_bCloned) + SAFE_RELEASE(m_pLid); + + SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pNoiseTextureCom); + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Chest::Describe_Entity() +{ +} +#endif // _DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp b/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp new file mode 100644 index 000000000..fe65f2a7e --- /dev/null +++ b/Jusin154_Team3D/Client/Private/MapElement_Chest_Lid.cpp @@ -0,0 +1,207 @@ +#include "pch.h" +#include "MapElement_Chest_Lid.h" +#include "MapElement_Chest.h" + +#include "GameInstance.h" + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CMapElement{ pDevice, pContext } +{ +} + +CMapElement_Chest_Lid::CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs) + : CMapElement(rhs) +{ +} + +HRESULT CMapElement_Chest_Lid::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Initialize(void* pArg) +{ + CMapElement_Chest::ELEMENT_CHEST_DESC* pDesc = static_cast(pArg); + + m_iMaxLodLevel = pDesc->iMaxLodLevel_Lid; + + for (_uint i = 0; i < m_iMaxLodLevel + 1; i++) + { + m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags_Lid[i]); + } + + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + m_fOpenDuration = 0.1f; + m_fRotationAngle = pDesc->fRotaitionAngle; + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vLid_Offset), 1.f)); + + m_pParentWorldMatrix = m_pOwner->Get_Component()->Get_WorldMatrixPtr(); + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return S_OK; +} + +void CMapElement_Chest_Lid::Priority_Update(_float fTimeDelta) +{ +} + +void CMapElement_Chest_Lid::Update(_float fTimeDelta) +{ + switch (m_eState) + { + case CMapElement_Chest_Lid::LID_STATE::IDLE: + break; + + case CMapElement_Chest_Lid::LID_STATE::OPENING: + if (Opening(fTimeDelta)) + m_eState = LID_STATE::OPENED; + break; + + case CMapElement_Chest_Lid::LID_STATE::OPENED: + break; + + default: + break; + } +} + +void CMapElement_Chest_Lid::Late_Update(_float fTimeDelta) +{ + /* 부모에서 Render 호출 */ +} + +HRESULT CMapElement_Chest_Lid::Render(_uint iShaderPass) +{ + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + _uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(iShaderPass))) { + return E_FAIL; + } + + if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) + { + CModel* pModel = { nullptr }; + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i], + reinterpret_cast(&pModel)))) + return E_FAIL; + + m_pModelComs.push_back(pModel); + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + + return S_OK; +} + +HRESULT CMapElement_Chest_Lid::Bind_ShaderResources() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + + return S_OK; +} + +_bool CMapElement_Chest_Lid::Opening(_float fTimeDelta) +{ + m_fTimeAcc += fTimeDelta; + + if (m_fTimeAcc >= m_fOpenDuration) + { + m_fTimeAcc = m_fOpenDuration; + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle), 0.f, 0.f); + return true; + } + + m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle * m_fTimeAcc / m_fOpenDuration), 0.f, 0.f); + + XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix)); + + return false; +} + +CMapElement_Chest_Lid* CMapElement_Chest_Lid::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMapElement_Chest_Lid::Clone(void* pArg, CGameObject* pOwner) +{ + CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CMapElement_Chest_Lid"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMapElement_Chest_Lid::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pShaderCom); + + for (auto& pModel : m_pModelComs) + SAFE_RELEASE(pModel); +} + +#ifdef _DEBUG +void CMapElement_Chest_Lid::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 4bd73d904..b33e6a3b9 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -11,6 +11,7 @@ #include "MapElement_Interactable.h" #include "MapElement_Lake.h" #include "MapElement_Door.h" +#include "MapElement_Chest.h" #include "Layer.h" CMapInfo::CMapInfo() @@ -639,6 +640,97 @@ HRESULT CMapInfo::Load_DoorElemet(const _char* pFileName) return S_OK; } +HRESULT CMapInfo::Load_ChestElemet(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/Hiden/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Chests"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Chest::ELEMENT_CHEST_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); + string strTag = {}; + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + /* Transform */ + auto* Position = Object->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + auto* Scale = Object->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + auto* Rotation = Object->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); + HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); + HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); + HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); + + auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); + LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); + LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); + LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); + + auto* RimLight = Object->FirstChildElement("RimLight"); + RimLight->QueryFloatAttribute("pow", &Desc.fRimLightPow); + RimLight->QueryFloatAttribute("strength", &Desc.fRimLightStrength); + RimLight->QueryFloatAttribute("colorR", &Desc.vRimLightColor.x); + RimLight->QueryFloatAttribute("colorG", &Desc.vRimLightColor.y); + RimLight->QueryFloatAttribute("colorB", &Desc.vRimLightColor.z); + RimLight->QueryFloatAttribute("colorA", &Desc.vRimLightColor.w); + + + auto* Lid = Object->FirstChildElement("Lid"); + Lid->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel_Lid); + for (auto* PrototypeTag = Lid->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags_Lid.push_back(CMyTools::ToWstring(strTag)); + } + + auto* LidPosition = Lid->FirstChildElement("Position"); + LidPosition->QueryFloatAttribute("x", &Desc.vLid_Offset.x); + LidPosition->QueryFloatAttribute("y", &Desc.vLid_Offset.y); + LidPosition->QueryFloatAttribute("z", &Desc.vLid_Offset.z); + + auto* RotationAngle = Lid->FirstChildElement("RotationAngle"); + RotationAngle->QueryFloatAttribute("RotationAngle", &Desc.fRotaitionAngle); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HIDDEN, &Desc))) + return E_FAIL; + } + + return S_OK; +} + HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { m_pGameInstance = CGameInstance::GetInstance(); diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index 06643d5d0..b0bfa9821 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -62,6 +62,7 @@ namespace Client { #define LAYER_INTERACTABLE TEXT("Layer_Interactable") #define LAYER_UNIFIED TEXT("Layer_Unified") #define LAYER_DOOR TEXT("Layer_Door") +#define LAYER_HIDDEN TEXT("Layer_HIDDEN") #define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager") diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index 57ac8e23a..80542594f 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -50,6 +50,7 @@ DECLARE_SINGLETON(CInfoInstance) HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); HRESULT Load_DoorElemet(const _char* pFileName); + HRESULT Load_ChestElemet(const _char* pFileName); #pragma endregion #pragma region Spell_INFO HRESULT Load_SpellInfo(const _char* pFilePath); diff --git a/Jusin154_Team3D/Client/Public/MapElement_Chest.h b/Jusin154_Team3D/Client/Public/MapElement_Chest.h new file mode 100644 index 000000000..19a1b18ed --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Chest.h @@ -0,0 +1,79 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Chest final : public CMapElement +{ +public: + enum class CHEST_STATE { IDLE, FOUND, OPENED, END }; + +public: + typedef struct tagElement_Chest_Desc : MAPELEMENT_DESC + { + _uint iInteractableID = {}; + _uint iSubKind = {}; + _float3 vBoxLocalPosition; + _float3 vBoxSize; + + _uint iMaxLodLevel_Lid{}; + vector<_wstring> ModelPrototypeTags_Lid; + _float3 vLid_Offset = {}; + _float fRotaitionAngle = {}; + + _float fRimLightPow; + _float fRimLightStrength; + _float4 vRimLightColor; + }ELEMENT_CHEST_DESC; + +private: + CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest(const CMapElement_Chest& rhs); + virtual ~CMapElement_Chest() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +private: + ELEMENT_INTERACTABLE_ID m_eInteractableID = { ELEMENT_INTERACTABLE_ID::END }; + CHEST_STATE m_ePreState = {}; + CHEST_STATE m_eCurState = {}; + + _uint m_iShaderPass_Index = {}; + + _float m_fTimeAcc = {}; + _float m_fRimLightPower = { 0.7f }; + _float m_fRimLightStrength = { 3.7f }; + _float m_fCurRimLightStrength = { 0.f }; + _float4 m_vRimLightColor = { 0.71f, 0.39f, 0.02f, 1.f }; + + CTexture* m_pNoiseTextureCom = { nullptr }; + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + + class CMapElement_Chest_Lid* m_pLid = { nullptr }; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + HRESULT Ready_Lid(ELEMENT_CHEST_DESC* pArg); + + void Chage_State(); + +public: + static CMapElement_Chest* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h b/Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h new file mode 100644 index 000000000..51ad32ba1 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/MapElement_Chest_Lid.h @@ -0,0 +1,60 @@ +#pragma once + +#include "Client_Define.h" +#include "MapElement.h" + +NS_BEGIN(Client) + +class CMapElement_Chest_Lid final : public CMapElement +{ +public: + enum class LID_STATE { IDLE, OPENING, OPENED, END }; + +private: + CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs); + virtual ~CMapElement_Chest_Lid() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render(_uint iShaderPass); + + void Open() { m_eState = LID_STATE::OPENING; } + +private: + LID_STATE m_eState = { LID_STATE::END }; + + _bool m_isRotationAnim = {}; + _float m_fOpenDuration = {}; + _float m_fTimeAcc = {}; + _float m_fRotationAngle = {}; + + _float3 m_vTargetPosition = {}; + _float3 m_vTargetRotation = {}; + + _float4x4 m_CombinedWorldMatrix = {}; + + _bool m_isOpen = {}; + const _float4x4* m_pParentWorldMatrix = { nullptr }; + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + + _bool Opening(_float fTimeDelta); + +public: + static CMapElement_Chest_Lid* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/MapInfo.h b/Jusin154_Team3D/Client/Public/MapInfo.h index 30c76227e..beeaa6b94 100644 --- a/Jusin154_Team3D/Client/Public/MapInfo.h +++ b/Jusin154_Team3D/Client/Public/MapInfo.h @@ -26,6 +26,7 @@ class CMapInfo final : public CBase HRESULT Load_InteractableElements(const _char* pFileName); HRESULT Load_WaterElemet(const _char* pFileName); HRESULT Load_DoorElemet(const _char* pFileName); + HRESULT Load_ChestElemet(const _char* pFileName); private: CGameInstance* m_pGameInstance = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml new file mode 100644 index 000000000..2c8094a41 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml @@ -0,0 +1,60 @@ + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3 + + + + + + + + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1 + Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2 + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin new file mode 100644 index 000000000..339dd05bf --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d63f7c5b3ad543514aace353ee709c251c06e2c76e4280d2b2ad29ca56d1b8e6 +size 505472 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin new file mode 100644 index 000000000..7a660734b --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c59d5191ed66ed8d9cab7c9d0a2feed02df56d6991ded53d9da45ef55e3f8e9d +size 297088 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin new file mode 100644 index 000000000..cc0a4138a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b25aa3d241fcb9b345f313c080865dfe6912b0acb997a674648953c4efd7fb5b +size 103736 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin new file mode 100644 index 000000000..1b3d90172 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lid_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:612e3945956c54dc0a014ca76c0533c51f5cbedc4a50984a8bea79e13913a4aa +size 17052 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin new file mode 100644 index 000000000..75dcf9e83 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:951c28e20cfa13c1a41ce5fb4aad9fd0f8cf6b160327b78e3f73c0e15c38cb54 +size 177072 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin new file mode 100644 index 000000000..7276a3141 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df925e597f41bfa9a9f7268d67f4a280af93ee5a93d05824387ec8ff9f9c5daa +size 57444 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin new file mode 100644 index 000000000..7571b3b58 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Objects/Interactables/SM_Chest_RewardContainer_C_Lod3.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6b84123ecd65829eda3a768ff95315a12156198fd0584d8958aeb31098ff2a9 +size 14056 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..becdedb5d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -895,13 +895,15 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) float fViewZ = vDepthDesc.y * g_fFar; float fRatio; + + + fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - fRatio = clamp(pow(exp(-(g_fFogDensity * fViewZ)), g_fFogPow), 0.f, 1.f); - - vFinalColor = lerp(g_vFogColor, vColor, max(fRatio, 0.2f)); + vFinalColor = lerp(vColor, g_vFogColor, fRatio); vFinalColor.a = 1.f; - if (1.f == vDepthDesc.y) { + if (1.f == vDepthDesc.y) + { vFinalColor = float4(g_vFogColor); } Out.vSingleTarget = vFinalColor; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index c43261149..13d866b16 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -92,6 +92,11 @@ float g_fRefractionPow; float4 g_vDiffuseColor; float4 g_vSurfaceColor; +float g_fRimPower; +float g_fRimStrength; +float4 g_vRimColor; + + struct VS_IN { float3 vPosition : POSITION; @@ -726,7 +731,7 @@ PS_OUT PS_LEVIOSO(PS_IN In) float4 vMtrlDiffuse = g_DiffuseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); float4 vSurface = g_SurfaceParamsTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord); - float4 vNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord).r; + float fNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, float2(In.vTexcoord.x + sin(g_fTime), In.vTexcoord.y)).r; if (g_iBinded_Texture[AI_TEXTURE_TYPE_TRANSMISSION] != 0) { @@ -749,7 +754,13 @@ PS_OUT PS_LEVIOSO(PS_IN In) float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); - Out.vAlbedo = vMtrlDiffuse * float4(1.f, 1.f, 0.3f, 1.f) * vNoise; + + float4 vRimLight = 1.f - saturate(dot(normalize(g_vCamPosition - In.vWorldPos), float4(In.vNormal, 0.f))); + + vRimLight = pow(vRimLight, g_fRimPower); + vRimLight = vRimLight * g_vRimColor * g_fRimStrength * fNoise; + + Out.vAlbedo = vMtrlDiffuse + vRimLight; Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); float fSurfaceParam = g_fUsingSurfaceParams; if (true == AlmostEqual7(g_fUsingSurfaceParams, 0.f)) diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp index bf20bb5b1..8e97331ad 100644 --- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp @@ -478,7 +478,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Chest(const _wstring& strLayerTag) Chest_Desc.iMaxLodLevel_Lid = 2; Chest_Desc.ModelPrototypeTags_Lid= ModelPrototypeTagsLid; - Chest_Desc.vLid_Offset = _float3(0.f, 0.3f, 0.f); + Chest_Desc.vLid_Offset = _float3(0.f, 0.5f, 0.f); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Chest_Desc))) return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/MainLight.cpp b/Jusin154_Team3D/Editor/Private/MainLight.cpp index d38833c15..1fc4dab78 100644 --- a/Jusin154_Team3D/Editor/Private/MainLight.cpp +++ b/Jusin154_Team3D/Editor/Private/MainLight.cpp @@ -150,9 +150,9 @@ HRESULT CMainLight::Ready_Components() m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); - _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + _float4 vColor = _float4(0.7f, 0.7f, 0.7f, 0.3f); m_pGameInstance->Set_FogColor(vColor); - + m_pGameInstance->Set_FogDensity(5.f); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp index 216cfb67a..2c98183c5 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest.cpp @@ -5,6 +5,7 @@ #include "Terrain.h" #include "Layer.h" #include "MapElement_Chest_Lid.h" +#include "Player.h" CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CMapElement{ pDevice, pContext } @@ -75,12 +76,42 @@ void CMapElement_Chest::Priority_Update(_float fTimeDelta) void CMapElement_Chest::Update(_float fTimeDelta) { +#ifdef _DEBUG + /*if(CHEST_STATE::OPENED != m_eCurState) + { + _vector vPlayerPos = m_pGameInstance->Get_Layer(g_iStaticLevel, LAYER_PLAYER)->Get_Object()->Get_WorldPostion(); + + _float fDistance = XMVectorGetX(XMVector3Length(vPlayerPos - m_pTransformCom->Get_State(STATE::POSITION))); + + if (CHEST_STATE::IDLE == m_eCurState && fDistance < 10.f) + m_eCurState = CHEST_STATE::FOUND; + else if (fDistance < 1.5f) + m_eCurState = CHEST_STATE::OPENED; + }*/ +#endif // _DEBUG + switch (m_eCurState) { case Editor::CMapElement_Chest::CHEST_STATE::IDLE: break; case Editor::CMapElement_Chest::CHEST_STATE::FOUND: + m_fTimeAcc += fTimeDelta * 0.03f; + + if (0.f <= m_fTimeAcc && 0.06f > m_fTimeAcc) + { + m_fCurRimLightStrength = m_fRimLightStrength * m_fTimeAcc / 0.06f; + } + else if (0.3f <= m_fTimeAcc) + { + m_fTimeAcc = 0.f; + m_fCurRimLightStrength = 0.f; + m_eCurState = CHEST_STATE::IDLE; + } + else + { + m_fCurRimLightStrength = m_fRimLightStrength; + } break; case Editor::CMapElement_Chest::CHEST_STATE::OPENED: @@ -105,7 +136,10 @@ void CMapElement_Chest::Late_Update(_float fTimeDelta) if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { if(CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState) + { m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); + m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this); + } else m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); @@ -175,7 +209,6 @@ HRESULT CMapElement_Chest::Ready_Components(void* pArg) reinterpret_cast(&m_pNoiseTextureCom)))) return E_FAIL; - ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast(pArg); // RIGID_BODY @@ -205,6 +238,23 @@ HRESULT CMapElement_Chest::Bind_ShaderResources() return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTimeAcc, sizeof(_float)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fCurRimLightStrength, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float4)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) { return E_FAIL; } @@ -229,6 +279,8 @@ void CMapElement_Chest::Chage_State() switch (m_eCurState) { case Editor::CMapElement_Chest::CHEST_STATE::IDLE: + m_fCurRimLightStrength = 0.f; + m_fTimeAcc = 0.f; m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); break; @@ -238,6 +290,7 @@ void CMapElement_Chest::Chage_State() case Editor::CMapElement_Chest::CHEST_STATE::OPENED: m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT); + m_pLid->Open(); break; default: @@ -299,7 +352,7 @@ void CMapElement_Chest::Describe_Entity() return; PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f); - + GUI::Begin("Chest"); if (GUI::CollapsingHeader("Rigid Body")) { GUI::InputFloat("Power", &m_fPower); @@ -334,11 +387,38 @@ void CMapElement_Chest::Describe_Entity() } + if (GUI::Button("Save_ChestData")) + { + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/Hiden/Element_Chest_Info.xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + tinyxml2::XMLElement* root = {}; + + if (loadResult == tinyxml2::XML_SUCCESS) + { + root = doc.FirstChildElement("Chests"); + + Save_XML(doc, root); + + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save DoorInfo File"); + } + } + else + MSG_BOX("Failed to Save Data"); + } + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); m_iLodIndex = max(0, m_iLodIndex); m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + GUI::InputFloat("m_fRimLightPower", &m_fRimLightPower, 0.1f, 1.f); + GUI::InputFloat("m_fRimLightStrength", &m_fRimLightStrength, 0.1f, 1.f); + GUI::ColorEdit4("m_vRimLightColor", (_float*) & m_vRimLightColor); + GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor); GUI::Text("----- Transfrom ----"); @@ -395,6 +475,8 @@ void CMapElement_Chest::Describe_Entity() if (GUI::Button("Delete")) m_bDead = true; + GUI::End(); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); m_pTransformCom->Set_Scale(m_vScale); m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); @@ -405,11 +487,11 @@ HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLEle tinyxml2::XMLElement* object = doc.NewElement("Object"); object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_INTERACT)); object->SetAttribute("ID", ENUM_CLASS(m_eInteractableID)); - object->SetAttribute("Lod_Level", m_iLodIndex); + object->SetAttribute("Lod_Level", m_iMaxLodLevel); root->InsertEndChild(object); #pragma region PROTOTYPETAG - for (_uint i = 0; i < m_iLodIndex + 1; ++i) + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) { tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); @@ -461,8 +543,18 @@ HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLEle LocalTranslation->SetAttribute("z", vLocalTranslation.z); object->InsertEndChild(LocalTranslation); + tinyxml2::XMLElement* RimLight = doc.NewElement("RimLight"); + RimLight->SetAttribute("pow", m_fRimLightPower); + RimLight->SetAttribute("strength", m_fRimLightStrength); + RimLight->SetAttribute("colorR", m_vRimLightColor.x); + RimLight->SetAttribute("colorG", m_vRimLightColor.y); + RimLight->SetAttribute("colorB", m_vRimLightColor.z); + RimLight->SetAttribute("colorA", m_vRimLightColor.w); + object->InsertEndChild(RimLight); #pragma endregion + m_pLid->Save_XML(doc, object); + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp index d50ca3d60..a407648ea 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Chest_Lid.cpp @@ -37,8 +37,8 @@ HRESULT CMapElement_Chest_Lid::Initialize(void* pArg) return E_FAIL; - m_fOpenDuration = 1.f; - m_fRotationAngle = 30.f; + m_fOpenDuration = 0.1f; + m_fRotationAngle = 10.f; m_vPosition = pDesc->vLid_Offset; m_vRotation = _float3(0.f, 0.f, 0.f); m_vScale = _float3(1.f, 1.f, 1.f); @@ -263,12 +263,12 @@ void CMapElement_Chest_Lid::Describe_Entity() HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) { - tinyxml2::XMLElement* object = doc.NewElement("Object"); + tinyxml2::XMLElement* object = doc.NewElement("Lid"); object->SetAttribute("Lod_Level", m_iMaxLodLevel); root->InsertEndChild(object); #pragma region PROTOTYPETAG - for (_uint i = 0; i < m_iLodIndex + 1; ++i) + for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i) { tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); @@ -294,19 +294,10 @@ HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XM Position->SetAttribute("z", vPosition.z); object->InsertEndChild(Position); - tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); - Scale->SetAttribute("x", vScale.x); - Scale->SetAttribute("y", vScale.y); - Scale->SetAttribute("z", vScale.z); - object->InsertEndChild(Scale); - - tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); - Rotation->SetAttribute("x", vRotation.x); - Rotation->SetAttribute("y", vRotation.y); - Rotation->SetAttribute("z", vRotation.z); - object->InsertEndChild(Rotation); - + tinyxml2::XMLElement* RotationAngle = doc.NewElement("RotationAngle"); + RotationAngle->SetAttribute("RotationAngle", m_fRotationAngle); + object->InsertEndChild(RotationAngle); #pragma endregion diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h index cd71f5122..0f886b789 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Chest.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest.h @@ -42,6 +42,12 @@ class CMapElement_Chest final : public CMapElement _uint m_iShaderPass_Index = {}; + _float m_fTimeAcc = {}; + _float m_fRimLightPower = { 0.7f }; + _float m_fRimLightStrength = { 3.7f }; + _float m_fCurRimLightStrength = { 0.f }; + _float4 m_vRimLightColor = {0.71f, 0.39f, 0.02f, 1.f}; + class CMapElement_Chest_Lid* m_pLid = { nullptr }; CRigidBody* m_pRigidBody = { nullptr }; PSX::PxRigidDynamic* m_pActor = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h index 9977a1911..155e7088a 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Chest_Lid.h @@ -21,6 +21,7 @@ class CMapElement_Chest_Lid final : public CMapElement virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render(_uint iShaderPass); + void Open() { m_eState = LID_STATE::OPENING; } private: LID_STATE m_eState = { LID_STATE::END }; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..becdedb5d 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -895,13 +895,15 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) float fViewZ = vDepthDesc.y * g_fFar; float fRatio; + + + fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - fRatio = clamp(pow(exp(-(g_fFogDensity * fViewZ)), g_fFogPow), 0.f, 1.f); - - vFinalColor = lerp(g_vFogColor, vColor, max(fRatio, 0.2f)); + vFinalColor = lerp(vColor, g_vFogColor, fRatio); vFinalColor.a = 1.f; - if (1.f == vDepthDesc.y) { + if (1.f == vDepthDesc.y) + { vFinalColor = float4(g_vFogColor); } Out.vSingleTarget = vFinalColor; diff --git a/Jusin154_Team3D/Engine/Private/Fog.cpp b/Jusin154_Team3D/Engine/Private/Fog.cpp index 9899ec743..569343e6a 100644 --- a/Jusin154_Team3D/Engine/Private/Fog.cpp +++ b/Jusin154_Team3D/Engine/Private/Fog.cpp @@ -3,7 +3,7 @@ #include "Shader.h" CFog::CFog() - : m_bVisible{ true } + : m_bVisible{ true }, m_fFogPow{30.f} { } @@ -30,7 +30,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader) _float fValue = 0.f; _float4 vColor = { 0.f, 0.f,0.f,0.f }; pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float)); - pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float)); + pShader->Bind_RawValue("g_fFogPow", &fValue, sizeof(_float)); pShader->Bind_RawValue("g_vFogColor", &vColor, sizeof(_float4)); } #else From 0f2f0ed719821ef72fecb9dc1be9ccd2f434bc83 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 14 Dec 2025 15:54:41 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[fix]=20GUI=20=ED=8C=9D=EC=97=85=20?= =?UTF-8?q?=ED=8F=AC=EC=BB=A4=EC=8A=A4=20=EC=95=88=EB=BA=8F=EA=B8=B0?= =?UTF-8?q?=EA=B2=8C=20=EB=B3=80=EA=B2=BD=20[add]=20BLOOM=20=EB=8D=9C=20?= =?UTF-8?q?=EB=B0=98=EC=A7=9D=EA=B1=B0=EB=A6=AC=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Private/Broom.cpp | 2 +- .../Client/Private/CamPosition_Shoulder.cpp | 2 +- .../Client/Private/Camera_Gaze.cpp | 2 +- Jusin154_Team3D/Client/Private/Decendo.cpp | 2 +- Jusin154_Team3D/Client/Private/Goblin.cpp | 2 +- .../Client/Private/Goblin_Mage.cpp | 2 +- .../Client/Private/Goblin_Protego.cpp | 2 +- .../Client/Private/Goblin_Spector.cpp | 2 +- Jusin154_Team3D/Client/Private/Levioso.cpp | 2 +- Jusin154_Team3D/Client/Private/Light_Main.cpp | 2 +- Jusin154_Team3D/Client/Private/MainApp.cpp | 3 +- .../Private/MapElement_Interactable.cpp | 14 +- Jusin154_Team3D/Client/Private/MapInfo.cpp | 2 +- .../Client/Private/NPC_Ollivander.cpp | 2 +- Jusin154_Team3D/Client/Private/NomalJap.cpp | 2 +- Jusin154_Team3D/Client/Private/Player.cpp | 4 +- Jusin154_Team3D/Client/Private/Protego.cpp | 2 +- Jusin154_Team3D/Client/Private/Terrain.cpp | 2 +- Jusin154_Team3D/Client/Private/Troll.cpp | 2 +- Jusin154_Team3D/Client/Private/Troll_Rock.cpp | 2 +- .../Client/Private/Troll_Weapon.cpp | 2 +- Jusin154_Team3D/Client/Private/Unified.cpp | 2 +- Jusin154_Team3D/Client/Private/Wand.cpp | 2 +- .../ShaderFiles/Engine_Shader_Functions.hlsli | 53 ++++++ .../ShaderFiles/Engine_Shader_Samplers.hlsli | 8 + .../ShaderFiles/Shader_Deferred.hlsl | 170 ++++++++++++------ .../ShaderFiles/Engine_Shader_Functions.hlsli | 53 ++++++ .../ShaderFiles/Engine_Shader_Samplers.hlsli | 8 + .../ShaderFiles/Shader_Deferred.hlsl | 170 ++++++++++++------ Jusin154_Team3D/Engine/Private/Camera.cpp | 2 +- Jusin154_Team3D/Engine/Private/Fog.cpp | 2 +- .../Engine/Private/GameInstance.cpp | 2 +- .../Engine/Private/GameObject_Manager.cpp | 2 +- .../Engine/Private/Mouse_Manager.cpp | 2 +- .../Engine/Private/RenderTarget_Manager.cpp | 12 +- Jusin154_Team3D/Engine/Private/Renderer.cpp | 25 ++- .../Engine/Private/Renderer_Declare.cpp | 14 +- .../Engine/Private/Resource_Manager.cpp | 2 +- Jusin154_Team3D/Engine/Private/Trail.cpp | 2 +- Jusin154_Team3D/Engine/Public/Engine_Enum.h | 2 +- Jusin154_Team3D/Engine/Public/Engine_Macro.h | 6 + .../Engine/Public/RenderTarget_Manager.h | 2 + 42 files changed, 436 insertions(+), 162 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Broom.cpp b/Jusin154_Team3D/Client/Private/Broom.cpp index 43fe3ba59..3a0698f0a 100644 --- a/Jusin154_Team3D/Client/Private/Broom.cpp +++ b/Jusin154_Team3D/Client/Private/Broom.cpp @@ -204,7 +204,7 @@ void CBroom::Free() void CBroom::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Broom")) { GUI::DragFloat("MaxSpeed", &m_fFlyMaxSpeed, 0.01f); GUI::DragFloat("Speed", &m_fSpeed, 0.01f); diff --git a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp index abb5e1af6..9c709dc05 100644 --- a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp +++ b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp @@ -392,7 +392,7 @@ void CCamPosition_Shoulder::Free() void CCamPosition_Shoulder::Describe_Entity() { - GUI::Begin("CAMERA"); + GUI::Begin("CAMERA", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Cam_Shoulder")) { m_pTransformCom->Describe_Entity(); diff --git a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp index f13f6cd71..57bbfb0aa 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp @@ -182,7 +182,7 @@ void CCamera_Gaze::Free() void CCamera_Gaze::Describe_Entity() { - GUI::Begin("CAMERA"); + GUI::Begin("CAMERA", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Camera_Gaze_Describe")) { m_pTransformCom->Describe_Entity(); GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z); diff --git a/Jusin154_Team3D/Client/Private/Decendo.cpp b/Jusin154_Team3D/Client/Private/Decendo.cpp index cb65b9416..3855a2141 100644 --- a/Jusin154_Team3D/Client/Private/Decendo.cpp +++ b/Jusin154_Team3D/Client/Private/Decendo.cpp @@ -313,7 +313,7 @@ void CDecendo::Free() #ifdef _DEBUG void CDecendo::Describe_Entity() { - GUI::Begin("DECENDO"); + GUI::Begin("DECENDO", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::InputFloat("Speed", &m_fLinearSpeed); diff --git a/Jusin154_Team3D/Client/Private/Goblin.cpp b/Jusin154_Team3D/Client/Private/Goblin.cpp index d9b49865e..6c46d1f4c 100644 --- a/Jusin154_Team3D/Client/Private/Goblin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin.cpp @@ -485,7 +485,7 @@ void CGoblin::Free() void CGoblin::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("Goblin")) { GUI::Checkbox("LookAt", &m_bLookAt); diff --git a/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp b/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp index b27b6b0eb..f5092b983 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Mage.cpp @@ -443,7 +443,7 @@ void CGoblin_Mage::Free() void CGoblin_Mage::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("Goblin_Mage")) { diff --git a/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp b/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp index 923f66544..95dfce590 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Protego.cpp @@ -186,7 +186,7 @@ void CGoblin_Protego::Free() void CGoblin_Protego::Describe_Entity() { - GUI::Begin("PROTEGO"); + GUI::Begin("PROTEGO", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::DragFloat("fAmountSize" ,&m_fAmountSize); GUI::DragFloat("fSpeed" , &m_fSpeed); diff --git a/Jusin154_Team3D/Client/Private/Goblin_Spector.cpp b/Jusin154_Team3D/Client/Private/Goblin_Spector.cpp index 5e9759d9f..419541a23 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Spector.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Spector.cpp @@ -348,7 +348,7 @@ void CGoblin_Spector::Free() void CGoblin_Spector::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("GoblinSpector")) { _float3 vScale = m_pTransformCom->Get_Scale(); diff --git a/Jusin154_Team3D/Client/Private/Levioso.cpp b/Jusin154_Team3D/Client/Private/Levioso.cpp index b9574384e..7bea83c05 100644 --- a/Jusin154_Team3D/Client/Private/Levioso.cpp +++ b/Jusin154_Team3D/Client/Private/Levioso.cpp @@ -298,7 +298,7 @@ void CLevioso::Free() void CLevioso::Describe_Entity() { - GUI::Begin("LEVIOSO"); + GUI::Begin("LEVIOSO", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::DragFloat("TURN SPEED", &m_fTurnSpeed); GUI::DragFloat("RANGE", &m_fRange); diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 92375b4cf..62a4fcdfd 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -39,7 +39,7 @@ void CLight_Main::Priority_Update(_float fTimeDelta) void CLight_Main::Update(_float fTimeDelta) { #ifdef _DEBUG - GUI::Begin("LIGHT"); + GUI::Begin("LIGHT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Main_Light")) { m_pLightCom->Describe_Entity(); } diff --git a/Jusin154_Team3D/Client/Private/MainApp.cpp b/Jusin154_Team3D/Client/Private/MainApp.cpp index e43ad8f0e..09702f732 100644 --- a/Jusin154_Team3D/Client/Private/MainApp.cpp +++ b/Jusin154_Team3D/Client/Private/MainApp.cpp @@ -68,7 +68,8 @@ void CMainApp::Update(_float fTimeDelta) GUI::NewFrame(); #ifdef _DEBUG m_pGameInstance->Present_TimeCost(); - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); + GUI::PushItemWidth(80); GUI::SliderFloat("fTimeMult", &g_fTimeMult, 0.01f, 4.f); GUI::End(); m_pGameInstance->Update_Engine(fTimeDelta * g_fTimeMult); diff --git a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp index ed83b7082..3a1fde3ee 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp @@ -269,11 +269,15 @@ HRESULT CMapElement_Interactable::Render_OutLine() } #ifdef _DEBUG - GUI::SetNextItemWidth(80.f); - GUI::ColorPicker3("vOutLineColor", (_float*)&m_vOutLineColor); - GUI::SliderFloat("Thickness", &m_fOutLineThickness, 0.1f, 2.f, "%.1f"); - GUI::SliderFloat("Scale", &m_fOutLineScale, 0.1f, 2.f, "%.1f"); - GUI::SliderFloat("Power", &m_fOutLinePower, 0.1f, 2.f, "%.1f"); + GUI::Begin("Unit", 0, IMGUI_GLOBAL_BEGIN_FLAG); + if (GUI::CollapsingHeader("OutLine")) { + GUI::SetNextItemWidth(80.f); + GUI::ColorPicker3("vOutLineColor", (_float*)&m_vOutLineColor); + GUI::SliderFloat("Thickness", &m_fOutLineThickness, 0.1f, 2.f, "%.1f"); + GUI::SliderFloat("Scale", &m_fOutLineScale, 0.1f, 2.f, "%.1f"); + GUI::SliderFloat("Power", &m_fOutLinePower, 0.1f, 2.f, "%.1f"); + } + GUI::End(); #endif // _DEBUG Compute_Depth(); diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 4bd73d904..a90739a4e 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -680,7 +680,7 @@ void CMapInfo::Free() void CMapInfo::Describe_Entity() { - GUI::Begin("CLIENT_SYSTEM"); + GUI::Begin("CLIENT_SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("MapInfoDesc")) { CLayer* pLayer = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_BACKGROUND); if (nullptr == pLayer) { diff --git a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp index 12f84ca23..bd95664f9 100644 --- a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp +++ b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp @@ -196,7 +196,7 @@ void CNPC_Ollivander::Free() void CNPC_Ollivander::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Ollivander")) { m_pModelCom->Describe_Entity(); if (ImGui::TreeNode("ANIM STATE")) { diff --git a/Jusin154_Team3D/Client/Private/NomalJap.cpp b/Jusin154_Team3D/Client/Private/NomalJap.cpp index 2bc1ae9f6..2f62d531b 100644 --- a/Jusin154_Team3D/Client/Private/NomalJap.cpp +++ b/Jusin154_Team3D/Client/Private/NomalJap.cpp @@ -317,7 +317,7 @@ void CNomalJap::Free() void CNomalJap::Describe_Entity() { - GUI::Begin("Jap"); + GUI::Begin("Jap", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::InputFloat("Speed", &m_fLinearSpeed); diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 2c3c25b71..50790d267 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -339,7 +339,7 @@ void CPlayer::Render_CameraCoordinateSystem() _float2 vLook = { XMVectorGetX(xmvLook), XMVectorGetZ(xmvLook) }; - GUI::Begin("CAMERA"); + GUI::Begin("CAMERA", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("Player_CAM_COOORD")) { @@ -617,7 +617,7 @@ void CPlayer::Free() void CPlayer::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("PLAYER_DESC")) { m_pCharacter_Controller->Describe_Entity(); diff --git a/Jusin154_Team3D/Client/Private/Protego.cpp b/Jusin154_Team3D/Client/Private/Protego.cpp index 46cec841b..ec0d946df 100644 --- a/Jusin154_Team3D/Client/Private/Protego.cpp +++ b/Jusin154_Team3D/Client/Private/Protego.cpp @@ -189,7 +189,7 @@ void CProtego::Free() void CProtego::Describe_Entity() { - GUI::Begin("PROTEGO"); + GUI::Begin("PROTEGO", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::DragFloat("fAmountSize", &m_fAmountSize); GUI::DragFloat("fSpeed", &m_fSpeed); diff --git a/Jusin154_Team3D/Client/Private/Terrain.cpp b/Jusin154_Team3D/Client/Private/Terrain.cpp index ab2082b9a..fddcdf76f 100644 --- a/Jusin154_Team3D/Client/Private/Terrain.cpp +++ b/Jusin154_Team3D/Client/Private/Terrain.cpp @@ -237,7 +237,7 @@ void CTerrain::Free() #ifdef _DEBUG void CTerrain::Describe_Entity() { - GUI::Begin("Renderer"); + GUI::Begin("Renderer", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("Terr")) { diff --git a/Jusin154_Team3D/Client/Private/Troll.cpp b/Jusin154_Team3D/Client/Private/Troll.cpp index e956243a8..58d540198 100644 --- a/Jusin154_Team3D/Client/Private/Troll.cpp +++ b/Jusin154_Team3D/Client/Private/Troll.cpp @@ -641,7 +641,7 @@ void CTroll::Free() void CTroll::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Troll")) { __super::Describe_Entity(); diff --git a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp index ece7b6500..c84ec6d19 100644 --- a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp @@ -269,7 +269,7 @@ void CTroll_Rock::Free() void CTroll_Rock::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("TrollRock")) { GUI::Checkbox("Visible", &m_bVisible); diff --git a/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp b/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp index d9a0d3c2f..d44555a3d 100644 --- a/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp @@ -210,7 +210,7 @@ void CTroll_Weapon::Free() void CTroll_Weapon::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Troll_Hammer")) { _float4 vPos; _float4 vHammerWorldPos; diff --git a/Jusin154_Team3D/Client/Private/Unified.cpp b/Jusin154_Team3D/Client/Private/Unified.cpp index 35f2ba606..0f19b294a 100644 --- a/Jusin154_Team3D/Client/Private/Unified.cpp +++ b/Jusin154_Team3D/Client/Private/Unified.cpp @@ -156,7 +156,7 @@ void CUnified::Free() #ifdef _DEBUG void CUnified::Describe_Entity() { - GUI::Begin("Unified"); + GUI::Begin("Unified", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::Checkbox("Visible ON / OFF", &m_isVisible); GUI::End(); diff --git a/Jusin154_Team3D/Client/Private/Wand.cpp b/Jusin154_Team3D/Client/Private/Wand.cpp index 7f87f6ade..a33f53216 100644 --- a/Jusin154_Team3D/Client/Private/Wand.cpp +++ b/Jusin154_Team3D/Client/Private/Wand.cpp @@ -192,7 +192,7 @@ void CWand::Free() void CWand::Describe_Entity() { - GUI::Begin("UNIT"); + GUI::Begin("UNIT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("WAND")) { _float4 vPos; _float4 vTipWorldPos; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index a7608f95e..9582cf4fa 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -390,4 +390,57 @@ float4 ApplyDissolve(Texture2D DisolveTexture, float fDisolveRatio, float fDisol return vMtrlDiffuse; } +bool IsValidUV(float2 uv) +{ + if (uv.x < 0 || uv.x >= 1 + || uv.y < 0 || uv.y >= 1) + { + return false; + } + return true; +} + +float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 vCenterTexCoord, sampler samplerLinear) +{ + float2 uv = vCenterTexCoord; + float2 vSrcTexelSize = float2(1.f/vGlobalTexelSize.x, 1.f/vGlobalTexelSize.y); + float fWeight = 0.f; + + float3 vCenterColor = float3(0.f, 0.f, 0.f); + float3 fLTColor = float3(0.f, 0.f, 0.f); + float3 fRTColor = float3(0.f, 0.f, 0.f); + float3 fLBColor = float3(0.f, 0.f, 0.f); + float3 fRBColor = float3(0.f, 0.f, 0.f); + { + if (true == IsValidUV(uv)) { + vCenterColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.5f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, -1.0); + if (true == IsValidUV(uv)) { + fLTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, -1.0); + if (true == IsValidUV(uv)) { + fRTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, +1.0); + if (true == IsValidUV(uv)) { + fLBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, +1.0); + if (true == IsValidUV(uv)) { + fRBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + } + + float3 vFilteredColor = (vCenterColor * 0.5 + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125) / fWeight; + + return float4(vFilteredColor, 1.0); +} + #endif // ENGINE_SHADER_FUNCTIONS_HLSLI diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli index 099c9e610..b70ca6161 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli @@ -42,6 +42,14 @@ sampler BorderZeroSampler = sampler_state BorderColor = float4(0.f, 0.f, 0.f, 0.f); }; +sampler BorderZeroLinearSampler = sampler_state +{ + Filter = MIN_MAG_MIP_LINEAR; + AddressU = Border; + AddressV = Border; + BorderColor = float4(0.f, 0.f, 0.f, 0.f); +}; + sampler BorderOneSampler = sampler_state { Filter = MIN_MAG_MIP_POINT; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..d3f595993 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -176,7 +176,12 @@ struct PS_OUT_LIGHT }; struct PS_OUT_FLT4_SINGLE { - vector vSingleTarget : SV_TARGET0; + float4 vFirstTarget : SV_TARGET0; +}; +struct PS_OUT_FLT4_DOUBLE +{ + float4 vFirstTarget : SV_TARGET0; + float4 vSecondTarget : SV_TARGET1; }; struct PS_OUT_BLUR_X { @@ -609,55 +614,112 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) return Out; } -PS_OUT_FLT4_SINGLE PS_MAIN_REFIT(PS_IN In) +PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - Out.vSingleTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + Out.vFirstTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); return Out; } +PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) +{ + PS_OUT_FLT4_SINGLE Out; + + float4 vSample = float4(0.f, 0.f, 0.f, 1.f); + float fWeight = 0.f; + float2 uv = float2(0.f, 0.f); + for (int i = -15; i < 16; ++i) + { + uv.x = In.vTexcoord.x + ((float) i / g_vResolution.x); + uv.y = In.vTexcoord.y; + if (false == IsValidUV(uv)) { + continue; + } + + vSample += g_fWeights_32[i + 15] * g_DiffuseTexture.Sample(BorderZeroSampler, uv); + fWeight += g_fWeights_32[i + 15]; + } + if (fWeight <= FLT_EPSILON7) + { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); + return Out; + } + + Out.vFirstTarget = (vSample / fWeight); + return Out; +} +PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_COMBINE(PS_IN In) +{ + PS_OUT_FLT4_SINGLE Out; + + float4 vSample = float4(0.f, 0.f, 0.f, 1.f); + float fWeight = 0.f; + float2 uv = float2(0.f, 0.f); + for (int i = -15; i < 16; ++i) + { + uv.x = In.vTexcoord.x; + uv.y = In.vTexcoord.y + ((float) i / g_vResolution.y); + + if (false == IsValidUV(uv)) + { + continue; + } + + vSample += g_fWeights_32[i + 15] * g_BlurXTexture.Sample(BorderZeroSampler, uv); + fWeight += g_fWeights_32[i + 15]; + } + if (fWeight <= FLT_EPSILON7) + { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); + return Out; + } + + Out.vFirstTarget = (vSample / fWeight); + return Out; +} + PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - - vector vInput = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); - //float fMask = g_BloomMaskTexture.Sample(BorderZeroSampler, In.vTexcoord).a; - float3 vColor = vInput.rgb; - uint iMask = (uint) round(vInput.a * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); + float2 uv = In.vTexcoord; + float fMask = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord).a; + float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); + float3 vColor = (0.f, 0.f, 0.f); - switch (iMask) + uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); + if (true) { - case 0: - /* None */ - vColor = (0.f, 0.f, 0.f); - break; - case 1: - /* Basic_Apply */ - break; - case 2: - /* Multiply */ + // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 + float3 vCenterColor = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 + vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; + if (iMask == 2) { vColor *= 3.f; - break; - case 3: - break; + } } - float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); // 대략적인 밝기 - - if (fIntensity <= FLT_EPSILON5) - { - Out.vSingleTarget = 0; + if (fIntensity <= FLT_EPSILON5) { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); return Out; } float fBloomIntensity = GetBloomCurve(fIntensity, g_fBloomThreshold, g_iBloomEmbossingPass); - float3 bloomColor = (vColor * fBloomIntensity) / fIntensity; - Out.vSingleTarget = float4(bloomColor, 1.f); + Out.vFirstTarget = float4(bloomColor, 1.f); return Out; } + PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_ACCUM(PS_IN In) { PS_OUT_FLT4_SINGLE Out; @@ -665,7 +727,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_ACCUM(PS_IN In) float3 vColorSrcA = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord).xyz; float3 vColorSrcB = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz; - Out.vSingleTarget = float4(saturate(vColorSrcA + vColorSrcB), 1.f); + Out.vFirstTarget = float4(saturate(vColorSrcA + vColorSrcB), 1.f); return Out; } @@ -675,8 +737,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_FINISH(PS_IN In) vector vColor = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord); float3 vBloom = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz; - Out.vSingleTarget = vColor; - Out.vSingleTarget += float4(vBloom, 1.f); + Out.vFirstTarget = vColor; + Out.vFirstTarget += float4(vBloom, 1.f); return Out; } @@ -904,7 +966,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) if (1.f == vDepthDesc.y) { vFinalColor = float4(g_vFogColor); } - Out.vSingleTarget = vFinalColor; + Out.vFirstTarget = vFinalColor; return Out; } @@ -1078,17 +1140,35 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_SPOT(); } - pass RefitPass // 6 + pass UpSamplePass // 6 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_None, 0); SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_REFIT(); + PixelShader = compile ps_5_0 PS_MAIN_UPSAMPLE(); + } + pass PS_MAIN_BLOOM_BLUR_XPASS // 7 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_BLOOM_BLUR_X(); + } + pass PS_MAIN_BLOOM_BLUR_COMBINEPASS // 8 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_BLOOM_BLUR_COMBINE(); } - pass EmbossingPass // 7 + pass EmbossingPass // 9 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_None, 0); @@ -1098,26 +1178,6 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_EMBOSS(); } - pass Bloom_BlurXPass // 8 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_None, 0); - SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_CAPTURE(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_BLUR_X(); - } - - pass Bloom_BlurYPass // 9 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_None, 0); - SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_CAPTURE(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_BLUR_Y(); - } - pass Bloom_AccumPass // 10 { SetRasterizerState(RS_Default); diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index a7608f95e..9582cf4fa 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -390,4 +390,57 @@ float4 ApplyDissolve(Texture2D DisolveTexture, float fDisolveRatio, float fDisol return vMtrlDiffuse; } +bool IsValidUV(float2 uv) +{ + if (uv.x < 0 || uv.x >= 1 + || uv.y < 0 || uv.y >= 1) + { + return false; + } + return true; +} + +float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 vCenterTexCoord, sampler samplerLinear) +{ + float2 uv = vCenterTexCoord; + float2 vSrcTexelSize = float2(1.f/vGlobalTexelSize.x, 1.f/vGlobalTexelSize.y); + float fWeight = 0.f; + + float3 vCenterColor = float3(0.f, 0.f, 0.f); + float3 fLTColor = float3(0.f, 0.f, 0.f); + float3 fRTColor = float3(0.f, 0.f, 0.f); + float3 fLBColor = float3(0.f, 0.f, 0.f); + float3 fRBColor = float3(0.f, 0.f, 0.f); + { + if (true == IsValidUV(uv)) { + vCenterColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.5f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, -1.0); + if (true == IsValidUV(uv)) { + fLTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, -1.0); + if (true == IsValidUV(uv)) { + fRTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, +1.0); + if (true == IsValidUV(uv)) { + fLBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, +1.0); + if (true == IsValidUV(uv)) { + fRBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fWeight += 0.125f; + } + } + + float3 vFilteredColor = (vCenterColor * 0.5 + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125) / fWeight; + + return float4(vFilteredColor, 1.0); +} + #endif // ENGINE_SHADER_FUNCTIONS_HLSLI diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli index 099c9e610..b70ca6161 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli @@ -42,6 +42,14 @@ sampler BorderZeroSampler = sampler_state BorderColor = float4(0.f, 0.f, 0.f, 0.f); }; +sampler BorderZeroLinearSampler = sampler_state +{ + Filter = MIN_MAG_MIP_LINEAR; + AddressU = Border; + AddressV = Border; + BorderColor = float4(0.f, 0.f, 0.f, 0.f); +}; + sampler BorderOneSampler = sampler_state { Filter = MIN_MAG_MIP_POINT; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 5dcc23f6f..d3f595993 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -176,7 +176,12 @@ struct PS_OUT_LIGHT }; struct PS_OUT_FLT4_SINGLE { - vector vSingleTarget : SV_TARGET0; + float4 vFirstTarget : SV_TARGET0; +}; +struct PS_OUT_FLT4_DOUBLE +{ + float4 vFirstTarget : SV_TARGET0; + float4 vSecondTarget : SV_TARGET1; }; struct PS_OUT_BLUR_X { @@ -609,55 +614,112 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) return Out; } -PS_OUT_FLT4_SINGLE PS_MAIN_REFIT(PS_IN In) +PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - Out.vSingleTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + Out.vFirstTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); return Out; } +PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) +{ + PS_OUT_FLT4_SINGLE Out; + + float4 vSample = float4(0.f, 0.f, 0.f, 1.f); + float fWeight = 0.f; + float2 uv = float2(0.f, 0.f); + for (int i = -15; i < 16; ++i) + { + uv.x = In.vTexcoord.x + ((float) i / g_vResolution.x); + uv.y = In.vTexcoord.y; + if (false == IsValidUV(uv)) { + continue; + } + + vSample += g_fWeights_32[i + 15] * g_DiffuseTexture.Sample(BorderZeroSampler, uv); + fWeight += g_fWeights_32[i + 15]; + } + if (fWeight <= FLT_EPSILON7) + { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); + return Out; + } + + Out.vFirstTarget = (vSample / fWeight); + return Out; +} +PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_COMBINE(PS_IN In) +{ + PS_OUT_FLT4_SINGLE Out; + + float4 vSample = float4(0.f, 0.f, 0.f, 1.f); + float fWeight = 0.f; + float2 uv = float2(0.f, 0.f); + for (int i = -15; i < 16; ++i) + { + uv.x = In.vTexcoord.x; + uv.y = In.vTexcoord.y + ((float) i / g_vResolution.y); + + if (false == IsValidUV(uv)) + { + continue; + } + + vSample += g_fWeights_32[i + 15] * g_BlurXTexture.Sample(BorderZeroSampler, uv); + fWeight += g_fWeights_32[i + 15]; + } + if (fWeight <= FLT_EPSILON7) + { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); + return Out; + } + + Out.vFirstTarget = (vSample / fWeight); + return Out; +} + PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - - vector vInput = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); - //float fMask = g_BloomMaskTexture.Sample(BorderZeroSampler, In.vTexcoord).a; - float3 vColor = vInput.rgb; - uint iMask = (uint) round(vInput.a * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); + float2 uv = In.vTexcoord; + float fMask = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord).a; + float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); + float3 vColor = (0.f, 0.f, 0.f); - switch (iMask) + uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); + if (true) { - case 0: - /* None */ - vColor = (0.f, 0.f, 0.f); - break; - case 1: - /* Basic_Apply */ - break; - case 2: - /* Multiply */ + // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 + float3 vCenterColor = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 + vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; + if (iMask == 2) { vColor *= 3.f; - break; - case 3: - break; + } } - float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); // 대략적인 밝기 - - if (fIntensity <= FLT_EPSILON5) - { - Out.vSingleTarget = 0; + if (fIntensity <= FLT_EPSILON5) { + Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); return Out; } float fBloomIntensity = GetBloomCurve(fIntensity, g_fBloomThreshold, g_iBloomEmbossingPass); - float3 bloomColor = (vColor * fBloomIntensity) / fIntensity; - Out.vSingleTarget = float4(bloomColor, 1.f); + Out.vFirstTarget = float4(bloomColor, 1.f); return Out; } + PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_ACCUM(PS_IN In) { PS_OUT_FLT4_SINGLE Out; @@ -665,7 +727,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_ACCUM(PS_IN In) float3 vColorSrcA = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord).xyz; float3 vColorSrcB = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz; - Out.vSingleTarget = float4(saturate(vColorSrcA + vColorSrcB), 1.f); + Out.vFirstTarget = float4(saturate(vColorSrcA + vColorSrcB), 1.f); return Out; } @@ -675,8 +737,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_FINISH(PS_IN In) vector vColor = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord); float3 vBloom = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz; - Out.vSingleTarget = vColor; - Out.vSingleTarget += float4(vBloom, 1.f); + Out.vFirstTarget = vColor; + Out.vFirstTarget += float4(vBloom, 1.f); return Out; } @@ -904,7 +966,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) if (1.f == vDepthDesc.y) { vFinalColor = float4(g_vFogColor); } - Out.vSingleTarget = vFinalColor; + Out.vFirstTarget = vFinalColor; return Out; } @@ -1078,17 +1140,35 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_SPOT(); } - pass RefitPass // 6 + pass UpSamplePass // 6 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_None, 0); SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_REFIT(); + PixelShader = compile ps_5_0 PS_MAIN_UPSAMPLE(); + } + pass PS_MAIN_BLOOM_BLUR_XPASS // 7 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_BLOOM_BLUR_X(); + } + pass PS_MAIN_BLOOM_BLUR_COMBINEPASS // 8 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_BLOOM_BLUR_COMBINE(); } - pass EmbossingPass // 7 + pass EmbossingPass // 9 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_None, 0); @@ -1098,26 +1178,6 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_EMBOSS(); } - pass Bloom_BlurXPass // 8 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_None, 0); - SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_CAPTURE(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_BLUR_X(); - } - - pass Bloom_BlurYPass // 9 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_None, 0); - SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_CAPTURE(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MAIN_BLUR_Y(); - } - pass Bloom_AccumPass // 10 { SetRasterizerState(RS_Default); diff --git a/Jusin154_Team3D/Engine/Private/Camera.cpp b/Jusin154_Team3D/Engine/Private/Camera.cpp index bb91d172a..ca8030a9d 100644 --- a/Jusin154_Team3D/Engine/Private/Camera.cpp +++ b/Jusin154_Team3D/Engine/Private/Camera.cpp @@ -160,7 +160,7 @@ HRESULT CCamera::Ready_Shadow() XMStoreFloat4(&ShadowDesc.vEye, XMLoadFloat4(&ShadowDesc.vAt) - matRotation.r[2] * (ShadowDesc.fFar * 0.25f)); #ifdef _DEBUG - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Near_Camera_ShadowDesc")) { //GUI::SliderFloat3("RPY", (_float*)&m_vRollPichYaw, -360.f, 360.f); GUI::DragFloat("Far", &ShadowDesc.fFar, 1.f, 20, 300.f); diff --git a/Jusin154_Team3D/Engine/Private/Fog.cpp b/Jusin154_Team3D/Engine/Private/Fog.cpp index 9899ec743..fea949abe 100644 --- a/Jusin154_Team3D/Engine/Private/Fog.cpp +++ b/Jusin154_Team3D/Engine/Private/Fog.cpp @@ -45,7 +45,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader) #ifdef _DEBUG void CFog::Update_Fog() { - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("FOG")) { GUI::Checkbox("Fog ON / OFF", &m_bVisible); GUI::InputFloat("g_fFogDensity", &m_fFogDensity, 0.001f); diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 79b840b82..241051acf 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -374,7 +374,7 @@ void CGameInstance::Present_TimeCost() const + m_fTimer_Level; GUI::PushItemWidth(80); - GUI::Begin("Previous_Frame_Timer"); + GUI::Begin("Previous_Frame_Timer", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Detail")) { { diff --git a/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp b/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp index df53d0162..802ec662a 100644 --- a/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/GameObject_Manager.cpp @@ -168,7 +168,7 @@ void CGameObject_Manager::Free() void CGameObject_Manager::Describe_Entity() { - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("Object_Manager")) { ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; GUI::Text("Levels : "); GUI::SameLine(); diff --git a/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp b/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp index 5c4dd2876..f4acfb16b 100644 --- a/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp @@ -204,7 +204,7 @@ void CMouse_Manager::Free() void CMouse_Manager::Describe_Entity() { - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("Mouse_Manager")) { GUI::Text("AccumulateMomentum %.2f, %.2f", m_vMove.x, m_vMove.y); diff --git a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp index c404e8cb4..f12ca295e 100644 --- a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp @@ -357,17 +357,17 @@ HRESULT CRenderTarget_Manager::Refit_RenderTarget(CVIBuffer_Rect* pVIBuffer, CSh const _char* pConstantName = { nullptr }; switch (ePass) { - case Engine::SHADER_PASS_DEFERRED::BLOOM_BLURX: - pConstantName = "g_BlurTexture"; - break; - case Engine::SHADER_PASS_DEFERRED::REFIT: + case Engine::SHADER_PASS_DEFERRED::UPSAMPLE: pConstantName = "g_DiffuseTexture"; break; case Engine::SHADER_PASS_DEFERRED::EMBOSSING: pConstantName = "g_DiffuseTexture"; break; + case Engine::SHADER_PASS_DEFERRED::BLOOM_BLURX: + pConstantName = "g_DiffuseTexture"; + break; case Engine::SHADER_PASS_DEFERRED::BLOOM_BLURY: - pConstantName = "g_BlurTexture"; + pConstantName = "g_BlurXTexture"; break; default: hResult = E_FAIL; @@ -514,7 +514,7 @@ HRESULT CRenderTarget_Manager::Render_RenderTarget_Debug(CShader* pShader, CVIBu void CRenderTarget_Manager::RenderTarget_Debuger() { - GUI::Begin("RenderTarget Debuger"); + GUI::Begin("RenderTarget Debuger", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::Spacing(); diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index c10926815..0b27ee45e 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -40,18 +40,18 @@ void CRenderer::Render() static _bool m_bToggleDebug = false; Describe_Entitiy(); m_pGameInstance->RenderTarget_Debuger(); + GUI::Begin("RenderTarget Debuger", 0, IMGUI_GLOBAL_BEGIN_FLAG); + GUI::Checkbox("DebugToggle", &m_bToggleDebug); if (m_pGameInstance->Key_Pressing(DIK_F10)) { Render_Debug(); } else { - GUI::Begin("RenderTarget Debuger"); - GUI::Checkbox("DebugToggle", &m_bToggleDebug); if (m_bToggleDebug) { Render_Debug(); } - GUI::End(); } + GUI::End(); #endif } @@ -674,6 +674,9 @@ void CRenderer::Render_Bloom() // "Target_Bloom_2x2" // "Target_Bloom_4x4" // "Target_Bloom_8x8" + // "Target_Bloom_2x2_1" + // "Target_Bloom_4x4_1" + // "Target_Bloom_8x8_1" // "Target_Bloom_8x8_X" // "Target_Bloom_4x4_2" // "Target_Bloom_2x2_2" @@ -701,23 +704,27 @@ void CRenderer::Render_Bloom() m_pShader->Bind_RawValue("g_iBloomEmbossingPass", &m_iBloomEmbossingPass, sizeof(_int)); m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_Input"), TEXT("Target_Bloom_2x2"), SHADER_PASS_DEFERRED::EMBOSSING); // 2 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2"), TEXT("Target_Bloom_4x4"), SHADER_PASS_DEFERRED::REFIT); // 3 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4"), TEXT("Target_Bloom_8x8"), SHADER_PASS_DEFERRED::REFIT); // 4 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8"), TEXT("Target_Bloom_8x8_X"), SHADER_PASS_DEFERRED::BLOOM_BLURX); + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2"), TEXT("Target_Bloom_4x4_1"), SHADER_PASS_DEFERRED::BLOOM_BLURX); // 3 + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4_1"), TEXT("Target_Bloom_4x4"), SHADER_PASS_DEFERRED::BLOOM_BLURY); // 3 + + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4"), TEXT("Target_Bloom_8x8_1"), SHADER_PASS_DEFERRED::BLOOM_BLURX); // 4 + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8_1"), TEXT("Target_Bloom_8x8"), SHADER_PASS_DEFERRED::BLOOM_BLURY); // 4 + + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8"), TEXT("Target_Bloom_8x8_X"), SHADER_PASS_DEFERRED::BLOOM_BLURX); // 5 m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8_X"), TEXT("Target_Bloom_8x8"), SHADER_PASS_DEFERRED::BLOOM_BLURY); // 5 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8"), TEXT("Target_Bloom_4x4"), SHADER_PASS_DEFERRED::REFIT); // 6 + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_8x8"), TEXT("Target_Bloom_4x4"), SHADER_PASS_DEFERRED::UPSAMPLE); // 6 m_pGameInstance->Accumulate_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4"), TEXT("Target_Bloom_8x8"), TEXT("Target_Bloom_4x4_2"), SHADER_PASS_DEFERRED::BLOOM_ACCUM); m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4_2"), TEXT("Target_Bloom_4x4"), SHADER_PASS_DEFERRED::BLOOM_BLURX); m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4"), TEXT("Target_Bloom_4x4_2"), SHADER_PASS_DEFERRED::BLOOM_BLURY); // 7 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4_2"), TEXT("Target_Bloom_2x2"), SHADER_PASS_DEFERRED::REFIT); + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_4x4_2"), TEXT("Target_Bloom_2x2"), SHADER_PASS_DEFERRED::UPSAMPLE); m_pGameInstance->Accumulate_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2"), TEXT("Target_Bloom_4x4_2"), TEXT("Target_Bloom_2x2_2"), SHADER_PASS_DEFERRED::BLOOM_ACCUM); m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom_2x2"), SHADER_PASS_DEFERRED::BLOOM_BLURX); m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2"), TEXT("Target_Bloom_2x2_2"), SHADER_PASS_DEFERRED::BLOOM_BLURY); // 8 - m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::REFIT); + m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::UPSAMPLE); m_pGameInstance->Finish_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_Input"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::BLOOM_FINISH); // 9 } diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index 82457014c..15f651421 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -298,6 +298,18 @@ HRESULT CRenderer::Initialize() DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { return E_FAIL; } + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Bloom_2x2_1"), (_uint)(Viewport.Width * 0.5f), (_uint)(Viewport.Height * 0.5f), + DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Bloom_4x4_1"), (_uint)(Viewport.Width * 0.25f), (_uint)(Viewport.Height * 0.25f), + DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Bloom_8x8_1"), (_uint)(Viewport.Width * 0.125f), (_uint)(Viewport.Height * 0.125f), + DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { + return E_FAIL; + } if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Bloom_8x8_X"), (_uint)(Viewport.Width * 0.125f), (_uint)(Viewport.Height * 0.125f), DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { return E_FAIL; @@ -508,7 +520,7 @@ void CRenderer::Free() #ifdef _DEBUG void CRenderer::Describe_Entitiy() { - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("RENDERER")) { GUI::PushItemWidth(80); if (GUI::CollapsingHeader("PostProcessing_Bloom")) diff --git a/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp index aaf593a9d..2068e69b0 100644 --- a/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp @@ -141,7 +141,7 @@ void CResource_Manager::Free() void CResource_Manager::Describe_Entity() { - GUI::Begin("SYSTEM"); + GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::PushItemWidth(80); if (GUI::CollapsingHeader("ResourceManager")) { static vector> vecHit = {}; diff --git a/Jusin154_Team3D/Engine/Private/Trail.cpp b/Jusin154_Team3D/Engine/Private/Trail.cpp index a91fb3d71..fef82741f 100644 --- a/Jusin154_Team3D/Engine/Private/Trail.cpp +++ b/Jusin154_Team3D/Engine/Private/Trail.cpp @@ -350,7 +350,7 @@ void CTrail::Free() void CTrail::Describe_Entity() { - GUI::Begin("EFFECT"); + GUI::Begin("EFFECT", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("CTrail")) { GUI::InputFloat3("Low", (_float*)&m_TrailDesc.vLow); GUI::InputFloat3("High", (_float*)&m_TrailDesc.vHigh); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 732969a8a..ecf271a31 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -39,7 +39,7 @@ enum class NAVI_LINE { AB, BC, CA, END }; enum class SHADER_PASS_CELL { DEBUG, END }; enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, - REFIT, EMBOSSING, BLOOM_BLURX, BLOOM_BLURY, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT, + UPSAMPLE, BLOOM_BLURX, BLOOM_BLURY, EMBOSSING, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT, POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, END }; diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h index 4a75001d4..fe0830611 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h @@ -1,8 +1,14 @@ #pragma once + + #ifndef GUI #define GUI ImGui #endif // !GUI +#ifndef IMGUI_GLOBAL_BEGIN_FLAG +#define IMGUI_GLOBAL_BEGIN_FLAG ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_NoBringToFrontOnFocus|ImGuiWindowFlags_AlwaysAutoResize +#endif // IMGUI_GLOBAL_BEGIN_FLAG + #ifndef PSX #define PSX physx diff --git a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h index a225187f9..683e633ce 100644 --- a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h +++ b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h @@ -22,7 +22,9 @@ class CRenderTarget_Manager final : public CBase HRESULT Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D); HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag); + // 두 랜더타겟을 하나로 모음 HRESULT Accumulate_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB, const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass); + // 랜더 타겟의 크기를 dest로 다시 맞춤 HRESULT Refit_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput, SHADER_PASS_DEFERRED ePass); HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass); From acdeda80b14a106ca3f92903f33db7ffa22bd7c4 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 14 Dec 2025 16:36:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[add]=20bilinear=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShaderFiles/Engine_Shader_Functions.hlsli | 10 ++++---- .../ShaderFiles/Shader_Deferred.hlsl | 25 +++++++++---------- .../ShaderFiles/Engine_Shader_Functions.hlsli | 10 ++++---- .../ShaderFiles/Shader_Deferred.hlsl | 25 +++++++++---------- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index 9582cf4fa..6edb266b5 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -413,27 +413,27 @@ float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 v float3 fRBColor = float3(0.f, 0.f, 0.f); { if (true == IsValidUV(uv)) { - vCenterColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + vCenterColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.5f; } uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, -1.0); if (true == IsValidUV(uv)) { - fLTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fLTColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, -1.0); if (true == IsValidUV(uv)) { - fRTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fRTColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, +1.0); if (true == IsValidUV(uv)) { - fLBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fLBColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, +1.0); if (true == IsValidUV(uv)) { - fRBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fRBColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index d3f595993..31516fa97 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -683,35 +683,34 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) { PS_OUT_FLT4_SINGLE Out; float2 uv = In.vTexcoord; - float fMask = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord).a; + float fMask = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a; float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); float3 vColor = (0.f, 0.f, 0.f); uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); - if (true) + if (0 != iMask) { // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 - float3 vCenterColor = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; - if (iMask == 2) { + if (iMask == 2) + { vColor *= 3.f; } } - float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); // 대략적인 밝기 - if (fIntensity <= FLT_EPSILON5) { - Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); - return Out; - } + float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); + fIntensity = max(FLT_EPSILON3, fIntensity); + float fBloomIntensity = GetBloomCurve(fIntensity, g_fBloomThreshold, g_iBloomEmbossingPass); float3 bloomColor = (vColor * fBloomIntensity) / fIntensity; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index 9582cf4fa..6edb266b5 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -413,27 +413,27 @@ float4 BilinearFetches(float2 vGlobalTexelSize, Texture2D SrcTexture2D, float2 v float3 fRBColor = float3(0.f, 0.f, 0.f); { if (true == IsValidUV(uv)) { - vCenterColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + vCenterColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.5f; } uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, -1.0); if (true == IsValidUV(uv)) { - fLTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fLTColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, -1.0); if (true == IsValidUV(uv)) { - fRTColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fRTColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(-1.0, +1.0); if (true == IsValidUV(uv)) { - fLBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fLBColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } uv = vCenterTexCoord + vSrcTexelSize * float2(+1.0, +1.0); if (true == IsValidUV(uv)) { - fRBColor = SrcTexture2D.Sample(samplerLinear, uv).rgb; + fRBColor = SrcTexture2D.SampleLevel(samplerLinear, uv, 0).rgb; fWeight += 0.125f; } } diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index d3f595993..31516fa97 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -683,35 +683,34 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) { PS_OUT_FLT4_SINGLE Out; float2 uv = In.vTexcoord; - float fMask = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord).a; + float fMask = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a; float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); float3 vColor = (0.f, 0.f, 0.f); uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); - if (true) + if (0 != iMask) { // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 - float3 vCenterColor = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; - if (iMask == 2) { + if (iMask == 2) + { vColor *= 3.f; } } - float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); // 대략적인 밝기 - if (fIntensity <= FLT_EPSILON5) { - Out.vFirstTarget = float4(0.f, 0.f, 0.f, 1.f); - return Out; - } + float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); + fIntensity = max(FLT_EPSILON3, fIntensity); + float fBloomIntensity = GetBloomCurve(fIntensity, g_fBloomThreshold, g_iBloomEmbossingPass); float3 bloomColor = (vColor * fBloomIntensity) / fIntensity; From 078b329e18e1fe96661e863f6088c4089c48b780 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 14 Dec 2025 17:21:41 +0900 Subject: [PATCH 4/5] [add] Bloom flickerring --- .../ShaderFiles/Shader_Deferred.hlsl | 67 +++++++++++++------ .../ShaderFiles/Shader_Deferred.hlsl | 67 +++++++++++++------ Jusin154_Team3D/Engine/Public/Renderer.h | 2 +- 3 files changed, 97 insertions(+), 39 deletions(-) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0a2b8f963..51156819c 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -76,6 +76,12 @@ float g_fWeights_32[32] = 0.079902, 0.078320, 0.073759, 0.066740, 0.058021, 0.048463, 0.038893, 0.029988, 0.022216, 0.015813, 0.010814, 0.007105, 0.004485, 0.002720, 0.001585, 0.000888 }; +float g_fWeight_3x3_UPSAMPLE[3][3] = +{ + { 0.0625f, 0.125f, 0.0625f }, + { 0.125f, 0.250f, 0.125f }, + { 0.0625f, 0.125f, 0.0625f } +}; float g_fWeights_64[64] = { @@ -617,9 +623,22 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - - Out.vFirstTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + float3 vColor = float3(0.f, 0.f, 0.f); + float fWeight = 0.f; + float2 uv = In.vTexcoord; + float2 vTexcelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); + for (int iRow = -1; iRow < 2; ++iRow) { + for (int iCol = -1; iCol < 2; ++iCol) { + uv = In.vTexcoord + vTexcelSize * float2(iRow, iCol); + if (true == IsValidUV(uv)) { + vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0); + fWeight += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol]; + } + } + } + vColor /= fWeight; + Out.vFirstTarget = float4(vColor, 1.f); return Out; } PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) @@ -688,26 +707,36 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) float3 vColor = (0.f, 0.f, 0.f); uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); - if (0 != iMask) - { + //if (0 != iMask) { // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 - float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); - float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); - float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); - float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); - float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(0.0, -1.0); + float3 fTColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, 0.0); + float3 fLColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(1.0, 0.0); + float3 fRColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(0.0, 1.0); + float3 fBColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 - vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; - if (iMask == 2) - { - vColor *= 3.f; - } - } + vColor = vCenterColor * 0.25f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.0625f + (fTColor + fLColor + fRColor + fBColor) * 0.125f; + //if (iMask == 2) + //{ + // vColor *= 3.f; + //} + //} float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); fIntensity = max(FLT_EPSILON3, fIntensity); diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0a2b8f963..51156819c 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -76,6 +76,12 @@ float g_fWeights_32[32] = 0.079902, 0.078320, 0.073759, 0.066740, 0.058021, 0.048463, 0.038893, 0.029988, 0.022216, 0.015813, 0.010814, 0.007105, 0.004485, 0.002720, 0.001585, 0.000888 }; +float g_fWeight_3x3_UPSAMPLE[3][3] = +{ + { 0.0625f, 0.125f, 0.0625f }, + { 0.125f, 0.250f, 0.125f }, + { 0.0625f, 0.125f, 0.0625f } +}; float g_fWeights_64[64] = { @@ -617,9 +623,22 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) PS_OUT_FLT4_SINGLE PS_MAIN_UPSAMPLE(PS_IN In) { PS_OUT_FLT4_SINGLE Out; - - Out.vFirstTarget = g_DiffuseTexture.Sample(BorderZeroSampler, In.vTexcoord); + float3 vColor = float3(0.f, 0.f, 0.f); + float fWeight = 0.f; + float2 uv = In.vTexcoord; + float2 vTexcelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); + for (int iRow = -1; iRow < 2; ++iRow) { + for (int iCol = -1; iCol < 2; ++iCol) { + uv = In.vTexcoord + vTexcelSize * float2(iRow, iCol); + if (true == IsValidUV(uv)) { + vColor += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol] * g_DiffuseTexture.SampleLevel(BorderZeroLinearSampler, uv, 0); + fWeight += g_fWeight_3x3_UPSAMPLE[1 + iRow][1 + iCol]; + } + } + } + vColor /= fWeight; + Out.vFirstTarget = float4(vColor, 1.f); return Out; } PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_BLUR_X(PS_IN In) @@ -688,26 +707,36 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In) float3 vColor = (0.f, 0.f, 0.f); uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255); - if (0 != iMask) - { + //if (0 != iMask) { // 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링 - float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); - float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); - float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); - float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); - uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); - float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0); + float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(0.0, -1.0); + float3 fTColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0); + float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, 0.0); + float3 fLColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(1.0, 0.0); + float3 fRColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0); + float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + uv = In.vTexcoord + vSrcTexelSize * float2(0.0, 1.0); + float3 fBColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0); + uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0); + float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler); + + // vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯 - vColor = vCenterColor * 0.5f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.125f; - if (iMask == 2) - { - vColor *= 3.f; - } - } + vColor = vCenterColor * 0.25f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.0625f + (fTColor + fLColor + fRColor + fBColor) * 0.125f; + //if (iMask == 2) + //{ + // vColor *= 3.f; + //} + //} float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); fIntensity = max(FLT_EPSILON3, fIntensity); diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index 29eacb11c..63b62a1ed 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -54,7 +54,7 @@ class CRenderer final : public CBase _float m_fExposure = { 0.7f }; // Bloom - _int m_iBloomEmbossingPass = { 0 }; + _int m_iBloomEmbossingPass = { 1 }; _float m_fBloomThreshold = { 1.26f }; // DOF Environment From 31842e13596a852eace81037d563652b633345b7 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sun, 14 Dec 2025 17:55:28 +0900 Subject: [PATCH 5/5] [add] Renderer Timer --- .../Engine/Private/GameInstance.cpp | 156 +++++++++++++++++- .../Engine/Private/Key_Manager.cpp | 32 ++-- Jusin154_Team3D/Engine/Private/Renderer.cpp | 48 +++++- .../Engine/Private/Timer_Manager.cpp | 77 ++++++++- Jusin154_Team3D/Engine/Public/Engine_Macro.h | 2 +- Jusin154_Team3D/Engine/Public/GameInstance.h | 22 ++- Jusin154_Team3D/Engine/Public/Timer_Manager.h | 5 +- 7 files changed, 314 insertions(+), 28 deletions(-) diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 241051acf..bb5e034c2 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -358,11 +358,33 @@ void CGameInstance::Compute_FrameCount() m_fTimer_PhysX = Get_TimeDelta(TEXT("Timer_PhysX")); m_fTimer_Level = Get_TimeDelta(TEXT("Timer_Level")); m_fTimer_FrameCount = Get_TimeDelta(TEXT("Timer_FrameCount")); + + m_fTimer_Render_Priority = Get_TimeDelta(TEXT("Timer_Render_Priority")); + m_fTimer_Render_Shadow = Get_TimeDelta(TEXT("Timer_Render_Shadow")); + m_fTimer_Render_NonBlend = Get_TimeDelta(TEXT("Timer_Render_NonBlend")); + m_fTimer_Render_SSAO = Get_TimeDelta(TEXT("Timer_Render_SSAO")); + m_fTimer_Render_SSAO_BLUR = Get_TimeDelta(TEXT("Timer_Render_SSAO_BLUR")); + m_fTimer_Render_LightAcc = Get_TimeDelta(TEXT("Timer_Render_LightAcc")); + m_fTimer_Render_Blur = Get_TimeDelta(TEXT("Timer_Render_Blur")); + m_fTimer_Render_Combined = Get_TimeDelta(TEXT("Timer_Render_Combined")); + m_fTimer_Render_Occlusion = Get_TimeDelta(TEXT("Timer_Render_Occlusion")); + m_fTimer_Render_EnvironmentPostProcess = Get_TimeDelta(TEXT("Timer_Render_EnvironmentPostProcess")); + m_fTimer_Render_Fog = Get_TimeDelta(TEXT("Timer_Render_Fog")); + m_fTimer_Render_Effect = Get_TimeDelta(TEXT("Timer_Render_Effect")); + m_fTimer_Render_NonLight = Get_TimeDelta(TEXT("Timer_Render_NonLight")); + m_fTimer_Render_Blend = Get_TimeDelta(TEXT("Timer_Render_Blend")); + m_fTimer_Render_WeightBlend = Get_TimeDelta(TEXT("Timer_Render_WeightBlend")); + m_fTimer_Render_Bloom = Get_TimeDelta(TEXT("Timer_Render_Bloom")); + m_fTimer_Render_LastColor = Get_TimeDelta(TEXT("Timer_Render_LastColor")); + m_fTimer_Render_Tone_Mapping = Get_TimeDelta(TEXT("Timer_Render_Tone_Mapping")); + m_fTimer_Render_UI = Get_TimeDelta(TEXT("Timer_Render_UI")); + m_fTimer_Render_UI_Overley = Get_TimeDelta(TEXT("Timer_Render_UI_Overley")); #endif // _DEBUG } void CGameInstance::Present_TimeCost() const { +#pragma region TimeCost #ifdef _DEBUG _float fTotal = m_fTimer_PriorityUpdate + m_fTimer_Update @@ -375,6 +397,7 @@ void CGameInstance::Present_TimeCost() const GUI::PushItemWidth(80); GUI::Begin("Previous_Frame_Timer", 0, IMGUI_GLOBAL_BEGIN_FLAG); + if (GUI::CollapsingHeader("Detail")) { { @@ -407,8 +430,138 @@ void CGameInstance::Present_TimeCost() const GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); GUI::Text("Level %d", int(m_fTimer_Level / fTotal * 100.f)); } + if (GUI::IsPopupOpen("Renderer_Timer")) + { + if (GUI::BeginPopup("Renderer_Timer")) { + _float fRenderer_Total = m_fTimer_Render_Priority + + m_fTimer_Render_Shadow + + m_fTimer_Render_NonBlend + + m_fTimer_Render_SSAO + + m_fTimer_Render_SSAO_BLUR + + m_fTimer_Render_LightAcc + + m_fTimer_Render_Blur + + m_fTimer_Render_Combined + + m_fTimer_Render_Occlusion + + m_fTimer_Render_EnvironmentPostProcess + + m_fTimer_Render_Fog + + m_fTimer_Render_Effect + + m_fTimer_Render_NonLight + + m_fTimer_Render_Blend + + m_fTimer_Render_WeightBlend + + m_fTimer_Render_Bloom + + m_fTimer_Render_LastColor + + m_fTimer_Render_Tone_Mapping + + m_fTimer_Render_UI + + m_fTimer_Render_UI_Overley; + { + GUI::ProgressBar(m_fTimer_Render_Priority / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Priority %d", int(m_fTimer_Render_Priority / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Shadow / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Shadow %d", int(m_fTimer_Render_Shadow / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_NonBlend / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_NonBlend %d", int(m_fTimer_Render_NonBlend / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_SSAO / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_SSAO %d", int(m_fTimer_Render_SSAO / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_SSAO_BLUR / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_SSAO_BLUR %d", int(m_fTimer_Render_SSAO_BLUR / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_LightAcc / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_LightAcc %d", int(m_fTimer_Render_LightAcc / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Blur / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Blur %d", int(m_fTimer_Render_Blur / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Combined / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Combined %d", int(m_fTimer_Render_Combined / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Occlusion / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Occlusion %d", int(m_fTimer_Render_Occlusion / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_EnvironmentPostProcess / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_EnvironmentPostProcess %d", int(m_fTimer_Render_EnvironmentPostProcess / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Fog / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Fog %d", int(m_fTimer_Render_Fog / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Effect / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Effect %d", int(m_fTimer_Render_Effect / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_NonLight / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_NonLight %d", int(m_fTimer_Render_NonLight / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Blend / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Blend %d", int(m_fTimer_Render_Blend / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_WeightBlend / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_WeightBlend %d", int(m_fTimer_Render_WeightBlend / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Bloom / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Bloom %d", int(m_fTimer_Render_Bloom / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_LastColor / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_LastColor %d", int(m_fTimer_Render_LastColor / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_Tone_Mapping / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_Tone_Mapping %d", int(m_fTimer_Render_Tone_Mapping / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_UI / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_UI %d", int(m_fTimer_Render_UI / fRenderer_Total * 100.f)); + } + { + GUI::ProgressBar(m_fTimer_Render_UI_Overley / fRenderer_Total, ImVec2(200.f, 0.f)); + GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); + GUI::Text("Render_UI_Overley %d", int(m_fTimer_Render_UI_Overley / fRenderer_Total * 100.f)); + } + GUI::EndPopup(); + } + } { GUI::ProgressBar(m_fTimer_DrawCall / fTotal, ImVec2(200.f, 0.f)); + GUI::SameLine(); + if (GUI::SmallButton("Renderer_Timer")) { + GUI::OpenPopup("Renderer_Timer"); + } GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x); GUI::Text("DrawCall %d", int(m_fTimer_DrawCall / fTotal * 100.f)); } @@ -429,7 +582,7 @@ void CGameInstance::Present_TimeCost() const static double refresh_time = 0.0; if (refresh_time == 0.0) refresh_time = GUI::GetTime(); - while (refresh_time < GUI::GetTime()) // Create data at fixed 60 Hz rate for the demo + while (refresh_time < GUI::GetTime()) { values[values_offset] = m_fTimer_FrameCount; values_offset = (values_offset + 1) % IM_ARRAYSIZE(values); @@ -475,6 +628,7 @@ void CGameInstance::Present_TimeCost() const } GUI::End(); #endif // _DEBUG +#pragma endregion } HRESULT CGameInstance::Change_Level(CLevel* pNewLevel) diff --git a/Jusin154_Team3D/Engine/Private/Key_Manager.cpp b/Jusin154_Team3D/Engine/Private/Key_Manager.cpp index 94ab01823..a2e7ff3e4 100644 --- a/Jusin154_Team3D/Engine/Private/Key_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Key_Manager.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "Key_Manager.h" CKey_Manager::CKey_Manager() @@ -10,7 +10,7 @@ CKey_Manager::CKey_Manager() bool CKey_Manager::Key_Pressing(int _iKey) const { - // ÇöÀçÇÁ·¹Àӿ¡ ´­¸®°í Àִٸé Pressing + // 현재프레임에 눌리고 있다면 Pressing if ((m_byNewKeyState[_iKey] & 0x80)) { return true; } @@ -19,7 +19,7 @@ bool CKey_Manager::Key_Pressing(int _iKey) const bool CKey_Manager::Key_Up(int _iKey) const { - // ÀÌÀüÇÁ·¹Àӿ¡ ´­·Ȱí ÇöÀçÇÁ·¹Àӿ¡ ¾ȴ­·ȴٸé Up + // 이전프레임에 눌렸고 현재프레임에 안눌렸다면 Up if ((m_byOldKeyState[_iKey] & 0x80) && !(m_byNewKeyState[_iKey] & 0x80)) { return true; } @@ -28,7 +28,7 @@ bool CKey_Manager::Key_Up(int _iKey) const bool CKey_Manager::Key_Down(int _iKey) const { - // ÀÌÀüÇÁ·¹Àӿ¡ ¾ȴ­·Ȱí ÇöÀçÇÁ·¹Àӿ¡ ´­·ȴٸé Down + // 이전프레임에 안눌렸고 현재프레임에 눌렸다면 Down if (!(m_byOldKeyState[_iKey] & 0x80) && (m_byNewKeyState[_iKey] & 0x80)) { return true; } @@ -37,7 +37,7 @@ bool CKey_Manager::Key_Down(int _iKey) const _bool CKey_Manager::Mouse_Pressing(int _iKey) const { - // ÇöÀçÇÁ·¹Àӿ¡ ´­¸®°í Àִٸé Pressing + // 현재프레임에 눌리고 있다면 Pressing if ((m_tNewMouseState.rgbButtons[_iKey] & 0x80)) { return true; } @@ -46,7 +46,7 @@ _bool CKey_Manager::Mouse_Pressing(int _iKey) const _bool CKey_Manager::Mouse_Up(int _iKey) const { - // ÀÌÀüÇÁ·¹Àӿ¡ ´­·Ȱí ÇöÀçÇÁ·¹Àӿ¡ ¾ȴ­·ȴٸé Up + // 이전프레임에 눌렸고 현재프레임에 안눌렸다면 Up if ((m_tOldMouseState.rgbButtons[_iKey] & 0x80) && !(m_tNewMouseState.rgbButtons[_iKey] & 0x80)) { return true; } @@ -55,7 +55,7 @@ _bool CKey_Manager::Mouse_Up(int _iKey) const _bool CKey_Manager::Mouse_Down(int _iKey) const { - // ÀÌÀüÇÁ·¹Àӿ¡ ´­·Ȱí ÇöÀçÇÁ·¹Àӿ¡ ¾ȴ­·ȴٸé Down + // 이전프레임에 눌렸고 현재프레임에 안눌렸다면 Down if (!(m_tOldMouseState.rgbButtons[_iKey] & 0x80) && (m_tNewMouseState.rgbButtons[_iKey] & 0x80)) { return true; } @@ -70,7 +70,7 @@ _bool CKey_Manager::Mouse_StartMove() const _int iNewMomentum = m_tNewMouseState.lX * m_tNewMouseState.lX + m_tNewMouseState.lY * m_tNewMouseState.lY + m_tNewMouseState.lZ * m_tNewMouseState.lZ; - // Àü¿¡ ¾ȿòÁ÷¿´°í Áö±Ý ¿òÁ÷À̸é Start + // 전에 안움직였고 지금 움직이면 Start if (iOldMomentum == 0 && iNewMomentum > 0) { return true; } @@ -79,7 +79,7 @@ _bool CKey_Manager::Mouse_StartMove() const _bool CKey_Manager::Mouse_Moving() const { - // ÇöÀçÇÁ·¹Àӿ¡ ¿òÁ÷À̰í Àִٸé Moving + // 현재프레임에 움직이고 있다면 Moving _int iNewMomentum = m_tNewMouseState.lX * m_tNewMouseState.lX + m_tNewMouseState.lY * m_tNewMouseState.lY + m_tNewMouseState.lZ * m_tNewMouseState.lZ; @@ -97,7 +97,7 @@ _bool CKey_Manager::Mouse_StopMove() const _int iNewMomentum = m_tNewMouseState.lX * m_tNewMouseState.lX + m_tNewMouseState.lY * m_tNewMouseState.lY + m_tNewMouseState.lZ * m_tNewMouseState.lZ; - // Àü¿¡ ¿òÁ÷¿´°í Áö±ÝÀº ¾ȿòÁ÷À̸é Stop + // 전에 움직였고 지금은 안움직이면 Stop if (iOldMomentum > 0 && iNewMomentum == 0) { return true; } @@ -112,23 +112,23 @@ _float3 CKey_Manager::Get_MouseMove() const void CKey_Manager::Update() { if (GetForegroundWindow() == m_hWnd) { - // ÀÌÀü »óÅ ÀúÀå + // 이전 상태 저장 memcpy_s(m_byOldKeyState, sizeof(m_byOldKeyState), m_byNewKeyState, sizeof(m_byNewKeyState)); memcpy_s(&m_tOldMouseState, sizeof(m_tOldMouseState), &m_tNewMouseState, sizeof(m_tNewMouseState)); - // Àåġ »óÅ Àбâ + // 장치 상태 읽기 HRESULT hrKeyboard = m_pKeyBoard->GetDeviceState(DIK_MAX + 1, m_byNewKeyState); if (FAILED(hrKeyboard)) { - m_pKeyBoard->Acquire(); // ´ٽà ȹµæ + m_pKeyBoard->Acquire(); // 다시 획득 } HRESULT hrMouse = m_pMouse->GetDeviceState(sizeof(m_tNewMouseState), &m_tNewMouseState); if (FAILED(hrMouse)) { - m_pMouse->Acquire(); // ´ٽà ȹµæ + m_pMouse->Acquire(); // 다시 획득 } } else { - // ºñȰ¼ºȭ »óŶó¸é ±׳É ¹«½Ã + // 비활성화 상태라면 그냥 무시 ZeroMemory(m_byNewKeyState, sizeof(m_byNewKeyState)); ZeroMemory(&m_tNewMouseState, sizeof(m_tNewMouseState)); } @@ -188,4 +188,4 @@ void CKey_Manager::Free() SAFE_RELEASE(m_pKeyBoard); SAFE_RELEASE(m_pMouse); SAFE_RELEASE(m_pInputSDK); -} \ No newline at end of file +} diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 0b27ee45e..ebe395f5e 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -105,6 +105,7 @@ void CRenderer::Render_PreShadow() void CRenderer::Render_Occlusion() { + COMPUTE_TIMEDELTA("Timer_Render_Occlusion"); if (FAILED(m_pGameInstance->Begin_MRT_NonClear(TEXT("MRT_Combined")))) { return; } @@ -129,10 +130,12 @@ void CRenderer::Render_Occlusion() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_Occlusion"); } void CRenderer::Render_Priority() { + COMPUTE_TIMEDELTA("Timer_Render_Priority"); for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRIORITY)]) { if (nullptr != pRenderObject) { @@ -145,11 +148,12 @@ void CRenderer::Render_Priority() } m_RenderObjects[ENUM_CLASS(RENDER::PRIORITY)].clear(); - + COMPUTE_TIMEDELTA("Timer_Render_Priority"); } void CRenderer::Render_Shadow() { + COMPUTE_TIMEDELTA("Timer_Render_Shadow"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Shadow"), m_pShadowDSV))) { return; } @@ -189,10 +193,12 @@ void CRenderer::Render_Shadow() m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc); + COMPUTE_TIMEDELTA("Timer_Render_Shadow"); } void CRenderer::Render_NonBlend() { + COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_GameObjects")))) { return; } @@ -212,10 +218,12 @@ void CRenderer::Render_NonBlend() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); } void CRenderer::Render_LightAcc() { + COMPUTE_TIMEDELTA("Timer_Render_LightAcc"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_LightAcc")))) { return; } @@ -253,10 +261,12 @@ void CRenderer::Render_LightAcc() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_LightAcc"); } void CRenderer::Render_Combined() { + COMPUTE_TIMEDELTA("Timer_Render_Combined"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Combined")))) { return; } @@ -332,10 +342,12 @@ void CRenderer::Render_Combined() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_Combined"); } void CRenderer::Render_EnvironmentPostProcess() { + COMPUTE_TIMEDELTA("Timer_Render_EnvironmentPostProcess"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_ENV_Blur_X")))) { return; } @@ -400,10 +412,12 @@ void CRenderer::Render_EnvironmentPostProcess() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_EnvironmentPostProcess"); } void CRenderer::Render_Fog() { + COMPUTE_TIMEDELTA("Timer_Render_Fog"); m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)); m_pGameInstance->Bind_FogValue(m_pShader); @@ -420,11 +434,12 @@ void CRenderer::Render_Fog() m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); - + COMPUTE_TIMEDELTA("Timer_Render_Fog"); } void CRenderer::Render_Effect() { + COMPUTE_TIMEDELTA("Timer_Render_Effect"); if (FAILED(m_pGameInstance->Begin_MRT_NO_DepthStencil(TEXT("MRT_WB")))) { return; } @@ -444,10 +459,12 @@ void CRenderer::Render_Effect() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_Effect"); } void CRenderer::Render_WeightBlend() { + COMPUTE_TIMEDELTA("Timer_Render_WeightBlend"); // Bind_Resorces m_pWeightBlendShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix); @@ -467,11 +484,12 @@ void CRenderer::Render_WeightBlend() m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); - + COMPUTE_TIMEDELTA("Timer_Render_WeightBlend"); } void CRenderer::Render_NonLight() { + COMPUTE_TIMEDELTA("Timer_Render_NonLight"); for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::NONLIGHT)]) { if (nullptr != pRenderObject) @@ -481,10 +499,12 @@ void CRenderer::Render_NonLight() } m_RenderObjects[ENUM_CLASS(RENDER::NONLIGHT)].clear(); + COMPUTE_TIMEDELTA("Timer_Render_NonLight"); } void CRenderer::Render_Blur() { + COMPUTE_TIMEDELTA("Timer_Render_Blur"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Blur")))) { return; } @@ -531,10 +551,11 @@ void CRenderer::Render_Blur() { return; } - + COMPUTE_TIMEDELTA("Timer_Render_Blur"); } void CRenderer::Render_SSAO() { + COMPUTE_TIMEDELTA("Timer_Render_SSAO"); _uint iKernelSize = SSAO_SAMPLE_NUMBER; if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_SSAO_OCCLUSION")))) { @@ -619,9 +640,11 @@ void CRenderer::Render_SSAO() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_SSAO"); } void CRenderer::Render_SSAO_BLUR() { + COMPUTE_TIMEDELTA("Timer_Render_SSAO_BLUR"); if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_SSAO_BLUR")))) { return; } @@ -645,9 +668,11 @@ void CRenderer::Render_SSAO_BLUR() if (FAILED(m_pGameInstance->End_MRT())) { return; } + COMPUTE_TIMEDELTA("Timer_Render_SSAO_BLUR"); } void CRenderer::Render_Blend() { + COMPUTE_TIMEDELTA("Timer_Render_Blend"); m_RenderObjects[ENUM_CLASS(RENDER::BLEND)].sort([](CGameObject* pSour, CGameObject* pDest)->_bool { return pSour->Get_Depth() > pDest->Get_Depth(); }); @@ -665,10 +690,12 @@ void CRenderer::Render_Blend() } m_RenderObjects[ENUM_CLASS(RENDER::BLEND)].clear(); + COMPUTE_TIMEDELTA("Timer_Render_Blend"); } void CRenderer::Render_Bloom() { + COMPUTE_TIMEDELTA("Timer_Render_Bloom"); // "Target_Bloom_Input" // "Target_Bloom" // "Target_Bloom_2x2" @@ -726,11 +753,13 @@ void CRenderer::Render_Bloom() m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::UPSAMPLE); m_pGameInstance->Finish_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_Input"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::BLOOM_FINISH); // 9 - + + COMPUTE_TIMEDELTA("Timer_Render_Bloom"); } void CRenderer::Render_UI() { + COMPUTE_TIMEDELTA("Timer_Render_UI"); m_RenderObjects[ENUM_CLASS(RENDER::UI)].sort([](CGameObject* pDest, CGameObject* pSrc)->_bool { _float3 vDstPos = {}; _float3 vSrcPos = {}; @@ -753,10 +782,12 @@ void CRenderer::Render_UI() } m_RenderObjects[ENUM_CLASS(RENDER::UI)].clear(); + COMPUTE_TIMEDELTA("Timer_Render_UI"); } void CRenderer::Render_UI_Overley() { + COMPUTE_TIMEDELTA("Timer_Render_UI_Overley"); for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::UI_OVERLAY)]) { if (nullptr != pRenderObject) { @@ -768,11 +799,13 @@ void CRenderer::Render_UI_Overley() } m_RenderObjects[ENUM_CLASS(RENDER::UI_OVERLAY)].clear(); - + + COMPUTE_TIMEDELTA("Timer_Render_UI_Overley"); } void CRenderer::Render_LastColor() { + COMPUTE_TIMEDELTA("Timer_Render_LastColor"); // Bind_Resorces m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix); @@ -787,10 +820,12 @@ void CRenderer::Render_LastColor() m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); + COMPUTE_TIMEDELTA("Timer_Render_LastColor"); } void CRenderer::Render_Tone_Mapping() { + COMPUTE_TIMEDELTA("Timer_Render_Tone_Mapping"); { // BackBuffer ID3D11Texture2D* pBackBuffer = nullptr; m_pGameInstance->Get_BackBufferPTR(&pBackBuffer); @@ -820,6 +855,7 @@ void CRenderer::Render_Tone_Mapping() m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::TONE_MAPPING)); m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); + COMPUTE_TIMEDELTA("Timer_Render_Tone_Mapping"); } #ifdef _DEBUG diff --git a/Jusin154_Team3D/Engine/Private/Timer_Manager.cpp b/Jusin154_Team3D/Engine/Private/Timer_Manager.cpp index bf37e5007..135e69511 100644 --- a/Jusin154_Team3D/Engine/Private/Timer_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Timer_Manager.cpp @@ -44,6 +44,73 @@ HRESULT CTimer_Manager::Add_Timer(const _wstring& strTimerTag) return S_OK; } +HRESULT CTimer_Manager::Initialize() +{ +#ifdef _DEBUG + if (FAILED(Add_Timer(TEXT("Timer_Render_Priority")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Shadow")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_NonBlend")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_SSAO")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_SSAO_BLUR")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_LightAcc")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Blur")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Combined")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Occlusion")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_EnvironmentPostProcess")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Fog")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Effect")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_NonLight")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Blend")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_WeightBlend")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Bloom")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_LastColor")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_Tone_Mapping")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_UI")))) { + return E_FAIL; + } + if (FAILED(Add_Timer(TEXT("Timer_Render_UI_Overley")))) { + return E_FAIL; + } +#endif // _DEBUG + return S_OK; +} + CTimer* CTimer_Manager::Find_Timer(const _wstring& strTimerTag) { /*auto iter = find_if(m_mapTimer.begin(), m_mapTimer.end(), CTag_Finder(pTimerTag));*/ @@ -57,7 +124,15 @@ CTimer* CTimer_Manager::Find_Timer(const _wstring& strTimerTag) CTimer_Manager* CTimer_Manager::Create() { - return new CTimer_Manager(); + CTimer_Manager* pInstance = new CTimer_Manager(); + + if (FAILED(pInstance->Initialize())) + { + MSG_BOX("Failed to Created : CTimer_Manager"); + SAFE_RELEASE(pInstance); + } + + return pInstance; } void CTimer_Manager::Free() diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h index fe0830611..890a6ee23 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h @@ -8,7 +8,7 @@ #ifndef IMGUI_GLOBAL_BEGIN_FLAG #define IMGUI_GLOBAL_BEGIN_FLAG ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_NoBringToFrontOnFocus|ImGuiWindowFlags_AlwaysAutoResize #endif // IMGUI_GLOBAL_BEGIN_FLAG - +#define COMPUTE_TIMEDELTA(TIMER) m_pGameInstance->Compute_TimeDelta(TEXT(TIMER)) #ifndef PSX #define PSX physx diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 73cc0d71c..b061d9183 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -319,7 +319,27 @@ class ENGINE_DLL CGameInstance final : public CBase _float m_fTimer_PhysX = { 0.f }; _float m_fTimer_Level = { 0.f }; _float m_fTimer_FrameCount = { 0.f }; - + + _float m_fTimer_Render_Priority = { 0.f }; + _float m_fTimer_Render_Shadow = { 0.f }; + _float m_fTimer_Render_NonBlend = { 0.f }; + _float m_fTimer_Render_SSAO = { 0.f }; + _float m_fTimer_Render_SSAO_BLUR = { 0.f }; + _float m_fTimer_Render_LightAcc = { 0.f }; + _float m_fTimer_Render_Blur = { 0.f }; + _float m_fTimer_Render_Combined = { 0.f }; + _float m_fTimer_Render_Occlusion = { 0.f }; + _float m_fTimer_Render_EnvironmentPostProcess = { 0.f }; + _float m_fTimer_Render_Fog = { 0.f }; + _float m_fTimer_Render_Effect = { 0.f }; + _float m_fTimer_Render_NonLight = { 0.f }; + _float m_fTimer_Render_Blend = { 0.f }; + _float m_fTimer_Render_WeightBlend = { 0.f }; + _float m_fTimer_Render_Bloom = { 0.f }; + _float m_fTimer_Render_LastColor = { 0.f }; + _float m_fTimer_Render_Tone_Mapping = { 0.f }; + _float m_fTimer_Render_UI = { 0.f }; + _float m_fTimer_Render_UI_Overley = { 0.f }; vector m_FilePaths = {}; map m_ModelMap; diff --git a/Jusin154_Team3D/Engine/Public/Timer_Manager.h b/Jusin154_Team3D/Engine/Public/Timer_Manager.h index b6b5c7e1b..cf6009c29 100644 --- a/Jusin154_Team3D/Engine/Public/Timer_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Timer_Manager.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Base.h" @@ -21,6 +21,7 @@ class CTimer_Manager final : public CBase map m_Timers; private: + HRESULT Initialize(); class CTimer* Find_Timer(const _wstring& strTimerTag); public: @@ -28,4 +29,4 @@ class CTimer_Manager final : public CBase virtual void Free(); }; -NS_END \ No newline at end of file +NS_END