diff --git a/Jusin154_Team3D/Client/Default/Client.cpp b/Jusin154_Team3D/Client/Default/Client.cpp index 645376f63..e4cfc43ae 100644 --- a/Jusin154_Team3D/Client/Default/Client.cpp +++ b/Jusin154_Team3D/Client/Default/Client.cpp @@ -201,24 +201,24 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) g_hWnd = hWnd; -#ifndef _DEBUG - { - g_bFullscreen = true; - - SetWindowLong(g_hWnd, GWL_STYLE, GetWindowLong(g_hWnd, GWL_STYLE) & ~WS_OVERLAPPEDWINDOW); - - _int screenX = GetSystemMetrics(SM_CXSCREEN); - _int screenY = GetSystemMetrics(SM_CYSCREEN); - - SetWindowPos( - g_hWnd, - HWND_TOP, - 0, 0, - screenX, screenY, - SWP_NOOWNERZORDER | SWP_FRAMECHANGED - ); - } -#endif +//#ifndef _DEBUG +// { +// g_bFullscreen = true; +// +// SetWindowLong(g_hWnd, GWL_STYLE, GetWindowLong(g_hWnd, GWL_STYLE) & ~WS_OVERLAPPEDWINDOW); +// +// _int screenX = GetSystemMetrics(SM_CXSCREEN); +// _int screenY = GetSystemMetrics(SM_CYSCREEN); +// +// SetWindowPos( +// g_hWnd, +// HWND_TOP, +// 0, 0, +// screenX, screenY, +// SWP_NOOWNERZORDER | SWP_FRAMECHANGED +// ); +// } +//#endif return TRUE; diff --git a/Jusin154_Team3D/Client/Private/Broom.cpp b/Jusin154_Team3D/Client/Private/Broom.cpp index 09b6f7330..74c0a5c68 100644 --- a/Jusin154_Team3D/Client/Private/Broom.cpp +++ b/Jusin154_Team3D/Client/Private/Broom.cpp @@ -406,8 +406,9 @@ void CBroom::PlayerInput(_float fTimeDelta) m_Input.bTurbo = false; m_pInfoInstance->Event_CallBack(TEXT("BroomBooster"), &m_Input.bTurbo); } - +#ifndef DEBUG_SHADOW m_bTurbo = m_Input.bTurbo; +#endif // !DEBUG_SHADOW } void CBroom::Set_AISpeed(_float speedMul, _float accelMul) diff --git a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp index f2a64c767..79377c264 100644 --- a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp @@ -109,6 +109,7 @@ HRESULT CBroomRacerAI::Initialize(void* pArg) void CBroomRacerAI::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); __super::Priority_Update(fTimeDelta); } diff --git a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp index b39fc1128..a2c6bea6f 100644 --- a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp +++ b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp @@ -130,11 +130,18 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta) if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_SHOULDER))) { return; } -#ifdef _DEBUG - Describe_Entity(); -#endif // _DEBUG +#ifdef RELEASE_DEBUGGER + static _bool m_bRenderSystem = false; + if (m_pGameInstance->Key_Up(DIK_F6)) { + m_bRenderSystem = !m_bRenderSystem; + } + if (true == m_bRenderSystem) { + Describe_Entity(); + } +#endif // RELEASE_DEBUGGER #ifndef _DEBUG +#ifndef DEBUG_CAMERAS if (dynamic_cast(m_pOwner)->Get_UIState() == UI_STATE::GAMEPLAYER) { m_bMovable = true; @@ -142,6 +149,7 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta) else { m_bMovable = false; } +#endif // DEBUG_CAMERAS #endif // _DEBUG if (m_pGameInstance->Key_Up(DIK_PGDN)) { @@ -207,10 +215,33 @@ void CCamPosition_Shoulder::Late_Update(_float fTimeDelta) } m_pGameInstance->Add_RenderGroup(RENDER::UI_OVERLAY, this); } +#ifdef DEBUG_CAMERAS + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); +#endif // DEBUG_CAMERAS } HRESULT CCamPosition_Shoulder::Render() { + RENDER eType = m_pGameInstance->Get_CurrentRenderPass(); + if (RENDER::NONLIGHT == eType) { +#ifdef DEBUG_CAMERAS + m_Batch->Begin(); + _matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + _matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + _vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x0000ff, 1.f); + if (m_bRenderLookPos) { + m_pSubShape->Draw(m_pLookTransform->Get_XMWorldMatrix(), ViewMatrix, ProjMatrix, vColor, nullptr, true); + } + if (m_bRenderHeadPos) { + vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0xff0000, 1.f); + _vector vDestPos = Calc_DampingParentPos(); + _vector vHeadPos = vDestPos + XMVectorSet(0.f, m_fHeadHeight, 0.f, 0.f); + m_pSubShape->Draw(XMMatrixTranslationFromVector(vHeadPos), ViewMatrix, ProjMatrix, vColor, nullptr, true); + } + m_Batch->End(); +#endif // DEBUG_CAMERAS + + } return S_OK; } @@ -278,7 +309,23 @@ _vector CCamPosition_Shoulder::Calc_BestPosition(_fvector vCastingPosition, _gve _bool bHit = m_pGameInstance->SphereCast(0.25f, vCastingPosition, vCastingDirection, fZeroSafeDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eSTATIC/*|PSX::PxQueryFlag::eDYNAMIC*/, m_BufferHit); + // 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋 + + static _float fCameraSurfaceOffset = 0.20f; // 높이면 카메라가 벽으로부터 좀 더 안정적으로 띄워지지만 벽에 바짝 붙은 플레이어를 감당불가 + static _float fCameraMinDistance = 0.71f; // 높이면 + +#ifdef DEBUG_CAMERAS + GUI::Begin("CAMERA"); + if (GUI::TreeNode("MinSurfaceOffset")) { + GUI::DragFloat("fMinDistance", &fCameraMinDistance, 0.01f, 0.01f, 1.f); + GUI::DragFloat("fSurfaceOffset", &fCameraSurfaceOffset, 0.01f, 0.01f, 1.f); + GUI::TreePop(); + } + GUI::End(); +#endif // DEBUG_CAMERAS + if (false == bHit) { + m_fFocalRatioTargetValue = m_vFocalRatio.y; return vCastingPosition + vCastingDirection * fZeroSafeDistance; } @@ -299,20 +346,6 @@ _vector CCamPosition_Shoulder::Calc_BestPosition(_fvector vCastingPosition, _gve } CMyTools::SortHitsByDistance(sweepHits); - // 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋 - - static _float fCameraSurfaceOffset = 0.20f; // 높이면 카메라가 벽으로부터 좀 더 안정적으로 띄워지지만 벽에 바짝 붙은 플레이어를 감당불가 - static _float fCameraMinDistance = 0.71f; // 높이면 - -#ifdef _DEBUG - GUI::Begin("CAMERA"); - if (GUI::TreeNode("MinSurfaceOffset")) { - GUI::DragFloat("fCameraMinDistance", &fCameraMinDistance, 0.01f, 0.01f, 1.f); - GUI::DragFloat("fCameraSurfaceOffset", &fCameraSurfaceOffset, 0.01f, 0.01f, 1.f); - GUI::TreePop(); - } - GUI::End(); -#endif // _DEBUG _float fDistance = { }; _float fFinalTargetDistance = fZeroSafeDistance; @@ -468,6 +501,10 @@ HRESULT CCamPosition_Shoulder::Ready_SubParts() return E_FAIL; } +#ifdef DEBUG_CAMERAS + m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.25f, 12, false, false)); + m_Batch = make_unique>(m_pContext); +#endif // DEBUG_CAMERAS return S_OK; } @@ -503,7 +540,7 @@ void CCamPosition_Shoulder::Free() SAFE_RELEASE(m_pTarget_LookPart); SAFE_RELEASE(m_pTarget_FollowPart); } -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER void CCamPosition_Shoulder::Describe_Entity() { @@ -512,16 +549,22 @@ void CCamPosition_Shoulder::Describe_Entity() m_pTransformCom->Describe_Entity(); GUI::PushItemWidth(IMGUI_GLOBAL_ITEM_WIDTH); GUI::Text("fMouseSensor : %.1f", m_fMouseSensor); - GUI::SliderFloat("m_fFollowTargetIncludedAngleDegree", &m_fFollowTargetIncludedAngleDegree, -360.f, 360.f, "%.1f"); - GUI::SliderFloat("m_fDefaultCameraBackToFrontRatio", &m_fDefaultCameraBackToFrontRatio, -1.f, 1.f); - GUI::SliderFloat("m_vFocalRatio", &m_vFocalRatio.x, 0.f, 1.f); - GUI::SliderFloat("m_fCameraFowardDistance", &m_fCameraFowardDistance, 0.f, 4.f); - GUI::Text("%.2f", XMConvertToDegrees(m_pBinded_Camera->Get_Fov())); + GUI::SliderFloat("FollowTarget_IncludedAngle", &m_fFollowTargetIncludedAngleDegree, -360.f, 360.f, "%.1f"); + GUI::SliderFloat("CameraBackToFrontRatio", &m_fDefaultCameraBackToFrontRatio, -1.f, 1.f); + GUI::SliderFloat("FocalRatio", &m_vFocalRatio.x, 0.f, 1.f); + GUI::SliderFloat("CameraFowardDistance", &m_fCameraFowardDistance, 0.f, 4.f); + GUI::Text("FOV %.2f", XMConvertToDegrees(m_pBinded_Camera->Get_Fov())); +#ifdef DEBUG_CAMERAS + GUI::Checkbox("RenderLookPos", &m_bRenderLookPos); + GUI::Checkbox("RenderHeadPos", &m_bRenderHeadPos); +#endif // DEBUG_CAMERAS + +#ifdef _DEBUG GUI::Text("%d", m_bSpellFovLerp); - GUI::SliderFloat3("m_vSpellFovLerpTimer", (_float*)&m_vSpellFovLerpTimer, 0.f, 5.f); - GUI::SliderFloat3("m_vSpellFovLerpDegree", (_float*)&m_vSpellFovLerpDegree, 1.f, 60.f); - - + GUI::SliderFloat3("m_vSpellFovLerpTimer", (_float*)&m_vSpellFovLerpTimer, 0.f, 5.f); + GUI::SliderFloat3("m_vSpellFovLerpDegree", (_float*)&m_vSpellFovLerpDegree, 1.f, 60.f); + + if (GUI::TreeNode("AnimList")) { for (_int i = 0; i < m_pModelCom->Get_AnimSize(); i++) { @@ -534,9 +577,10 @@ void CCamPosition_Shoulder::Describe_Entity() GUI::TreePop(); } +#endif // _DEBUG m_pBinded_Camera->Describe_Entity(); } GUI::End(); } -#endif // _DEBUG +#endif // RELEASE_DEBUGGER diff --git a/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp index 9203fcdb8..4b4155718 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Cinematic.cpp @@ -44,18 +44,13 @@ void CCamera_Cinematic::Update(_float fTimeDelta) } void CCamera_Cinematic::Late_Update(_float fTimeDelta) { - if (false == m_bActive) { -#ifdef _DEBUG - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); -#endif // _DEBUG - return; - } - else { - } +#ifdef DEBUG_CAMERAS + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this); +#endif // DEBUG_CAMERAS } HRESULT CCamera_Cinematic::Render() { -#ifdef _DEBUG +#ifdef DEBUG_CAMERAS if (FAILED(Bind_ShaderResources())) { return E_FAIL; } @@ -96,7 +91,7 @@ HRESULT CCamera_Cinematic::Render() { } -#endif // _DEBUG +#endif // DEBUG_CAMERAS return S_OK; } @@ -253,11 +248,11 @@ HRESULT CCamera_Cinematic::Initialize(void* pArg) } -#ifdef _DEBUG +#ifdef DEBUG_CAMERAS m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.25f, 12, false, false)); m_Batch = make_unique>(m_pContext); -#endif // _DEBUG +#endif // DEBUG_CAMERAS return S_OK; } HRESULT CCamera_Cinematic::Ready_Components(void* pArg) @@ -265,7 +260,7 @@ HRESULT CCamera_Cinematic::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(pArg))) { return E_FAIL; } -#ifdef _DEBUG +#ifdef DEBUG_CAMERAS if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Camera_Model"), reinterpret_cast(&m_pModelCom)))) { return E_FAIL; @@ -276,7 +271,7 @@ HRESULT CCamera_Cinematic::Ready_Components(void* pArg) reinterpret_cast(&m_pShaderCom)))) { return E_FAIL; } -#endif // _DEBUG +#endif // DEBUG_CAMERAS return S_OK; } @@ -299,7 +294,7 @@ HRESULT CCamera_Cinematic::Ready_SubPart() HRESULT CCamera_Cinematic::Bind_ShaderResources() { -#ifdef _DEBUG +#ifdef DEBUG_CAMERAS if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { return E_FAIL; } @@ -312,7 +307,7 @@ HRESULT CCamera_Cinematic::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { return E_FAIL; } -#endif // _DEBUG +#endif // DEBUG_CAMERAS return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Camera_Debug.cpp b/Jusin154_Team3D/Client/Private/Camera_Debug.cpp index 5abde5a7a..65cda0757 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Debug.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Debug.cpp @@ -93,9 +93,11 @@ void CCamera_Debug::Priority_Update(_float fTimeDelta) void CCamera_Debug::Update(_float fTimeDelta) { -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER +#ifdef DEBUG_CAMERAS Describe_Entity(); -#endif // _DEBUG +#endif // DEBUG_CAMERAS +#endif // RELEASE_DEBUGGER } void CCamera_Debug::Late_Update(_float fTimeDelta) @@ -183,11 +185,12 @@ void CCamera_Debug::Free() { __super::Free(); } -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER void CCamera_Debug::Describe_Entity() { _float3 vPosition = {}; +#ifdef _DEBUG GUI::Begin("PickingPos"); if (m_pGameInstance->Key_Pressing(DIK_Y)) { @@ -197,6 +200,7 @@ void CCamera_Debug::Describe_Entity() } } GUI::End(); +#endif // _DEBUG GUI::Begin("CAMERA"); _int iPriority = m_iPriority; size_t iAddress = (size_t)this; @@ -214,4 +218,4 @@ void CCamera_Debug::Describe_Entity() GUI::End(); } -#endif // _DEBUG +#endif // RELEASE_DEBUGGER diff --git a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp index 07388152a..8d8958637 100644 --- a/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp +++ b/Jusin154_Team3D/Client/Private/Camera_Gaze.cpp @@ -53,10 +53,6 @@ void CCamera_Gaze::Update(_float fTimeDelta) } Transition(fTimeDelta); Update_LerpTimer(fTimeDelta); -#ifdef _DEBUG - Describe_Entity(); -#endif // _DEBUG - } void CCamera_Gaze::Update_LerpTimer(Engine::_float fTimeDelta) @@ -242,7 +238,7 @@ void CCamera_Gaze::Free() __super::Free(); } -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER void CCamera_Gaze::Describe_Entity() { @@ -259,32 +255,31 @@ void CCamera_Gaze::Describe_Entity() m_fFovy = XMConvertToRadians(fFovYDegree); } m_pTransformCom->Describe_Entity(); - GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z); - GUI::Text("LOOK_DST %.2f, %.2f, %.2f", m_vLookPos_Dest.x, m_vLookPos_Dest.y, m_vLookPos_Dest.z); - GUI::Text("FOLLOW_SRC %.2f, %.2f, %.2f", m_vFollowPos_Src.x, m_vFollowPos_Src.y, m_vFollowPos_Src.z); - GUI::Text("FOLLOW_DST %.2f, %.2f, %.2f", m_vFollowPos_Dest.x, m_vFollowPos_Dest.y, m_vFollowPos_Dest.z); + //GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z); + //GUI::Text("LOOK_DST %.2f, %.2f, %.2f", m_vLookPos_Dest.x, m_vLookPos_Dest.y, m_vLookPos_Dest.z); + //GUI::Text("FOLLOW_SRC %.2f, %.2f, %.2f", m_vFollowPos_Src.x, m_vFollowPos_Src.y, m_vFollowPos_Src.z); + //GUI::Text("FOLLOW_DST %.2f, %.2f, %.2f", m_vFollowPos_Dest.x, m_vFollowPos_Dest.y, m_vFollowPos_Dest.z); - GUI::DragFloat2("VerticalAngle", (_float*)&m_vAccRotDegree_VerticalLocks, 1.f, 0.f, 89.f); - GUI::Checkbox("TransitionLerp", &m_bEnable_TransitionLerp); - if (true == m_bEnable_TransitionLerp) { - GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vTransitionTime.x, m_vTransitionTime.y); - GUI::SliderFloat("TranslationTime", &m_vTransitionTime.y, 0.1f, 3.f, "%.1f"); - } + //GUI::DragFloat2("VerticalAngle", (_float*)&m_vAccRotDegree_VerticalLocks, 1.f, 0.f, 89.f); + //GUI::Checkbox("TransitionLerp", &m_bEnable_TransitionLerp); + //if (true == m_bEnable_TransitionLerp) { + // GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vTransitionTime.x, m_vTransitionTime.y); + // GUI::SliderFloat("TranslationTime", &m_vTransitionTime.y, 0.1f, 3.f, "%.1f"); + //} - GUI::Checkbox("LookLerp", &m_bEnable_LookLerp); - if (true == m_bEnable_LookLerp) { - GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vLookLerpTime.x, m_vLookLerpTime.y); - GUI::SliderFloat("LookTime", &m_vLookLerpTime.y, 0.1f, 3.f, "%.1f"); - } - - GUI::Checkbox("FollowLerp", &m_bEnable_FollowLerp); - if (true == m_bEnable_FollowLerp) { - GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vFollowLerpTime.x, m_vFollowLerpTime.y); - GUI::SliderFloat("FollowTime", &m_vFollowLerpTime.y, 0.1f, 3.f, "%.1f"); - } + //GUI::Checkbox("LookLerp", &m_bEnable_LookLerp); + //if (true == m_bEnable_LookLerp) { + // GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vLookLerpTime.x, m_vLookLerpTime.y); + // GUI::SliderFloat("LookTime", &m_vLookLerpTime.y, 0.1f, 3.f, "%.1f"); + //} + //GUI::Checkbox("FollowLerp", &m_bEnable_FollowLerp); + //if (true == m_bEnable_FollowLerp) { + // GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vFollowLerpTime.x, m_vFollowLerpTime.y); + // GUI::SliderFloat("FollowTime", &m_vFollowLerpTime.y, 0.1f, 3.f, "%.1f"); + //} } GUI::End(); } -#endif // _DEBUG +#endif // RELEASE_DEBUGGER diff --git a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp index e2c697866..036545324 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp @@ -50,6 +50,7 @@ void CGoblin_BattleAxe::Priority_Update(_float fTimeDelta) XMStoreFloat4(&m_vStartGripPos, Get_WorldPostion()); } + m_pTransformCom->RewindMomentum(); m_pModelCom->Combined_BoneMatrix(); _matrix socketMatrix = {}; @@ -106,7 +107,10 @@ HRESULT CGoblin_BattleAxe::Render() return S_OK; } - + _float Intensity = 1.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } if (FAILED(Bind_ShaderResources())) { return E_FAIL; } @@ -144,6 +148,10 @@ HRESULT CGoblin_BattleAxe::Render() m_pGripShape->Draw(m_pTransformCom->Get_XMWorldMatrix(), m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), DirectX::Colors::Green, nullptr, true); m_pSubShape->Draw(XMLoadFloat4x4(&m_vAxeMat), m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), DirectX::Colors::Purple, nullptr, true); #endif // _DEBUG + Intensity = 0.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp b/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp index 2748120f7..90a203c84 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Dagger.cpp @@ -38,6 +38,7 @@ HRESULT CGoblin_Dagger::Initialize(void* pArg) void CGoblin_Dagger::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); XMStoreFloat4(&m_vStartPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pModelCom->Combined_BoneMatrix(); if (m_bAttach) @@ -89,7 +90,10 @@ HRESULT CGoblin_Dagger::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } - + _float Intensity = 1.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); for (_uint i = 0; i < iNumMeshes; i++) @@ -98,7 +102,7 @@ HRESULT CGoblin_Dagger::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { return E_FAIL; } @@ -106,7 +110,10 @@ HRESULT CGoblin_Dagger::Render() return E_FAIL; } } - + Intensity = 0.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp b/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp index 2a9dc3329..3bacf755c 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Sword.cpp @@ -39,6 +39,7 @@ HRESULT CGoblin_Sword::Initialize(void* pArg) void CGoblin_Sword::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); m_pModelCom->Combined_BoneMatrix(); XMStoreFloat4(&m_vStartPos, m_pTransformCom->Get_State(STATE::POSITION)); @@ -95,7 +96,11 @@ HRESULT CGoblin_Sword::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } - + + _float Intensity = 1.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } if (FAILED(Render_Disolve())) { return E_FAIL; } @@ -124,6 +129,10 @@ HRESULT CGoblin_Sword::Render() m_pShaderCom->Bind_RawValue("g_fDisolveRatio", &zero, sizeof(_float)); } + Intensity = 0.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Item_Potion.cpp b/Jusin154_Team3D/Client/Private/Item_Potion.cpp index 15297f757..fc88852e4 100644 --- a/Jusin154_Team3D/Client/Private/Item_Potion.cpp +++ b/Jusin154_Team3D/Client/Private/Item_Potion.cpp @@ -128,7 +128,7 @@ HRESULT CItem_Potion::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { return E_FAIL; } @@ -140,8 +140,6 @@ HRESULT CItem_Potion::Render() #ifdef _DEBUG m_pRigidBody->Render(); #endif // _DEBUG - - return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Level_Field.cpp b/Jusin154_Team3D/Client/Private/Level_Field.cpp index dc6fa79c8..80c3191ca 100644 --- a/Jusin154_Team3D/Client/Private/Level_Field.cpp +++ b/Jusin154_Team3D/Client/Private/Level_Field.cpp @@ -222,7 +222,7 @@ HRESULT CLevel_Field::Ready_Camera() Camera_Desc.pCameraKey = CAMERA_DEBUG; Camera_Desc.fRotationPerSec = XMConvertToRadians(90.0f); Camera_Desc.fMouseSensor = 0.1f; - Camera_Desc.iPriority = 53; + Camera_Desc.iPriority = 52; Camera_Desc.pFollowTarget = { nullptr }; Camera_Desc.pLookTarget = { nullptr }; @@ -246,7 +246,7 @@ HRESULT CLevel_Field::Ready_Camera() Camera_Desc.fNear = 0.1f; Camera_Desc.fFar = 500.f; Camera_Desc.pCameraKey = CAMERA_CINEMATIC; - Camera_Desc.iPriority = 52; + Camera_Desc.iPriority = 53; Camera_Desc.bEnableTransitionLerp = false; Camera_Desc.bEnableLookLerp = false; Camera_Desc.bEnableFollowLerp = false; diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index 3385fb2e5..e876d95ca 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -227,9 +227,13 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta) else if (SUCCEEDED(InputSpell())) { m_pFSM->Change_State(FSMSTATE::COMBAT); } +#ifndef DEBUG_SHADOW +#ifndef DEBUG_CAMERAS else if (m_pGameInstance->Mouse_Down(DIM_LBUTTON)) { m_pFSM->Change_State(FSMSTATE::COMBAT); } +#endif // !DEBUG_CAMERAS +#endif // !DEBUG_SHADOW else if (m_pGameInstance->Key_Down(DIK_V)) { m_pFSM->Change_State(FSMSTATE::COMBAT); } diff --git a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp index 098cc7ba6..bee5b2100 100644 --- a/Jusin154_Team3D/Client/Private/Troll_Rock.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_Rock.cpp @@ -45,7 +45,6 @@ HRESULT CTroll_Rock::Initialize(void* pArg) void CTroll_Rock::Priority_Update(_float fTimeDelta) { - XMStoreFloat4(&m_vStartPos, m_pTransformCom->Get_State(STATE::POSITION)); m_pModelCom->Combined_BoneMatrix(); if (m_bAttach) @@ -206,7 +205,7 @@ HRESULT CTroll_Rock::Render() return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { return E_FAIL; } @@ -248,15 +247,6 @@ HRESULT CTroll_Rock::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_Matrix("g_PrevWorldMatrix", m_pTransformCom->Get_PrevWorldMatrixPtr()))) { - return E_FAIL; - } - if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevViewMatrix", D3DTS::VIEW))) { - return E_FAIL; - } - if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevProjMatrix", D3DTS::PROJ))) { - return E_FAIL; - } if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp b/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp index af1c240dd..51740bacc 100644 --- a/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_Weapon.cpp @@ -55,6 +55,7 @@ HRESULT CTroll_Weapon::Initialize(void* pArg) void CTroll_Weapon::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); m_pModelCom->Combined_BoneMatrix(); _matrix socketMatrix = {}; diff --git a/Jusin154_Team3D/Client/Private/Wand.cpp b/Jusin154_Team3D/Client/Private/Wand.cpp index 86ac3c640..c1ab07d41 100644 --- a/Jusin154_Team3D/Client/Private/Wand.cpp +++ b/Jusin154_Team3D/Client/Private/Wand.cpp @@ -44,6 +44,7 @@ HRESULT CWand::Initialize(void* pArg) void CWand::Priority_Update(_float fTimeDelta) { + m_pTransformCom->RewindMomentum(); m_pModelCom->Combined_BoneMatrix(); #ifdef _DEBUG Describe_Entity(); diff --git a/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h b/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h index 86abf3096..846cedb3e 100644 --- a/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h +++ b/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h @@ -96,15 +96,20 @@ class CCamPosition_Shoulder final : public CCamPosition CCamPosition_Target* m_pTarget_FollowPart = { nullptr }; class CCamera_Gaze* m_pBinded_Camera = { nullptr }; class CModel* m_pModelCom = { nullptr }; - +#ifdef DEBUG_CAMERAS + unique_ptr m_pSubShape = { nullptr }; + unique_ptr> m_Batch = { nullptr }; + _bool m_bRenderHeadPos = { false }; + _bool m_bRenderLookPos = { false }; +#endif // DEBUG_CAMERAS public: static CCamPosition_Shoulder* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CCamPosition_Shoulder* Clone(void* pArg, class CGameObject* pOWner) override; virtual void Free() override; -#ifdef _DEBUG - void Describe_Entity() override; -#endif // _DEBUG +#ifdef RELEASE_DEBUGGER + void Describe_Entity(); +#endif // RELEASE_DEBUGGER }; diff --git a/Jusin154_Team3D/Client/Public/Camera_Cinematic.h b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h index d4f2c963e..294670d9e 100644 --- a/Jusin154_Team3D/Client/Public/Camera_Cinematic.h +++ b/Jusin154_Team3D/Client/Public/Camera_Cinematic.h @@ -91,12 +91,12 @@ class CCamera_Cinematic final : public CCamera _float2 m_vCameraShakeTimer = { 0.f, TIMER_SHORT_LERP }; _float m_fCameraShakeTime = TIMER_SHORT_LERP; _float m_fCameraShakeIntense = 5.f; -#ifdef _DEBUG +#ifdef DEBUG_CAMERAS unique_ptr m_pSubShape = { nullptr }; unique_ptr> m_Batch = { nullptr }; class CModel* m_pModelCom = { nullptr }; class CShader* m_pShaderCom = { nullptr }; -#endif // _DEBUG +#endif // DEBUG_CAMERAS public: static CCamera_Cinematic* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Client/Public/Camera_Debug.h b/Jusin154_Team3D/Client/Public/Camera_Debug.h index d1cb8c255..239652c70 100644 --- a/Jusin154_Team3D/Client/Public/Camera_Debug.h +++ b/Jusin154_Team3D/Client/Public/Camera_Debug.h @@ -40,9 +40,9 @@ class CCamera_Debug final : public CCamera static CCamera_Debug* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, CGameObject* pOwner) override; virtual void Free() override; -#ifdef _DEBUG - void Describe_Entity() override; -#endif // _DEBUG +#ifdef RELEASE_DEBUGGER + void Describe_Entity(); +#endif // RELEASE_DEBUGGER }; diff --git a/Jusin154_Team3D/Client/Public/Camera_Gaze.h b/Jusin154_Team3D/Client/Public/Camera_Gaze.h index 3c0ea2ae3..85baaac3b 100644 --- a/Jusin154_Team3D/Client/Public/Camera_Gaze.h +++ b/Jusin154_Team3D/Client/Public/Camera_Gaze.h @@ -48,10 +48,10 @@ class CCamera_Gaze final : public CCamera virtual void Free() override; -#ifdef _DEBUG - void Describe_Entity() override; +#ifdef RELEASE_DEBUGGER + void Describe_Entity(); -#endif // _DEBUG +#endif // RELEASE_DEBUGGER }; NS_END 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 0da4db10c..c79b70c69 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -323,21 +323,36 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv) } // BackGround ForeGround 합은 1 -float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale) +float2 ComputeDepthWeights(float fCenterDepth, float fSampleDepth, float fDepthScale) { - return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth)); -} + float delta = fSampleDepth - fCenterDepth; -float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale) + // backgroundWeight: sample이 더 멀수록 증가 + float backgroundWeight = saturate(0.5f + fDepthScale * delta); + float foregroundWeight = 1.0f - backgroundWeight; + + return float2(backgroundWeight, foregroundWeight); +} +float ComputeSpreadWeight(float fOffsetLength, float fSpreadLength, float fPixelToSampleUnitsScale) { return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f); } - -float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale) +// fCenterDepth : 현재 중심 픽셀의 깊이 +// fSampleDepth : 샘플 픽셀의 깊이 +// fOffsetLength : 중심에서 샘플까지의 거리 +// fCenterSpreadLength : 중심 픽셀의 블러 반경 +// fSampleSpreadLength : 샘플 픽셀의 블러 반경 +// fPixelToSampleUnitsScale : spread/offset 단위 +// fDepthScale : 깊이 차이에 얼마나 민감하게 전경/배경을 나눌지 +float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, + float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale) { - float2 vDepthCompare = DepthCompare(fCenterDepth, fSampleDepth, fDepthScale); - float2 vSpreadCompare = SpreadCompare(fOffsetLength, float2(fCenterSpreadLength, fSampleSpreadLength), fPixelToSampleUnitsScale); - return dot(vDepthCompare, vSpreadCompare); + float2 vDepthCompare = ComputeDepthWeights(fCenterDepth, fSampleDepth, fDepthScale); + + float fSpreadCenter = ComputeSpreadWeight(fOffsetLength, fCenterSpreadLength, fPixelToSampleUnitsScale); + float fSpreadSample = ComputeSpreadWeight(fOffsetLength, fSampleSpreadLength, fPixelToSampleUnitsScale); + + return vDepthCompare.x * fSpreadCenter + vDepthCompare.y * fSpreadSample; } float4x4 RotateX(float fAngle) 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 f21518030..f5deeeaa4 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli @@ -48,7 +48,6 @@ sampler BorderZeroSampler = sampler_state AddressV = Border; BorderColor = float4(0.f, 0.f, 0.f, 0.f); }; - sampler BorderZeroLinearSampler = sampler_state { Filter = MIN_MAG_MIP_LINEAR; @@ -65,7 +64,7 @@ sampler BorderOneSampler = sampler_state BorderColor = float4(1.f, 1.f, 1.f, 1.f); }; -sampler SsaoDataSampler = sampler_state +sampler SSAODataSampler = sampler_state { Filter = MIN_MAG_MIP_POINT; AddressU = wrap; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 6afe94c97..4a8d7c9cb 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -50,6 +50,7 @@ float g_fSpotOuterAngle; float g_fToneMappingExposure; uint g_iToneMappingType; bool g_bUsePowerLightAttenuation; +bool g_bUsePhongShader; float g_fLightAttenuationPower; vector g_vLightDir; @@ -218,8 +219,8 @@ struct PS_OUT_BACKBUFFER }; struct PS_OUT_DEBUG_MOTIONBLUR { - float3 vBaseMotionBlur : SV_TARGET0; - float3 vTentMotionBlur : SV_Target1; + float4 vBaseMotionBlur : SV_TARGET0; + float4 vTentMotionBlur : SV_Target1; }; struct PS_OUT_LIGHT { @@ -482,6 +483,11 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 float3 vToLight = normalize(-g_vLightDir.xyz); // 픽셀에서 라이트로 + if (g_bUsePhongShader) + { + vDepth.b = 0.f; + } + if (false == CalcLighting(g_SurfaceTexture, vDepth.b, uv, vAlbedo, vF0, fMetallic, fRoughness, fOcclusion, fAttenuation)) { Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)); @@ -726,26 +732,35 @@ PS_OUT_DEBUG_MOTIONBLUR PS_MAIN_DEBUG_MOTIONBLUR_INTENSE(PS_IN In) { PS_OUT_DEBUG_MOTIONBLUR Out; - float2 vBase = g_VelocityTexture.Sample(DefaultSampler, In.vTexcoord).xy * 2.f - 1.f; - float2 vTent = g_TileVelocityTexture.Sample(DefaultSampler, In.vTexcoord).xy * 2.f - 1.f; + float2 vBase = g_VelocityTexture.Sample(ClampSampler, In.vTexcoord).xy * 2.f - 1.f; + float2 vTent = g_TileVelocityTexture.Sample(ClampSampler, In.vTexcoord).xy * 2.f - 1.f; vBase *= 25.5f; vTent *= 25.5f; Out.vBaseMotionBlur.xy = vBase * 0.5f + 0.5f; Out.vBaseMotionBlur.z = 0.f; + Out.vBaseMotionBlur.w = 1.f; Out.vTentMotionBlur.xy = vTent * 0.5f + 0.5f; Out.vTentMotionBlur.z = 0.f; + Out.vTentMotionBlur.w = 1.f; if (AlmostEqual5(vBase.x, 0.f) && AlmostEqual5(vBase.y, 0.f)) { - Out.vBaseMotionBlur = float3(1.f, 1.f, 1.f); + Out.vBaseMotionBlur = float4(1.f, 1.f, 1.f, 1.f); } if (AlmostEqual5(vTent.x, 0.f) && AlmostEqual5(vTent.y, 0.f)) { - Out.vTentMotionBlur = float3(1.f, 1.f, 1.f); + Out.vTentMotionBlur = float4(1.f, 1.f, 1.f, 1.f); } return Out; }; - +PS_OUT_BACKBUFFER PS_MAIN_DEBUG_RtoRGBA(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + Out.vBackBuffer = g_VelocityTexture.Sample(DefaultSampler, In.vTexcoord).xxxx; + Out.vEnvironment = g_TileVelocityTexture.Sample(DefaultSampler, In.vTexcoord).xxxx; + Out.vEnvironment.a = Out.vBackBuffer.a = 1.f; + return Out; +}; PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) { PS_OUT_BACKBUFFER Out; @@ -1297,20 +1312,20 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In) return Out; } float4 vCenterViewPosition; - { + { // 센터 뷰스페이스 포지션 복원 vCenterViewPosition.x = uv.x * 2.f - 1.f; vCenterViewPosition.y = uv.y * -2.f + 1.f; vCenterViewPosition.z = vDepthDesc.x; vCenterViewPosition.w = 1.f; vCenterViewPosition *= fCenterViewSpaceZ; vCenterViewPosition = mul(vCenterViewPosition, g_invmatProj); - vCenterViewPosition /= vCenterViewPosition.w; + vCenterViewPosition /= vCenterViewPosition.w; } float3 vNormal = normalize(g_NormalTexture.Sample(PointSampler, uv).xyz * 2.f - 1.f); float3 vCenterViewNormal = mul(vNormal, (float3x3)g_ViewMatrix); float2 vNoiseScale = g_vResolution / 4.f; - float3 vNoise = g_SSAONoiseTexture.Sample(SsaoDataSampler, uv * vNoiseScale).xyz; + float3 vNoise = g_SSAONoiseTexture.Sample(SSAODataSampler, uv * vNoiseScale).xyz; float3 vTangent = normalize(vNoise - vCenterViewNormal * dot(vNoise, vCenterViewNormal)); float3 vBiNormal = cross(vCenterViewNormal, vTangent); @@ -1602,4 +1617,13 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_DEBUG_MOTIONBLUR_INTENSE(); } + pass DEBUG_RtoRGBA // 24 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + + PixelShader = compile ps_5_0 PS_MAIN_DEBUG_RtoRGBA(); + } } 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 0da4db10c..c79b70c69 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -323,21 +323,36 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv) } // BackGround ForeGround 합은 1 -float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale) +float2 ComputeDepthWeights(float fCenterDepth, float fSampleDepth, float fDepthScale) { - return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth)); -} + float delta = fSampleDepth - fCenterDepth; -float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale) + // backgroundWeight: sample이 더 멀수록 증가 + float backgroundWeight = saturate(0.5f + fDepthScale * delta); + float foregroundWeight = 1.0f - backgroundWeight; + + return float2(backgroundWeight, foregroundWeight); +} +float ComputeSpreadWeight(float fOffsetLength, float fSpreadLength, float fPixelToSampleUnitsScale) { return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f); } - -float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale) +// fCenterDepth : 현재 중심 픽셀의 깊이 +// fSampleDepth : 샘플 픽셀의 깊이 +// fOffsetLength : 중심에서 샘플까지의 거리 +// fCenterSpreadLength : 중심 픽셀의 블러 반경 +// fSampleSpreadLength : 샘플 픽셀의 블러 반경 +// fPixelToSampleUnitsScale : spread/offset 단위 +// fDepthScale : 깊이 차이에 얼마나 민감하게 전경/배경을 나눌지 +float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, + float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale) { - float2 vDepthCompare = DepthCompare(fCenterDepth, fSampleDepth, fDepthScale); - float2 vSpreadCompare = SpreadCompare(fOffsetLength, float2(fCenterSpreadLength, fSampleSpreadLength), fPixelToSampleUnitsScale); - return dot(vDepthCompare, vSpreadCompare); + float2 vDepthCompare = ComputeDepthWeights(fCenterDepth, fSampleDepth, fDepthScale); + + float fSpreadCenter = ComputeSpreadWeight(fOffsetLength, fCenterSpreadLength, fPixelToSampleUnitsScale); + float fSpreadSample = ComputeSpreadWeight(fOffsetLength, fSampleSpreadLength, fPixelToSampleUnitsScale); + + return vDepthCompare.x * fSpreadCenter + vDepthCompare.y * fSpreadSample; } float4x4 RotateX(float fAngle) 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 f21518030..f5deeeaa4 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli @@ -48,7 +48,6 @@ sampler BorderZeroSampler = sampler_state AddressV = Border; BorderColor = float4(0.f, 0.f, 0.f, 0.f); }; - sampler BorderZeroLinearSampler = sampler_state { Filter = MIN_MAG_MIP_LINEAR; @@ -65,7 +64,7 @@ sampler BorderOneSampler = sampler_state BorderColor = float4(1.f, 1.f, 1.f, 1.f); }; -sampler SsaoDataSampler = sampler_state +sampler SSAODataSampler = sampler_state { Filter = MIN_MAG_MIP_POINT; AddressU = wrap; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 6afe94c97..4a8d7c9cb 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -50,6 +50,7 @@ float g_fSpotOuterAngle; float g_fToneMappingExposure; uint g_iToneMappingType; bool g_bUsePowerLightAttenuation; +bool g_bUsePhongShader; float g_fLightAttenuationPower; vector g_vLightDir; @@ -218,8 +219,8 @@ struct PS_OUT_BACKBUFFER }; struct PS_OUT_DEBUG_MOTIONBLUR { - float3 vBaseMotionBlur : SV_TARGET0; - float3 vTentMotionBlur : SV_Target1; + float4 vBaseMotionBlur : SV_TARGET0; + float4 vTentMotionBlur : SV_Target1; }; struct PS_OUT_LIGHT { @@ -482,6 +483,11 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 float3 vToLight = normalize(-g_vLightDir.xyz); // 픽셀에서 라이트로 + if (g_bUsePhongShader) + { + vDepth.b = 0.f; + } + if (false == CalcLighting(g_SurfaceTexture, vDepth.b, uv, vAlbedo, vF0, fMetallic, fRoughness, fOcclusion, fAttenuation)) { Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)); @@ -726,26 +732,35 @@ PS_OUT_DEBUG_MOTIONBLUR PS_MAIN_DEBUG_MOTIONBLUR_INTENSE(PS_IN In) { PS_OUT_DEBUG_MOTIONBLUR Out; - float2 vBase = g_VelocityTexture.Sample(DefaultSampler, In.vTexcoord).xy * 2.f - 1.f; - float2 vTent = g_TileVelocityTexture.Sample(DefaultSampler, In.vTexcoord).xy * 2.f - 1.f; + float2 vBase = g_VelocityTexture.Sample(ClampSampler, In.vTexcoord).xy * 2.f - 1.f; + float2 vTent = g_TileVelocityTexture.Sample(ClampSampler, In.vTexcoord).xy * 2.f - 1.f; vBase *= 25.5f; vTent *= 25.5f; Out.vBaseMotionBlur.xy = vBase * 0.5f + 0.5f; Out.vBaseMotionBlur.z = 0.f; + Out.vBaseMotionBlur.w = 1.f; Out.vTentMotionBlur.xy = vTent * 0.5f + 0.5f; Out.vTentMotionBlur.z = 0.f; + Out.vTentMotionBlur.w = 1.f; if (AlmostEqual5(vBase.x, 0.f) && AlmostEqual5(vBase.y, 0.f)) { - Out.vBaseMotionBlur = float3(1.f, 1.f, 1.f); + Out.vBaseMotionBlur = float4(1.f, 1.f, 1.f, 1.f); } if (AlmostEqual5(vTent.x, 0.f) && AlmostEqual5(vTent.y, 0.f)) { - Out.vTentMotionBlur = float3(1.f, 1.f, 1.f); + Out.vTentMotionBlur = float4(1.f, 1.f, 1.f, 1.f); } return Out; }; - +PS_OUT_BACKBUFFER PS_MAIN_DEBUG_RtoRGBA(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + Out.vBackBuffer = g_VelocityTexture.Sample(DefaultSampler, In.vTexcoord).xxxx; + Out.vEnvironment = g_TileVelocityTexture.Sample(DefaultSampler, In.vTexcoord).xxxx; + Out.vEnvironment.a = Out.vBackBuffer.a = 1.f; + return Out; +}; PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) { PS_OUT_BACKBUFFER Out; @@ -1297,20 +1312,20 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In) return Out; } float4 vCenterViewPosition; - { + { // 센터 뷰스페이스 포지션 복원 vCenterViewPosition.x = uv.x * 2.f - 1.f; vCenterViewPosition.y = uv.y * -2.f + 1.f; vCenterViewPosition.z = vDepthDesc.x; vCenterViewPosition.w = 1.f; vCenterViewPosition *= fCenterViewSpaceZ; vCenterViewPosition = mul(vCenterViewPosition, g_invmatProj); - vCenterViewPosition /= vCenterViewPosition.w; + vCenterViewPosition /= vCenterViewPosition.w; } float3 vNormal = normalize(g_NormalTexture.Sample(PointSampler, uv).xyz * 2.f - 1.f); float3 vCenterViewNormal = mul(vNormal, (float3x3)g_ViewMatrix); float2 vNoiseScale = g_vResolution / 4.f; - float3 vNoise = g_SSAONoiseTexture.Sample(SsaoDataSampler, uv * vNoiseScale).xyz; + float3 vNoise = g_SSAONoiseTexture.Sample(SSAODataSampler, uv * vNoiseScale).xyz; float3 vTangent = normalize(vNoise - vCenterViewNormal * dot(vNoise, vCenterViewNormal)); float3 vBiNormal = cross(vCenterViewNormal, vTangent); @@ -1602,4 +1617,13 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_MAIN_DEBUG_MOTIONBLUR_INTENSE(); } + pass DEBUG_RtoRGBA // 24 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_CAPTURE(); + + PixelShader = compile ps_5_0 PS_MAIN_DEBUG_RtoRGBA(); + } } diff --git a/Jusin154_Team3D/Engine/Private/Light.cpp b/Jusin154_Team3D/Engine/Private/Light.cpp index b16aea830..537829f50 100644 --- a/Jusin154_Team3D/Engine/Private/Light.cpp +++ b/Jusin154_Team3D/Engine/Private/Light.cpp @@ -226,11 +226,7 @@ void CLight::Describe_Entity() GUI::Text("Direction:"); GUI::InputFloat3("##Direction", (_float*)m_LightDesc.pDirection); } -#ifdef _DEBUG m_pOwner->Get_Component()->Describe_Entity(); -#endif // _DEBUG - - GUI::TreePop(); diff --git a/Jusin154_Team3D/Engine/Private/Motion_Trail.cpp b/Jusin154_Team3D/Engine/Private/Motion_Trail.cpp index 157b01246..c13e256f6 100644 --- a/Jusin154_Team3D/Engine/Private/Motion_Trail.cpp +++ b/Jusin154_Team3D/Engine/Private/Motion_Trail.cpp @@ -28,6 +28,7 @@ HRESULT CMotion_Trail::Update_Capture(_float fDeltaTime) CAPTUREINFO* pInfo = (*iter); pInfo->vCaptureLifeTime.x += fDeltaTime; if (m_fMaxCaptureLifeTime < pInfo->vCaptureLifeTime.x) { + // LifeTime이 종료된 Capture는 정보를 지우고 보관 if (FAILED(ClearInfos(*pInfo))) { return E_FAIL; } @@ -84,9 +85,11 @@ HRESULT CMotion_Trail::Render(CShader* pShader) return S_OK; } +// dispatch 전에 호출할 해야 합니다 HRESULT CMotion_Trail::Capture_Model(ID3D11Buffer* pBoneBuffer, const _float4x4& matCurrentWorld) { CAPTUREINFO* pInfo = { nullptr }; + // 남은리소스가 있는지 검사하고 없다면 가장 마지막 캡쳐를 사용 if (m_RemainingInfos->empty()) { pInfo = m_CaptureInfos->front(); if (FAILED(ClearInfos(*pInfo))) { @@ -98,6 +101,7 @@ HRESULT CMotion_Trail::Capture_Model(ID3D11Buffer* pBoneBuffer, const _float4x4& pInfo = m_RemainingInfos->front(); m_RemainingInfos->pop(); } + // 캡쳐되는 상황의 월드 트랜스폼과 본버퍼 기록 m_pContext->CopyResource(pInfo->pBoneMatrixBuffer, pBoneBuffer); pInfo->WorldMatrix = matCurrentWorld; m_CaptureInfos->emplace_back(pInfo); @@ -118,8 +122,8 @@ HRESULT CMotion_Trail::Initialize_Prototype(MODELCAPTURE_DESC* pDesc) m_fMaxCaptureLifeTime = pDesc->fMaxCaptureLifeTime; m_iMaximumCapture = pDesc->iMaximumCapture; m_iNumBones = pDesc->iNumBones; - m_CaptureInfos = new list; - m_RemainingInfos = new queue; + m_CaptureInfos = new list; + m_RemainingInfos = new queue; vector Infos = {}; for (_uint i = 0; i < m_iMaximumCapture; ++i) { CAPTUREINFO* pInfo = new CAPTUREINFO(); diff --git a/Jusin154_Team3D/Engine/Private/PipeLine.cpp b/Jusin154_Team3D/Engine/Private/PipeLine.cpp index 0c125e40c..ae93b9791 100644 --- a/Jusin154_Team3D/Engine/Private/PipeLine.cpp +++ b/Jusin154_Team3D/Engine/Private/PipeLine.cpp @@ -254,9 +254,15 @@ _float CPipeLine::Get_ShadowBoxFar(_uint iShadowBoxIndex) void CPipeLine::Update() { -#ifdef _DEBUG - Describe_Entity(); -#endif // DEBUG +#ifdef RELEASE_DEBUGGER + static _bool m_bRenderSystem = false; + if (m_pGameInstance->Key_Up(DIK_F6)) { + m_bRenderSystem = !m_bRenderSystem; + } + if (true == m_bRenderSystem) { + Describe_Entity(); + } +#endif // RELEASE_DEBUGGER Update_ShadowDepthNdcZ(); XMStoreFloat4x4(&m_TransformStateMatrices[ENUM_CLASS(D3DTS::VIEW_INV)], XMMatrixInverse(nullptr, Get_Transform_Matrix(D3DTS::VIEW))); @@ -545,13 +551,13 @@ void CPipeLine::Free() m_mapGlobalSRV.clear(); SAFE_RELEASE(m_pGameInstance); } -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER void CPipeLine::Describe_Entity() { GUI::Begin("SYSTEM"); if (GUI::CollapsingHeader("PipeLine")) { - GUI::PushItemWidth(IMGUI_GLOBAL_ITEM_WIDTH); + GUI::PushItemWidth(400); _bool bModified = { false }; _float fNear = m_fShadowNearBoxRatio; _float fFar = m_fShadowFarBoxRatio; @@ -564,15 +570,15 @@ void CPipeLine::Describe_Entity() if (GUI::DragFloat("m_fShadowNearBoxRatio", &fNear, 0.001f, 0.001f, 0.999f, "%.3f")) { bModified = true; } - if (GUI::DragFloat("m_fShadowFarBoxRatio", &fFar, 0.001f, 0.001f, 0.999f, "%.3f")) { - bModified = true; - } - if (GUI::DragFloat("m_fSafe_RadiusMultiplier", &fSafe_RadiusMultiplier, 0.01f, 1.f, 3.f, "%.3f")) { - bModified = true; - } - if (GUI::DragFloat("m_fSafe_RadiusMargin", &fSafe_RadiusMargin, 1.f, 10.f, 40.f, "%.3f")) { + if (GUI::DragFloat("m_fShadowMiddleBoxRatio", &fFar, 0.001f, 0.001f, 0.999f, "%.3f")) { bModified = true; } + //if (GUI::DragFloat("m_fSafe_RadiusMultiplier", &fSafe_RadiusMultiplier, 0.01f, 1.f, 3.f, "%.3f")) { + // bModified = true; + //} + //if (GUI::DragFloat("m_fSafe_RadiusMargin", &fSafe_RadiusMargin, 1.f, 10.f, 40.f, "%.3f")) { + // bModified = true; + //} if (GUI::DragFloat4("ShadowBiasNMFS", (_float*)&vShadowBias, 0.0001f, 0.0001f, 1.f, "%.4f")) { bModified = true; } @@ -599,4 +605,4 @@ void CPipeLine::Describe_Entity() GUI::End(); } -#endif // _DEBUG +#endif // RELEASE_DEBUGGER diff --git a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp index f4a2fd892..baa0e84ef 100644 --- a/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/RenderTarget_Manager.cpp @@ -605,7 +605,7 @@ void CRenderTarget_Manager::RenderTarget_Debuger() GUI::DragInt("Target Size Y", &m_iSizeY); GUI::PopItemWidth(); ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; - GUI::BeginChild("RTDebugger", { 120.f, 200.f }, ImGuiChildFlags_None, window_flags); + GUI::BeginChild("RTDebugger", { 200.f, 200.f }, ImGuiChildFlags_None, window_flags); for (auto& [key, pRenderTarget] : m_RenderTargets) { _string strKey = CMyTools::ToString(key); diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 36f66f027..b7e9e1d52 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -17,7 +17,7 @@ void CRenderer::Render() Render_LightAcc(); Render_Combined(); Render_Occlusion(); - Render_EnvironmentPostProcess(); + //Render_EnvironmentPostProcess(); Render_Fog(); Render_Blur(); Combine_Blur(); @@ -48,13 +48,13 @@ void CRenderer::Render() GUI::Begin("RenderTarget Debuger", 0, IMGUI_GLOBAL_BEGIN_FLAG); GUI::Checkbox("DebugToggle", &m_bToggleDebug); - if (m_bToggleDebug) { - Render_Debug(); - } GUI::End(); } if (m_pGameInstance->Key_Pressing(DIK_F10)) { Render_Debug(); + } + else if (m_bToggleDebug) { + Render_Debug(); } #endif m_eType = RENDER::END; @@ -107,6 +107,22 @@ void CRenderer::Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& P } m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc); + +#ifdef DEBUG_SHADOW + if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_PreShadow_DEBUG"), m_pPreShadowDSV))) { + return; + } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_PreShadow"), m_pShader, "g_VelocityTexture"))) { + assert(false); + return; + } + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::DEBUG_RtoRGBA)); + m_pVIBuffer->Bind_Resources(); + m_pVIBuffer->Render(); + if (FAILED(m_pGameInstance->End_MRT())) { + return; + } +#endif // DEBUG_SHADOW } HRESULT CRenderer::Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType) @@ -170,6 +186,9 @@ void CRenderer::Bind_RawValue() if (FAILED(m_pShader->Bind_RawValue("g_vPreShadowResolution", &m_vPreShadowResoltion, sizeof(_float2)))) { return; } + if (FAILED(m_pShader->Bind_RawValue("g_bUsePhongShader", &m_bUsePhongShader, sizeof(_bool)))) { + return; + } } void CRenderer::Render_Occlusion() @@ -323,6 +342,26 @@ void CRenderer::Render_Shadow() } m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc); +#ifdef DEBUG_SHADOW + if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Shadow_DEBUG"), m_pPreShadowDSV))) { + return; + } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Shadow_Near"), m_pShader, "g_VelocityTexture"))) { + assert(false); + return; + } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Shadow_Middle"), m_pShader, "g_TileVelocityTexture"))) { + assert(false); + return; + } + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::DEBUG_RtoRGBA)); + m_pVIBuffer->Bind_Resources(); + m_pVIBuffer->Render(); + if (FAILED(m_pGameInstance->End_MRT())) { + return; + } +#endif // DEBUG_SHADOW + COMPUTE_TIMEDELTA("Timer_Render_Shadow"); } @@ -991,6 +1030,25 @@ void CRenderer::Render_SSAO_BLUR() if (FAILED(m_pGameInstance->End_MRT())) { return; } +#ifdef DEBUG_SSAO + if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_SSAO_BLUR_DEBUG")))) { + assert(false); return; + } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_SSAO_AmbientOcclusion"), m_pShader, "g_VelocityTexture"))) { + assert(false); + return; + } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_SSAO_BLUR"), m_pShader, "g_TileVelocityTexture"))) { + assert(false); + return; + } + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::DEBUG_RtoRGBA)); + m_pVIBuffer->Bind_Resources(); + m_pVIBuffer->Render(); + if (FAILED(m_pGameInstance->End_MRT())) { + return; + } +#endif // DEBUG_SSAO COMPUTE_TIMEDELTA("Timer_Render_SSAO_BLUR"); } diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index f7f7a05fa..22f380e0c 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -213,6 +213,23 @@ HRESULT CRenderer::Initialize() DXGI_FORMAT_R16_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) { return E_FAIL; } +#ifdef DEBUG_SHADOW + /* Target_Shadow_Near */ + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Near_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(1.f, 1.f, 1.f, 1.f)))) { + return E_FAIL; + } + /* Target_Shadow_Middle */ + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Middle_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(1.f, 1.f, 1.f, 1.f)))) { + return E_FAIL; + } + /* Target_PreShadow */ + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_PreShadow_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(1.f, 1.f, 1.f, 1.f)))) { + return E_FAIL; + } +#endif // DEBUG_SHADOW /* Target_Blur */ if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Blur"), (_uint)Viewport.Width, (_uint)Viewport.Height, @@ -232,7 +249,6 @@ HRESULT CRenderer::Initialize() return E_FAIL; } - /* Target_ENV_Blur_X */ if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_X"), (_uint)Viewport.Width, (_uint)Viewport.Height, DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) { @@ -258,6 +274,18 @@ HRESULT CRenderer::Initialize() DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) { return E_FAIL; } +#ifdef DEBUG_SSAO + /* Target_SSAO_AmbientOcclusion */ + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_SSAO_AmbientOcclusion_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(1.f, 1.f, 1.f, 1.f)))) { + return E_FAIL; + } + /* Target_SSAO_BLUR */ + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_SSAO_BLUR_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(1.f, 1.f, 1.f, 1.f)))) { + return E_FAIL; + } +#endif //DEBUG_SSAO /* Target_AfterCombined */ if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_AfterCombined"), (_uint)Viewport.Width, (_uint)Viewport.Height, @@ -362,14 +390,15 @@ HRESULT CRenderer::Initialize() DXGI_FORMAT_R32G32_FLOAT, _float4(0.5f, 0.5f, 0.f, 0.f)))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_VelocityMap_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(0.5f, 0.5f, 0.5f, 0.f)))) { +#ifdef DEBUG_MOTIONBLUR + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_MotionBlur_DEBUG"), TEXT("Target_VelocityMap_DEBUG")))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_VelocityTent_DEBUG"), (_uint)Viewport.Width, (_uint)Viewport.Height, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, _float4(0.5f, 0.5f, 0.5f, 0.f)))) { + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_MotionBlur_DEBUG"), TEXT("Target_VelocityTent_DEBUG")))) { return E_FAIL; } +#endif // DEBUG_MOTIONBLUR + if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_BeforeNormal"), (_uint)Viewport.Width, (_uint)Viewport.Height, DXGI_FORMAT_R16G16B16A16_UNORM, _float4(0.0f, 0.f, 0.f, 0.f)))) { return E_FAIL; @@ -436,6 +465,14 @@ HRESULT CRenderer::Initialize() if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_SSAO_BLUR"), TEXT("Target_SSAO_BLUR")))) { return E_FAIL; } +#ifdef DEBUG_SSAO + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_SSAO_BLUR_DEBUG"), TEXT("Target_SSAO_AmbientOcclusion_DEBUG")))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_SSAO_BLUR_DEBUG"), TEXT("Target_SSAO_BLUR_DEBUG")))) { + return E_FAIL; + } +#endif // DEBUG_SSAO /* MRT_Combined */ if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Combined"), TEXT("Target_Fog")))) { return E_FAIL; @@ -464,11 +501,28 @@ HRESULT CRenderer::Initialize() if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Shadow_Middle"), TEXT("Target_Shadow_Middle")))) { return E_FAIL; } +#ifdef DEBUG_SHADOW + /* MRT_Shadow */ + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Shadow_DEBUG"), TEXT("Target_Shadow_Near_DEBUG")))) { + return E_FAIL; + } + /* MRT_Shadow_Middle */ + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Shadow_DEBUG"), TEXT("Target_Shadow_Middle_DEBUG")))) { + return E_FAIL; + } +#endif // DEBUG_SHADOW + /* MRT_PreShadow */ if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_PreShadow"), TEXT("Target_PreShadow")))) { return E_FAIL; } +#ifdef DEBUG_SHADOW + /* MRT_PreShadow */ + if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_PreShadow_DEBUG"), TEXT("Target_PreShadow_DEBUG")))) { + return E_FAIL; + } +#endif // DEBUG_SHADOW /* MRT_Blur */ if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Blur"), TEXT("Target_Blur")))) { @@ -533,12 +587,15 @@ HRESULT CRenderer::Initialize() if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_MotionBlur"), TEXT("Target_VelocityMapFinal")))) { return E_FAIL; } +#ifdef DEBUG_MOTIONBLUR if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_MotionBlur_DEBUG"), TEXT("Target_VelocityMap_DEBUG")))) { return E_FAIL; } if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_MotionBlur_DEBUG"), TEXT("Target_VelocityTent_DEBUG")))) { return E_FAIL; } +#endif // DEBUG_MOTIONBLUR + /* MRT_Blur_Mesh */ @@ -657,11 +714,13 @@ void CRenderer::Free() #ifdef RELEASE_DEBUGGER void CRenderer::Describe_Entitiy() { - GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); + static _bool bShowGUIWindow = true; + GUI::Begin("SYSTEM", &bShowGUIWindow, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("RENDERER")) { if (GUI::CollapsingHeader("Variable")) { GUI::DragFloat("SpecularMaximum", &m_fLightSpecularMaximum, 0.01f, 0.0f, 2.f, "%.3f"); GUI::DragFloat("fMinShadowBrightness", &m_fMinShadowBrightness, 0.01f, 0.0f, 1.f, "%.3f"); + GUI::Checkbox("UsePhongShader", &m_bUsePhongShader); } if (GUI::CollapsingHeader("PostProcessing_Bloom")) { @@ -670,34 +729,11 @@ void CRenderer::Describe_Entitiy() GUI::SliderInt("g_iEmbossingPass", &m_iBloomEmbossingPass, 0, 2, "%d"); GUI::EndChild(); } - if (GUI::CollapsingHeader("Environment DOF")) - { - GUI::BeginChild("DOF_ENV", ImVec2(0, 0), true); - - GUI::Text("Far DOF (Environment)"); - GUI::Separator(); - - GUI::DragFloat("Depth Cut", &m_fDOF_ENV_CutThreshold, 0.001f, 0.0f, 20.0f, "%.4f"); - GUI::DragFloat("Focus Dist", &m_fDOF_ENV_FocusDistance, 1.0f, 0.1f, 125.f, "%.1f"); - GUI::DragFloat("Blur Start", &m_fDOF_ENV_StartDistance, 1.0f, 0.1f, 250.f, "%.1f"); - GUI::DragFloat("Blur End", &m_fDOF_ENV_MaxEnd, 1.0f, 1.0f, 500.f, "%.1f"); - GUI::DragFloat("Max Radius", &m_fDOF_ENV_AmountRadius, 0.1f, 0.0f, 10.0f, "%.2f"); - -#ifdef _DEBUG - if (m_fDOF_ENV_StartDistance < m_fDOF_ENV_FocusDistance) { - m_fDOF_ENV_StartDistance = m_fDOF_ENV_FocusDistance; - } - if (m_fDOF_ENV_MaxEnd < m_fDOF_ENV_StartDistance + 1.0f) { - m_fDOF_ENV_MaxEnd = m_fDOF_ENV_StartDistance + 1.0f; - } -#endif // _DEBUG - GUI::EndChild(); - } if (GUI::CollapsingHeader("SSAO")) { GUI::BeginChild("SSAO_Setting", ImVec2(0, 0), true); GUI::DragFloat("fSSAORadius ", &m_fSSAO_Radius, 0.001f, -3.f, 3.f, "%.5f"); - GUI::DragFloat("fSSAO_BIAS", &m_fSSAO_BIAS, 0.001f, -2.f, 2.f, "%.5f"); - GUI::DragFloat("fSSAOStrength", &m_fSSAOStrength, 0.01f, 1.f, 4.f, "%.5f"); + GUI::DragFloat("fSSAO_BIAS", &m_fSSAO_BIAS, 0.001f, 0.01f, 2.f, "%.5f"); + GUI::DragFloat("fSSAOStrength", &m_fSSAOStrength, 0.01f, 0.01f, 4.f, "%.5f"); GUI::EndChild(); } if (GUI::CollapsingHeader("ToneMapping")) { @@ -712,8 +748,6 @@ void CRenderer::Describe_Entitiy() GUI::SliderFloat("m_fMBMaxBlurRadius", &m_fMBMaxBlurRadius, 0.1f, (_float)m_iMBMaxSampleCount, "%.1f"); GUI::SliderInt("g_iMBSampleCount", &m_iMBSampleCount, 0, m_iMBMaxSampleCount, "%d"); } - if (GUI::CollapsingHeader("End_Padding")) { - } #ifdef _DEBUG if (GUI::Button("Refresh_Shader")) { m_pShader->Shader_Refresh(); diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp index 8d387ab66..ac34e5d00 100644 --- a/Jusin154_Team3D/Engine/Private/Transform.cpp +++ b/Jusin154_Team3D/Engine/Private/Transform.cpp @@ -640,9 +640,13 @@ void TransformXMLInput(CTransform* pTransform) } } + +#endif // _DEBUG +#ifdef RELEASE_DEBUGGER + void CTransform::Describe_Entity() { -//#ifdef 기무리 +#ifdef _DEBUG if (GUI::TreeNode("NuriDebug")) { { _vector vScale, vRotQ, vTrans; @@ -652,6 +656,7 @@ void CTransform::Describe_Entity() XMStoreFloat4(&rotQ, vRotQ); XMStoreFloat4(&trans, vTrans); TransformXMLInput(this); + if (GUI::SmallButton("Copy")) { _char buf[512] = {}; sprintf_s( @@ -671,7 +676,7 @@ void CTransform::Describe_Entity() } GUI::TreePop(); } -//#endif // 기무리 +#endif _DEBUG if (GUI::TreeNode("Transform")) { GUI::Text("----- Gizmo ----"); _float3 vMove = {}; @@ -699,19 +704,17 @@ void CTransform::Describe_Entity() GUI::InputFloat("Y##Rotation", &m_vRotation.y, 1.f, 15.f); GUI::InputFloat("Z##Rotation", &m_vRotation.z, 1.f, 15.f); -#ifndef 기무리 Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); -#endif // 기무리 -#ifdef 기무리 - _float3 vRot = {}; - XMStoreFloat3(&vRot, Get_RollPitchYawVector()); - GUI::Text("R : %.2f", XMConvertToDegrees(vRot.x)); GUI::SameLine(); - GUI::Text("\tY : %.2f", XMConvertToDegrees(vRot.y)); GUI::SameLine(); - GUI::Text("\tP : %.2f", XMConvertToDegrees(vRot.z)); - if (GUI::SmallButton("ApplyRotation")) { - Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); - } -#endif // 기무리 +//#ifdef 기무리 +// _float3 vRot = {}; +// XMStoreFloat3(&vRot, Get_RollPitchYawVector()); +// GUI::Text("R : %.2f", XMConvertToDegrees(vRot.x)); GUI::SameLine(); +// GUI::Text("\tY : %.2f", XMConvertToDegrees(vRot.y)); GUI::SameLine(); +// GUI::Text("\tP : %.2f", XMConvertToDegrees(vRot.z)); +// if (GUI::SmallButton("ApplyRotation")) { +// Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); +// } +//#endif // 기무리 _float3 vScale = Get_Scale(); @@ -730,8 +733,7 @@ void CTransform::Describe_Entity() GUI::TreePop(); GUI::Spacing(); - + } } - -#endif // _DEBUG +#endif diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index ea93346b2..eb72611b2 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -57,7 +57,8 @@ enum class SHADER_PASS_CELL { DEBUG, END }; enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, UPSAMPLE, BLOOM_BLURX, BLOOM_BLURY, EMBOSSING, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT, - POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, MOTIONBLUR, DOWNSAMPLE, MOTIONBLURTILE, MOTIONBLURTENT, PRINT_BACKBUFFER, DEBUG_MOTIONBLUR_INTENSE, + POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, MOTIONBLUR, DOWNSAMPLE, MOTIONBLURTILE, MOTIONBLURTENT, PRINT_BACKBUFFER, + DEBUG_MOTIONBLUR_INTENSE, DEBUG_RtoRGBA, END }; enum class SHADER_PASS_BLUR { BLUR_X , BLUR_Y , COMBINED, END}; diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h index 34060cd1b..dcd98f4fa 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h @@ -6,7 +6,7 @@ #define GUI ImGui #endif // !GUI #ifndef IMGUI_GLOBAL_BEGIN_FLAG -#define IMGUI_GLOBAL_BEGIN_FLAG ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_NoBringToFrontOnFocus|ImGuiWindowFlags_AlwaysAutoResize +#define IMGUI_GLOBAL_BEGIN_FLAG ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_NoBringToFrontOnFocus #endif // IMGUI_GLOBAL_BEGIN_FLAG #define COMPUTE_TIMEDELTA(TIMER) m_pGameInstance->Compute_TimeDelta(TEXT(TIMER)) @@ -22,7 +22,12 @@ #define RELEASE_DEBUGGER #endif // !_DEBUG -#define DEBUG_MOTIONBLUR +#ifdef 기무리 +//#define DEBUG_MOTIONBLUR +//#define DEBUG_SSAO +//#define DEBUG_SHADOW +//#define DEBUG_CAMERAS +#endif // 기무리 @@ -146,11 +151,11 @@ #define MRO_PARAMETER 2.f/ 27.f #define SRO_PARAMETER 15.f/ 27.f -constexpr unsigned int g_iNearShadowWidth = 4096; -constexpr unsigned int g_iNearShadowHeight = 4096; +constexpr unsigned int g_iNearShadowWidth = 8192; +constexpr unsigned int g_iNearShadowHeight = 8192; -constexpr unsigned int g_iMiddleShadowWidth = 2048; -constexpr unsigned int g_iMiddleShadowHeight = 2048; +constexpr unsigned int g_iMiddleShadowWidth = 4096; +constexpr unsigned int g_iMiddleShadowHeight = 4096; constexpr unsigned int g_iFarShadowWidth = 1024; constexpr unsigned int g_iFarShadowHeight = 1024; diff --git a/Jusin154_Team3D/Engine/Public/PipeLine.h b/Jusin154_Team3D/Engine/Public/PipeLine.h index 0b9f95cfd..51a1bcd81 100644 --- a/Jusin154_Team3D/Engine/Public/PipeLine.h +++ b/Jusin154_Team3D/Engine/Public/PipeLine.h @@ -107,9 +107,9 @@ class CPipeLine final : public CBase public: static CPipeLine* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual void Free() override; -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER virtual void Describe_Entity(); -#endif // _DEBUG +#endif // RELEASE_DEBUGGER }; diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index 3ab156185..60a2c1020 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -79,6 +79,7 @@ class CRenderer final : public CBase _float m_fNearShadowBias = { 0.05f }; _float m_fFarShadowBias = { 1.f }; _float m_fMinShadowBrightness = { 0.47f }; + _bool m_bUsePhongShader = { false }; // MotionBlur _float m_fMBMaxBlurRadius = { 28.f }; diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index 36651610b..b0462e465 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -106,9 +106,9 @@ class ENGINE_DLL CTransform final : _float3 m_vMomentum = {}; // 현재 프레임에 계산된 이동량 _float3 m_vBackMomentum = {}; // 다음 프레임에 계산될 이동량 -#ifdef _DEBUG +#ifdef RELEASE_DEBUGGER _float3 m_vRotation = {0.f, 0.f, 0.f}; -#endif // _DEBUG +#endif // RELEASE_DEBUGGER private: @@ -119,9 +119,9 @@ class ENGINE_DLL CTransform final : static CTransform* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override; virtual void Free() override; -#ifdef _DEBUG - void Describe_Entity() override; -#endif // _DEBUG +#ifdef RELEASE_DEBUGGER + void Describe_Entity(); +#endif // RELEASE_DEBUGGER }; NS_END