From 94de3a4dfa650b0d7066bd97043b06e37dc99c75 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Wed, 29 Apr 2026 10:40:38 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[add]=20Physx=20=EC=A3=BC=EC=84=9D=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20[fix]=20=EB=B3=80=EC=88=98=EB=AA=85=20=EC=95=8C?= =?UTF-8?q?=EC=95=84=EB=B3=B5=20=E3=85=A3=EC=89=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Default/Client.cpp | 3 +- Jusin154_Team3D/Client/Private/TriggerBox.cpp | 14 +- .../ShaderFiles/Engine_Shader_Functions.hlsli | 55 ++-- .../ShaderFiles/Shader_Deferred.hlsl | 111 +++---- Jusin154_Team3D/Editor/Private/Level_Logo.cpp | 2 +- .../Editor/Private/Loader_ObjectViewer.cpp | 16 +- .../ShaderFiles/Shader_Deferred.hlsl | 18 +- .../Engine/Private/GameInstance.cpp | 7 +- .../Engine/Private/PhysX_Manager.cpp | 31 +- Jusin154_Team3D/Engine/Private/Transform.cpp | 12 +- Jusin154_Team3D/Engine/Public/Engine_Macro.h | 4 +- Jusin154_Team3D/Engine/Public/Transform.h | 2 +- Jusin154_Team3D/UpgradeLog.htm | 283 ++++++++++++++++++ Jusin154_Team3D/UpgradeLog2.htm | 270 +++++++++++++++++ 14 files changed, 694 insertions(+), 134 deletions(-) create mode 100644 Jusin154_Team3D/UpgradeLog.htm create mode 100644 Jusin154_Team3D/UpgradeLog2.htm diff --git a/Jusin154_Team3D/Client/Default/Client.cpp b/Jusin154_Team3D/Client/Default/Client.cpp index e4cfc43ae..7a0c2a16a 100644 --- a/Jusin154_Team3D/Client/Default/Client.cpp +++ b/Jusin154_Team3D/Client/Default/Client.cpp @@ -131,7 +131,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, pGameInstance->Compute_TimeDelta(TEXT("Timer_60")); #ifdef _DEBUG - pMainApp->Update(1.f / 60.f); + _float fFrameTime = min(pGameInstance->Get_TimeDelta(TEXT("Timer_60")), fMaxTimer); + pMainApp->Update(fFrameTime); #endif // _DEBUG #ifndef _DEBUG _float fFrameTime = min(pGameInstance->Get_TimeDelta(TEXT("Timer_60")), fMaxTimer); diff --git a/Jusin154_Team3D/Client/Private/TriggerBox.cpp b/Jusin154_Team3D/Client/Private/TriggerBox.cpp index fa9e6c735..fefd2e246 100644 --- a/Jusin154_Team3D/Client/Private/TriggerBox.cpp +++ b/Jusin154_Team3D/Client/Private/TriggerBox.cpp @@ -32,15 +32,15 @@ HRESULT CTriggerBox::TryScanArea(_float fTimeDelta) HRESULT CTriggerBox::Render() { #ifdef _DEBUG - m_Batch->Begin(); + //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(0xff0f0f, CMyTools::Saturate(m_vScanTimer.x / m_vScanTimer.y + 0.1f)); - m_pSubShape->Draw(m_pTransformCom->Get_XMWorldMatrix(), ViewMatrix, ProjMatrix, vColor, nullptr, true); + //_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW); + //_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ); + //_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0xff0f0f, CMyTools::Saturate(m_vScanTimer.x / m_vScanTimer.y + 0.1f)); + //m_pSubShape->Draw(m_pTransformCom->Get_XMWorldMatrix(), ViewMatrix, ProjMatrix, vColor, nullptr, true); - m_Batch->End(); - m_bRender = false; + //m_Batch->End(); + //m_bRender = false; #endif // _DEBUG return S_OK; 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 971157a81..069c932db 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -322,37 +322,28 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv) return normalize(n); } -// BackGround ForeGround 합은 1 float2 ComputeDepthWeights(float fCenterDepth, float fSampleDepth, float fDepthScale) { float delta = fSampleDepth - fCenterDepth; - // backgroundWeight: sample이 더 멀수록 증가 - float backgroundWeight = saturate(0.5f + fDepthScale * delta); - float foregroundWeight = 1.0f - backgroundWeight; + float fBackgroundWeight = saturate(0.5f + fDepthScale * delta); + float fForegroundWeight = 1.0f - fBackgroundWeight; - return float2(backgroundWeight, foregroundWeight); + return float2(fBackgroundWeight, fForegroundWeight); } -float ComputeSpreadWeight(float fOffsetLength, float fSpreadLength, float fPixelToSampleUnitsScale) +float ComputeSpreadWeight(float fStepOffset, float fSpreadLength, float fVelocityScale) { - return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f); + return saturate(fVelocityScale * fSpreadLength - fStepOffset + 1.f); } -// 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) +float SampleWeight(float fCenterDepth, float fSampleDepth, float fStepOffset, float fCenterSpreadLength, + float fSampleSpreadLength, float fVelocityScale, float fDepthScale) { float2 vDepthCompare = ComputeDepthWeights(fCenterDepth, fSampleDepth, fDepthScale); - float fSpreadCenter = ComputeSpreadWeight(fOffsetLength, fCenterSpreadLength, fPixelToSampleUnitsScale); - float fSpreadSample = ComputeSpreadWeight(fOffsetLength, fSampleSpreadLength, fPixelToSampleUnitsScale); + float fCenter = ComputeSpreadWeight(fStepOffset, fCenterSpreadLength, fVelocityScale); + float fSample = ComputeSpreadWeight(fStepOffset, fSampleSpreadLength, fVelocityScale); - return vDepthCompare.x * fSpreadCenter + vDepthCompare.y * fSpreadSample; + return vDepthCompare.x * fCenter + vDepthCompare.y * fSample; } float4x4 RotateX(float fAngle) @@ -598,24 +589,26 @@ float4 BlendDiffuse(float4 vDiffuseA, Texture2D DiffuseBlendTexture, float2 vTex float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIntensity = 1.f) { float2 vReturnVelocity = float2(0.5f, 0.5f); - if (vCurrentProjPos.w <= FLT_EPSILON5 || vPreviousProjPos.w <= FLT_EPSILON5) - { + if (vCurrentProjPos.w <= FLT_EPSILON5 || vPreviousProjPos.w <= FLT_EPSILON5) { return vReturnVelocity; } + + { + float2 currentNDC = vCurrentProjPos.xy / vCurrentProjPos.w; + float2 previousNDC = vPreviousProjPos.xy / vPreviousProjPos.w; - float2 currentNDC = vCurrentProjPos.xy / vCurrentProjPos.w; - float2 previousNDC = vPreviousProjPos.xy / vPreviousProjPos.w; + currentNDC.y *= -1.f; + previousNDC.y *= -1.f; - currentNDC.y *= -1.f; - previousNDC.y *= -1.f; + float2 velocityUV = (currentNDC - previousNDC) * 0.5f; + velocityUV *= fIntensity; + velocityUV = clamp(velocityUV, -1.0f, 1.0f); - // UV 델타 - float2 velocityUV = (currentNDC - previousNDC) * 0.5f; - velocityUV *= fIntensity; - velocityUV = clamp(velocityUV, -1.0f, 1.0f); - - return velocityUV * 0.5f + 0.5f; // 0 속도 -> 0.5 + vReturnVelocity = velocityUV * 0.5f + 0.5f; + } + return vReturnVelocity; } + float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos) { return CalcVelocityUV(vCurrentProjPos, vPreviousProjPos, 1.0f); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 4c0aec50d..7afcf773b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -269,33 +269,34 @@ PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) float2 vCenterUV = In.vTexcoord; float2 vFullResolutionTexelSize = 1.f / g_vResolution; - float fCenterDepth = g_DepthTexture.Sample(PointSampler, vCenterUV).y; - float2 vCenterVelo = g_VelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; // 0~1 -> -1~+1 - float2 vCenterVeloPixel = vCenterVelo * g_vResolution.xy; - bool bBorrowedVelocityFromTile = false; + float fCenterDepth = g_DepthTexture.Sample(PointSampler, vCenterUV).y * g_fFar; + float2 vCenterVelocity = g_VelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; // 0~1 -> -1~+1 + float2 vCenterVeloPixel = vCenterVelocity * g_vResolution.xy; + bool bBorrowedVelocity = false; - float2 vBlurVelo = vCenterVelo; - float2 vBlurVeloPixel = vCenterVeloPixel; // 프레임당 픽셀 이동량 + float2 vBlurVelocity = vCenterVelocity; + float2 vBlurVelocityPixel = vCenterVelocity * g_vResolution.xy; // 프레임당 픽셀 이동량 float fVelocityEpsilon = 0.5f; - if (length(vBlurVeloPixel) < fVelocityEpsilon) + if (length(vBlurVelocityPixel) < fVelocityEpsilon) { // 사실상 정지해 있던 픽셀이면 텐트벨로시티맵에서 빌려옴 - vBlurVelo = g_TileVelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; - vBlurVeloPixel = vBlurVelo * g_vResolution.xy; - bBorrowedVelocityFromTile = true; + vBlurVelocity = g_TileVelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; + vBlurVelocityPixel = vBlurVelocity * g_vResolution.xy; + bBorrowedVelocity = true; } - if (length(vBlurVeloPixel) < fVelocityEpsilon) { + if (length(vBlurVelocityPixel) < fVelocityEpsilon) + { // 텐트벨로시티맵에서 빌려온 픽셀또한 정지해 있었으면 원본 그대로 반환 Out.vColor = g_ColorTexture.Sample(ClampLinearSampler, vCenterUV); Out.vVelocity = float2(0.5f, 0.5f); return Out; } - float fPixelSpeed = length(vBlurVeloPixel); + float fPixelSpeed = length(vBlurVelocityPixel); - float2 vBlurDirPixel = (vBlurVeloPixel / max(fPixelSpeed, FLT_EPSILON5)); + float2 vBlurDirPixel = (vBlurVelocityPixel / max(fPixelSpeed, FLT_EPSILON5)); // 픽셀의 속도로 블러 반경을 가변적으로 돌림 float fBlurRadiusPixel = clamp(fPixelSpeed * 0.4f , 0.f, g_fMBMaxBlurRadius); @@ -308,39 +309,40 @@ PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) float fSamplePixelSpeed = fBlurRadiusPixel / max((float) iMaxRadius, 1.f); // 샘플유닛의 크기 - float fScalePixelToSampleUnit = (float) iMaxRadius / max(fBlurRadiusPixel, FLT_EPSILON5); - float fScaleDepth = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); + float fVelocityScale = (float) iMaxRadius / max(fBlurRadiusPixel, FLT_EPSILON5); + float fDepthScale = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); float4 vAccColorSum = float4(0.f, 0.f, 0.f, 0.f); float2 vAccVeloSum = float2(0.f, 0.f); float fAccWeight = 0.f; // 센터의 스프레드 길이 - float2 vReferenceVelocityPixel = bBorrowedVelocityFromTile ? vBlurVeloPixel : vCenterVeloPixel; // 빌린놈이면 빌린 타일이 속도 레퍼런스, 아니면 센터가 속도 레퍼런스가 됨 - float fCenterSpreadLengthPixel = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, fBlurRadiusPixel); // fSampleSpreadLengthPixel 랑 비교하게 될 짝꿍 + float2 vReferenceVelocityPixel = bBorrowedVelocity ? vBlurVelocityPixel : vCenterVeloPixel; // 빌린놈이면 빌린 타일이 속도 레퍼런스, 아니면 센터가 속도 레퍼런스가 됨 + float fCurrentVelocityVector = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, fBlurRadiusPixel); // fSampleSpreadLengthPixel 랑 비교하게 될 짝꿍 [loop] - for (int iInterval = -iMaxRadius; iInterval <= iMaxRadius; ++iInterval) { - float fOffset = (float) abs(iInterval); - float2 vOffsetPixel = vBlurDirPixel * ((float) iInterval * fSamplePixelSpeed); + for (int iStep = -iMaxRadius; iStep <= iMaxRadius; ++iStep) + { + float fOffset = (float) abs(iStep); + float2 vOffsetPixel = vBlurDirPixel * ((float) iStep * fSamplePixelSpeed); float2 vSamplingUV = vCenterUV + vOffsetPixel * vFullResolutionTexelSize; if (false == IsValidUV(vSamplingUV)) { continue; } - float fSampledDepth = g_DepthTexture.Sample(PointSampler, vSamplingUV).y; - float2 vSampledVelo = g_VelocityTexture.Sample(PointSampler, vSamplingUV).xy * 2.f - 1.f; - float2 vSampledVeloPixel = vSampledVelo * g_vResolution.xy; + float fSampleDepth = g_DepthTexture.Sample(PointSampler, vSamplingUV).y * g_fFar; + float2 vSampledVelocity = g_VelocityTexture.Sample(PointSampler, vSamplingUV).xy * 2.f - 1.f; + float2 vSampledVelocityPixel = vSampledVelocity * g_vResolution.xy; // 샘플의 스프레드 길이 - float fBlurSampleAccurate = abs(dot(vSampledVeloPixel, vBlurDirPixel)); - float fSampleSpreadLengthPixel = clamp(fBlurSampleAccurate, 0.f, fBlurRadiusPixel); - if (true == bBorrowedVelocityFromTile) + float fSampleVelocityVector = clamp(abs(dot(vSampledVelocityPixel, vBlurDirPixel)), 0.f, fBlurRadiusPixel); + if (true == bBorrowedVelocity) { - fSampleSpreadLengthPixel = max(fSampleSpreadLengthPixel, fCenterSpreadLengthPixel); + fSampleVelocityVector = max(fSampleVelocityVector, fCurrentVelocityVector); } // 샘플과 센터의 (깊이테스트 + 스프레드테스트) - float fWeightCalculated = SampleWeight(fCenterDepth, fSampledDepth, fOffset, fCenterSpreadLengthPixel, fSampleSpreadLengthPixel, fScalePixelToSampleUnit, fScaleDepth); + float fWeightCalculated = SampleWeight(fCenterDepth, fSampleDepth, fOffset, + fCurrentVelocityVector, fSampleVelocityVector, fVelocityScale, fDepthScale); if (fWeightCalculated <= 0.f) { continue; @@ -348,7 +350,7 @@ PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) float4 vSampledColor = g_ColorTexture.Sample(ClampLinearSampler, vSamplingUV); vAccColorSum += vSampledColor * fWeightCalculated; - vAccVeloSum += vSampledVelo * fWeightCalculated; + vAccVeloSum += vSampledVelocity * fWeightCalculated; fAccWeight += fWeightCalculated; } float4 vBlurredColor = vAccColorSum / max(fAccWeight, FLT_EPSILON5); @@ -833,13 +835,17 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) //Dynamic - > Static //부드럽게 전환 - float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static); - float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar; - float fStaticShadowBlendWidthRatio = 0.05f; - float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio); - float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio); - float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight); - + float g_fStaticShadowBlendWidthRatio = 0.05f; + float fStaticShadowBlendEndRatio = min(1.0f, g_fCascadeSplitRatioFar + g_fStaticShadowBlendWidthRatio); + float fStaticShadowBlendWeight = smoothstep( + g_fCascadeSplitRatioFar, + fStaticShadowBlendEndRatio, + fDepthRatio +); + + float fStaticAdjusted = lerp(1.0f, fVisibility_Static, fStaticShadowBlendWeight); + + float fVisibilityCombined = fVisibilityDynamic * fStaticAdjusted; // 2번째 방법 // Dynamic * Static 항상 최소곱 //float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static); @@ -1324,42 +1330,43 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In) vCenterViewPosition /= vCenterViewPosition.w; } float3 vNormal = normalize(g_NormalTexture.Sample(PointSampler, uv).xyz * 2.f - 1.f); - float3 vCenterViewNormal = mul(vNormal, (float3x3)g_ViewMatrix); + float3 vCenterNormal = mul(vNormal, (float3x3) g_ViewMatrix); float2 vNoiseScale = g_vResolution / 4.f; float3 vNoise = g_SSAONoiseTexture.Sample(SSAODataSampler, uv * vNoiseScale).xyz; - float3 vTangent = normalize(vNoise - vCenterViewNormal * dot(vNoise, vCenterViewNormal)); - float3 vBiNormal = cross(vCenterViewNormal, vTangent); - float3x3 toViewTBNMatrix = float3x3(vTangent, vBiNormal, vCenterViewNormal); + float3 vTangent = normalize(vNoise - vCenterNormal * dot(vNoise, vCenterNormal)); + float3 vBiNormal = cross(vCenterNormal, vTangent); + float3x3 TBNMatrix = float3x3(vTangent, vBiNormal, vCenterNormal); float fOcclusion = 0.f; [loop] for (uint i = 0; i < g_iKernelSize; ++i) { - float3 vViewSamplePosVec = mul(g_SamplePos[i].xyz, toViewTBNMatrix); // TANSPACE -> VIEW - float4 vViewSamplePos = vCenterViewPosition + float4(vViewSamplePosVec * g_fSSAORadius, 0.f); - float4 vNDCSampleOffset = mul(vViewSamplePos, g_ProjMatrix); + float3 vSampleVector= mul(g_SamplePos[i].xyz, TBNMatrix); + float4 vSampleViewPosition = vCenterViewPosition + float4(vSampleVector * g_fSSAORadius, 0.f); + float4 vNDCSampleOffset = mul(vSampleViewPosition, g_ProjMatrix); vNDCSampleOffset /= vNDCSampleOffset.w; - float2 sampleUV; - sampleUV.x = vNDCSampleOffset.x * 0.5f + 0.5f; - sampleUV.y = vNDCSampleOffset.y * -0.5f + 0.5f; + float2 vSampleUV; + vSampleUV.x = vNDCSampleOffset.x * 0.5f + 0.5f; + vSampleUV.y = vNDCSampleOffset.y * -0.5f + 0.5f; - if (sampleUV.x < 0 || sampleUV.x > 1 - || sampleUV.y < 0 || sampleUV.y > 1) { + if (vSampleUV.x < 0 || vSampleUV.x > 1 + || vSampleUV.y < 0 || vSampleUV.y > 1) + { continue; } - float fRecordedSampleViewPosDepth = g_DepthTexture.Sample(PointSampler, sampleUV).y * g_fFar; - float fIsOccluded = (fRecordedSampleViewPosDepth < vViewSamplePos.z - g_fSSAO_BIAS) ? 1.0f : 0.0f; + float fRecordedDepth = g_DepthTexture.Sample(PointSampler, vSampleUV).y * g_fFar; + float fIsOccluded = (fRecordedDepth < vSampleViewPosition.z - g_fSSAO_BIAS) ? 1.0f : 0.0f; - float fRangeCheck = smoothstep(0.f, 1.f, g_fSSAORadius / abs(vViewSamplePos.z - fRecordedSampleViewPosDepth)); + float fRangeCheck = smoothstep(0.f, 1.f, g_fSSAORadius / abs(vSampleViewPosition.z - fRecordedDepth)); fIsOccluded *= fRangeCheck; fOcclusion += fIsOccluded; } fOcclusion = saturate(1.f - (fOcclusion * g_fSSAOStrength / g_iKernelSize) * fRatio); - Out.fOcclusion = fOcclusion ; + Out.fOcclusion = fOcclusion; return Out; } diff --git a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp index 2b7e782da..cf0dea8d1 100644 --- a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp @@ -60,7 +60,7 @@ void CLevel_Logo::Update(_float fTimeDelta) return; #endif // gimch #ifdef 기무리 - if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::OBJECT)))) + if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::EFFECT)))) return; #endif // 기무리 #ifdef 진우 diff --git a/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp index ed64adcad..ce38f9020 100644 --- a/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader_ObjectViewer.cpp @@ -75,15 +75,15 @@ HRESULT CLoader::Loading_For_ObjectViewer() #pragma region MONSTER - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/SK_GOB_M_T4Melee_INST_A_Master.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - // TEXT("Prototype_Component_SK_GOB_M_T4Melee_INST_A_Master_Model") - //)); + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/SK_GOB_M_T4Melee_INST_A_Master.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_SK_GOB_M_T4Melee_INST_A_Master_Model") + )); - //futures.emplace_back(Deferred_ModelLoad( - // MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin_Mage/GoblinMage.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - // TEXT("Prototype_Component_GoblinMage_Model") - //)); + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin_Mage/GoblinMage.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_GoblinMage_Model") + )); //futures.emplace_back(Deferred_ModelLoad( // MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/Goblin_Assassin/SK_GOB_M_Assassin_Master.bin", XMMatrixRotationZ(XMConvertToRadians(180.f)) * XMMatrixIdentity(), diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index c6c5119e0..7afcf773b 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -835,13 +835,17 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) //Dynamic - > Static //부드럽게 전환 - float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static); - float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar; - float fStaticShadowBlendWidthRatio = 0.05f; - float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio); - float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio); - float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight); - + float g_fStaticShadowBlendWidthRatio = 0.05f; + float fStaticShadowBlendEndRatio = min(1.0f, g_fCascadeSplitRatioFar + g_fStaticShadowBlendWidthRatio); + float fStaticShadowBlendWeight = smoothstep( + g_fCascadeSplitRatioFar, + fStaticShadowBlendEndRatio, + fDepthRatio +); + + float fStaticAdjusted = lerp(1.0f, fVisibility_Static, fStaticShadowBlendWeight); + + float fVisibilityCombined = fVisibilityDynamic * fStaticAdjusted; // 2번째 방법 // Dynamic * Static 항상 최소곱 //float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static); diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 4a636da21..f3081f666 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -149,10 +149,7 @@ void CGameInstance::Update_Engine(_float fTimeDelta) m_pKey_Manager->Update(); m_pMouse_Manager->Update(); m_pSound_Manager->Update(); -#ifdef _DEBUG - m_pResource_Manager->Describe_Entity(); - m_pFog->Update_Fog(); -#endif // _DEBUG + m_pPicking->Update(); m_pObject_Manager->Priority_Update(fExcuteTimeDelta); @@ -169,8 +166,6 @@ void CGameInstance::Update_Engine(_float fTimeDelta) m_pLevel_Manager->Update(fExcuteTimeDelta); m_pObject_Manager->Clear_DeadObj(); - - //m_pObstacle_Manager->Refresh_Region(); } HRESULT CGameInstance::Draw() diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index 95ac3b3d9..bc9ae6d65 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -483,23 +483,25 @@ void CPhysX_Manager::Update_Kinematic() if (pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) { - if (nullptr == pBody->userData) { + if (nullptr == pBody->userData) { // UserData nullptr -> 해제됨 ReleasedList.emplace_back(pBody); continue; } PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pBody->userData; if (false == pUserData->bAutoOwnerTranslation) { - continue; + continue; // 유닛의 상태에 따라 Continue 혹은 Apply 분기 } const CTransform* pTransform = pUserData->pOwner->Get_Component(); - pActor->setKinematicTarget(XMWorldToPx_NoScaleNoFlip(pTransform->Get_XMWorldMatrix())); } } } - for (list::iterator ReleasedActor = ReleasedList.begin(); ReleasedActor != ReleasedList.end();) { - Detach_Actor(*(*ReleasedActor), m_pGameInstance->Get_CurrentLevelID()); - ReleasedActor = ReleasedList.erase(ReleasedActor); + { // 해제된 액터 처리 + _uint iCurrentLevel = m_pGameInstance->Get_CurrentLevelID(); + for (list::iterator ReleasedActor = ReleasedList.begin(); ReleasedActor != ReleasedList.end();) { + Detach_Actor(*(*ReleasedActor), iCurrentLevel); + ReleasedActor = ReleasedList.erase(ReleasedActor); + } } } @@ -517,6 +519,7 @@ void CPhysX_Manager::Update(_float fTimeDelta) { // Simulate m_pScene->simulate((PSX::PxReal)fTimeDelta); _bool bResult = m_pScene->fetchResults(true); + assert(bResult); } { // Post Update_Dynamic_ActiveActors(); @@ -529,19 +532,20 @@ void CPhysX_Manager::Update(_float fTimeDelta) void CPhysX_Manager::Update_Dynamic_ActiveActors() { list ReleasedList = {}; - PSX::PxU32 iNumActiveActor = {}; + PSX::PxU32 iNumActiveActor = {}; // 실제 피직스 이동을 한 액터들 PSX::PxActor** ppActiveActors = m_pScene->getActiveActors(iNumActiveActor); for (PSX::PxU32 i = 0; i < iNumActiveActor; ++i) { PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)ppActiveActors[i]->userData; PSX::PxRigidDynamic* pActorDynamic = ppActiveActors[i]->is(); + if (nullptr != pActorDynamic) { - if (nullptr == ppActiveActors[i]->userData) { + if (nullptr == ppActiveActors[i]->userData) { // UserData nullptr -> 해제됨 ReleasedList.emplace_back(ppActiveActors[i]); continue; } if (false == pUserData->bAutoOwnerTranslation) { - continue; + continue; // 유닛의 상태에 따라 Continue 혹은 Apply 분기 } CTransform* pTransform = pUserData->pOwner->Get_Component(); @@ -553,9 +557,12 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors() pTransform->Set_WorldMatrix(WorldMatrix); } } - for (list::iterator ReleasedActor = ReleasedList.begin(); ReleasedActor != ReleasedList.end();) { - Detach_Actor(*(*ReleasedActor), m_pGameInstance->Get_CurrentLevelID()); - ReleasedActor = ReleasedList.erase(ReleasedActor); + { // 해제된 액터 처리 + _uint iCurrentLevel = m_pGameInstance->Get_CurrentLevelID(); + for (list::iterator ReleasedActor = ReleasedList.begin(); ReleasedActor != ReleasedList.end();) { + Detach_Actor(*(*ReleasedActor), iCurrentLevel); + ReleasedActor = ReleasedList.erase(ReleasedActor); + } } } diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp index ac34e5d00..1d5b32fbf 100644 --- a/Jusin154_Team3D/Engine/Private/Transform.cpp +++ b/Jusin154_Team3D/Engine/Private/Transform.cpp @@ -282,11 +282,11 @@ void CTransform::AccumulateMomentum(_fvector vMomentum) } _vector CTransform::Get_CurrentMomentum() const { - return XMLoadFloat3(&m_vMomentum); + return XMLoadFloat3(&m_vMomentum); // 누적값 읽기 } void CTransform::Set_CurrentMomentum(_fvector vMomentum) { - XMStoreFloat3(&m_vMomentum, vMomentum); + XMStoreFloat3(&m_vMomentum, vMomentum); } _vector CTransform::Get_EstimatedPositionByMomentum() const { @@ -294,14 +294,14 @@ _vector CTransform::Get_EstimatedPositionByMomentum() const } void CTransform::RewindMomentum() { - m_vMomentum = m_vBackMomentum; - m_vBackMomentum = { 0.f, 0.f, 0.f }; - m_PrevMatrix = m_WorldMatrix; + m_vMomentum = m_vDeferredTranslation; + m_vDeferredTranslation = { 0.f, 0.f, 0.f }; + m_PrevMatrix = m_WorldMatrix; // Velocity Buffer를 위한 PrevMatrix } void CTransform::BookMomentum(_fvector vMomentum) { - XMStoreFloat3(&m_vBackMomentum, (XMLoadFloat3(&m_vBackMomentum) + XMVectorSetW(vMomentum, 0.f))); + XMStoreFloat3(&m_vDeferredTranslation, (XMLoadFloat3(&m_vDeferredTranslation) + XMVectorSetW(vMomentum, 0.f))); } void CTransform::Turn(_fvector vAxis, _float fTimeDelta) diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h index d399350f7..99a00e5de 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h @@ -23,8 +23,8 @@ #endif // !_DEBUG //#ifdef 기무리 -#define DEBUG_MOTIONBLUR -//#define DEBUG_SSAO +//#define DEBUG_MOTIONBLUR +#define DEBUG_SSAO //#define DEBUG_SHADOW //#define DEBUG_CAMERAS //#endif // 기무리 diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index b0462e465..28a4be8d9 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -104,7 +104,7 @@ class ENGINE_DLL CTransform final : _float m_fRadius = { 20.f }; _float3 m_vMomentum = {}; // 현재 프레임에 계산된 이동량 - _float3 m_vBackMomentum = {}; // 다음 프레임에 계산될 이동량 + _float3 m_vDeferredTranslation = {}; // 다음 프레임에 계산될 이동량 #ifdef RELEASE_DEBUGGER _float3 m_vRotation = {0.f, 0.f, 0.f}; diff --git a/Jusin154_Team3D/UpgradeLog.htm b/Jusin154_Team3D/UpgradeLog.htm new file mode 100644 index 000000000..19c046094 --- /dev/null +++ b/Jusin154_Team3D/UpgradeLog.htm @@ -0,0 +1,283 @@ + + + + 마이그레이션 보고서 +

+ 마이그레이션 보고서 -

개요

프로젝트경로오류경고메시지
ClientClient\Default\Client.vcxproj100
EditorEditor\Default\Editor.vcxproj100
EngineEngine\Default\Engine.vcxproj100
00.Client00.Client000
01.Editor01.Editor000
03.Engine03.Engine000
97.Config97.Config000
98.Batch98.Batch000
ASSIMPASSIMP000
ENGINE_SDKENGINE_SDK000
SOLUTIONSOLUTION000
솔루션Jusin154_Team3D.sln001

솔루션 및 프로젝트

\ No newline at end of file diff --git a/Jusin154_Team3D/UpgradeLog2.htm b/Jusin154_Team3D/UpgradeLog2.htm new file mode 100644 index 000000000..def77691c --- /dev/null +++ b/Jusin154_Team3D/UpgradeLog2.htm @@ -0,0 +1,270 @@ + + + + 마이그레이션 보고서 +

+ 마이그레이션 보고서 -

\ No newline at end of file From 5f5b61ef534fa9603d12ee5e9fc3489a9494c418 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 30 Apr 2026 23:14:27 +0900 Subject: [PATCH 2/3] [add] Render Debugger --- .../Client/Private/BuildingContainer.cpp | 7 +- .../Client/Private/MapObject_Render.cpp | 2 +- Jusin154_Team3D/Engine/Private/Renderer.cpp | 91 ++++++++++++++++++- .../Engine/Private/Renderer_Declare.cpp | 14 +++ Jusin154_Team3D/Engine/Public/GameInstance.h | 3 + Jusin154_Team3D/Engine/Public/Renderer.h | 23 +++++ 6 files changed, 134 insertions(+), 6 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp index 36fe81431..afd217f1a 100644 --- a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp @@ -34,14 +34,17 @@ void CBuildingContainer::Update(_float fTimeDelta) void CBuildingContainer::Late_Update(_float fTimeDelta) { + const _float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold(); + if (m_pGameInstance->IsIn_WorldFrustum(XMVectorSetW(XMLoadFloat3(&m_vExtentWorldPosition), 1.f), m_fRadius)) { - if (m_fCamDepth > 300.f) + if (m_fCamDepth > fDepthOcclusionThreshold) { if (m_pOcclusionQueryCom->isDraw()) __super::Late_Update(fTimeDelta); } - else + else { __super::Late_Update(fTimeDelta); + } m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); diff --git a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp index 3d6ed9238..f9826759b 100644 --- a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp +++ b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp @@ -89,8 +89,8 @@ void CMapObject_Render::Late_Update(_float fTimeDelta) m_iNumMeshe = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); } + Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); } HRESULT CMapObject_Render::Render() diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index eced1af29..99163b0d5 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -253,6 +253,10 @@ void CRenderer::Render_Shadow() { COMPUTE_TIMEDELTA("Timer_Render_Shadow"); EVENTSCOPE_("Render_Shadow"); +#ifdef RELEASE_DEBUGGER + m_ShadowNearBreakdown.Reset(); + m_ShadowMiddleBreakdown.Reset(); +#endif D3D11_VIEWPORT ViewPortOldDesc; _uint iNumViewOldPort = { 1 }; ZeroMemory(&ViewPortOldDesc, sizeof(D3D11_VIEWPORT)); @@ -292,7 +296,11 @@ void CRenderer::Render_Shadow() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_NEAR)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR)); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_ShadowNearBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -326,7 +334,11 @@ void CRenderer::Render_Shadow() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_MIDDLE)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE)); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_ShadowMiddleBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -370,6 +382,9 @@ void CRenderer::Render_NonBlend() COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); EVENTSCOPE_("Render_NonBlend"); m_eType = RENDER::NONBLEND; +#ifdef RELEASE_DEBUGGER + m_NonBlendBreakdown.Reset(); +#endif if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_GameObjects")))) { return; @@ -378,7 +393,11 @@ void CRenderer::Render_NonBlend() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::NONBLEND)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render())) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render()); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_NonBlendBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -393,6 +412,72 @@ void CRenderer::Render_NonBlend() COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); } +#ifdef RELEASE_DEBUGGER +void CRenderer::Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult) +{ + if (nullptr == pRenderObject) { + return; + } + + ++Breakdown.iObjectCount; + if (false == bRenderResult) { + ++Breakdown.iRenderFailCount; + } + + const _uint iObjectTag = pRenderObject->Get_ObjectTag(); + ++Breakdown.ObjectTagCounts[iObjectTag]; + + const _string strTypeName = typeid(*pRenderObject).name(); + ++Breakdown.ObjectTypeCounts[strTypeName]; +} + +void CRenderer::Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN) +{ + if (nullptr == pTitle) { + return; + } + + if (GUI::TreeNode(pTitle)) + { + GUI::Text("Objects: %u / Fail: %u", Breakdown.iObjectCount, Breakdown.iRenderFailCount); + + if (GUI::TreeNode("Top Object Types")) + { + vector> TypeCounts( + Breakdown.ObjectTypeCounts.begin(), Breakdown.ObjectTypeCounts.end()); + sort(TypeCounts.begin(), TypeCounts.end(), + [](const pair<_string, _uint>& Left, const pair<_string, _uint>& Right) { + return Left.second > Right.second; + }); + + const _uint iMaxCount = min<_uint>(iTopN, (_uint)TypeCounts.size()); + for (_uint i = 0; i < iMaxCount; ++i) { + GUI::Text("%u) %s : %u", i + 1, TypeCounts[i].first.c_str(), TypeCounts[i].second); + } + GUI::TreePop(); + } + + if (GUI::TreeNode("Top Object Tags")) + { + vector> TagCounts( + Breakdown.ObjectTagCounts.begin(), Breakdown.ObjectTagCounts.end()); + sort(TagCounts.begin(), TagCounts.end(), + [](const pair<_uint, _uint>& Left, const pair<_uint, _uint>& Right) { + return Left.second > Right.second; + }); + + const _uint iMaxCount = min<_uint>(iTopN, (_uint)TagCounts.size()); + for (_uint i = 0; i < iMaxCount; ++i) { + GUI::Text("%u) Tag[%u] : %u", i + 1, TagCounts[i].first, TagCounts[i].second); + } + GUI::TreePop(); + } + + GUI::TreePop(); + } +} +#endif // RELEASE_DEBUGGER + void CRenderer::Render_Decal() { m_pGameInstance->Copy_RenderTargetAToB(TEXT("Target_Normal"), TEXT("Target_NormalCopy")); diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index 5b52ed677..a2732f9b7 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -722,6 +722,10 @@ void CRenderer::Describe_Entitiy() 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); + _float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold(); + if (GUI::SliderFloat("DepthOcclusionThreshold", &fDepthOcclusionThreshold, 50.f, 150.f, "%.1f")) { + m_pGameInstance->Set_DepthOcclusionThreshold(fDepthOcclusionThreshold); + } } if (GUI::CollapsingHeader("PostProcessing_Bloom")) { @@ -749,6 +753,16 @@ 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("Render_Breakdown")) + { + GUI::Checkbox("Show Breakdown", &m_bShowRenderBreakdown); + if (m_bShowRenderBreakdown) + { + Draw_RenderBreakdown("NonBlend", m_NonBlendBreakdown, 10); + Draw_RenderBreakdown("Shadow_Near", m_ShadowNearBreakdown, 10); + Draw_RenderBreakdown("Shadow_Middle", m_ShadowMiddleBreakdown, 10); + } + } #ifdef _DEBUG if (GUI::Button("Refresh_Shader")) { m_pShader->Shader_Refresh(); diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index a956becc9..7c9382f14 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -32,6 +32,8 @@ class ENGINE_DLL CGameInstance final : public CBase void Set_RenderCollider(_bool bRender) { m_bRenderCollider = bRender; } void Toggle_RenderCollider() { m_bRenderCollider = !m_bRenderCollider; } #endif RELEASE_DEBUGGER + _float Get_DepthOcclusionThreshold() const { return m_fDepthOcclusionThreshold; } + void Set_DepthOcclusionThreshold(_float fThreshold) { m_fDepthOcclusionThreshold = max(50.f, min(150.f, fThreshold)); } #pragma region GRAPHIC_DEVICE public: void Render_Begin(const _float4* pClearColor); @@ -392,6 +394,7 @@ class ENGINE_DLL CGameInstance final : public CBase #endif // _DEBUG _bool m_bRenderCollider = false; _bool m_bRenderSystem = false; + _float m_fDepthOcclusionThreshold = 120.f; map m_sModelMap; public: diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index 60a2c1020..954c64b7a 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -39,6 +39,27 @@ class CRenderer final : public CBase #ifdef RELEASE_DEBUGGER private: list m_DebugComponents; + + struct RENDER_PASS_BREAKDOWN + { + _uint iObjectCount = 0; + _uint iRenderFailCount = 0; + unordered_map<_string, _uint> ObjectTypeCounts = {}; + unordered_map<_uint, _uint> ObjectTagCounts = {}; + + void Reset() + { + iObjectCount = 0; + iRenderFailCount = 0; + ObjectTypeCounts.clear(); + ObjectTagCounts.clear(); + } + }; + + RENDER_PASS_BREAKDOWN m_NonBlendBreakdown = {}; + RENDER_PASS_BREAKDOWN m_ShadowNearBreakdown = {}; + RENDER_PASS_BREAKDOWN m_ShadowMiddleBreakdown = {}; + _bool m_bShowRenderBreakdown = true; #endif private: class CShader* m_pShader = { nullptr }; @@ -146,6 +167,8 @@ class CRenderer final : public CBase #ifdef RELEASE_DEBUGGER private: void Render_Debug(); + void Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult); + void Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN = 10); #endif private: From f03d4e9a0a8b63c9ec39e7b65e785bee8e731be3 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 30 Apr 2026 23:14:27 +0900 Subject: [PATCH 3/3] [add] Render Debugger --- .../Client/Private/BuildingContainer.cpp | 7 +- .../Client/Private/MapObject_Render.cpp | 2 +- Jusin154_Team3D/Engine/Private/Renderer.cpp | 91 ++++++++++++++++++- .../Engine/Private/Renderer_Declare.cpp | 14 +++ Jusin154_Team3D/Engine/Public/GameInstance.h | 3 + Jusin154_Team3D/Engine/Public/Renderer.h | 23 +++++ 6 files changed, 134 insertions(+), 6 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp index 36fe81431..afd217f1a 100644 --- a/Jusin154_Team3D/Client/Private/BuildingContainer.cpp +++ b/Jusin154_Team3D/Client/Private/BuildingContainer.cpp @@ -34,14 +34,17 @@ void CBuildingContainer::Update(_float fTimeDelta) void CBuildingContainer::Late_Update(_float fTimeDelta) { + const _float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold(); + if (m_pGameInstance->IsIn_WorldFrustum(XMVectorSetW(XMLoadFloat3(&m_vExtentWorldPosition), 1.f), m_fRadius)) { - if (m_fCamDepth > 300.f) + if (m_fCamDepth > fDepthOcclusionThreshold) { if (m_pOcclusionQueryCom->isDraw()) __super::Late_Update(fTimeDelta); } - else + else { __super::Late_Update(fTimeDelta); + } m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this); diff --git a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp index 3d6ed9238..f9826759b 100644 --- a/Jusin154_Team3D/Client/Private/MapObject_Render.cpp +++ b/Jusin154_Team3D/Client/Private/MapObject_Render.cpp @@ -89,8 +89,8 @@ void CMapObject_Render::Late_Update(_float fTimeDelta) m_iNumMeshe = m_pModelComs[m_iLodIndex]->Get_NumMeshes(); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); } + Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); } HRESULT CMapObject_Render::Render() diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index eced1af29..99163b0d5 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -253,6 +253,10 @@ void CRenderer::Render_Shadow() { COMPUTE_TIMEDELTA("Timer_Render_Shadow"); EVENTSCOPE_("Render_Shadow"); +#ifdef RELEASE_DEBUGGER + m_ShadowNearBreakdown.Reset(); + m_ShadowMiddleBreakdown.Reset(); +#endif D3D11_VIEWPORT ViewPortOldDesc; _uint iNumViewOldPort = { 1 }; ZeroMemory(&ViewPortOldDesc, sizeof(D3D11_VIEWPORT)); @@ -292,7 +296,11 @@ void CRenderer::Render_Shadow() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_NEAR)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR)); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_ShadowNearBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -326,7 +334,11 @@ void CRenderer::Render_Shadow() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_MIDDLE)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE)); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_ShadowMiddleBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -370,6 +382,9 @@ void CRenderer::Render_NonBlend() COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); EVENTSCOPE_("Render_NonBlend"); m_eType = RENDER::NONBLEND; +#ifdef RELEASE_DEBUGGER + m_NonBlendBreakdown.Reset(); +#endif if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_GameObjects")))) { return; @@ -378,7 +393,11 @@ void CRenderer::Render_NonBlend() for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::NONBLEND)]) { if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render())) { + const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render()); +#ifdef RELEASE_DEBUGGER + Collect_RenderBreakdown(m_NonBlendBreakdown, pRenderObject, bRenderSuccess); +#endif + if (false == bRenderSuccess) { assert(false); } } @@ -393,6 +412,72 @@ void CRenderer::Render_NonBlend() COMPUTE_TIMEDELTA("Timer_Render_NonBlend"); } +#ifdef RELEASE_DEBUGGER +void CRenderer::Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult) +{ + if (nullptr == pRenderObject) { + return; + } + + ++Breakdown.iObjectCount; + if (false == bRenderResult) { + ++Breakdown.iRenderFailCount; + } + + const _uint iObjectTag = pRenderObject->Get_ObjectTag(); + ++Breakdown.ObjectTagCounts[iObjectTag]; + + const _string strTypeName = typeid(*pRenderObject).name(); + ++Breakdown.ObjectTypeCounts[strTypeName]; +} + +void CRenderer::Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN) +{ + if (nullptr == pTitle) { + return; + } + + if (GUI::TreeNode(pTitle)) + { + GUI::Text("Objects: %u / Fail: %u", Breakdown.iObjectCount, Breakdown.iRenderFailCount); + + if (GUI::TreeNode("Top Object Types")) + { + vector> TypeCounts( + Breakdown.ObjectTypeCounts.begin(), Breakdown.ObjectTypeCounts.end()); + sort(TypeCounts.begin(), TypeCounts.end(), + [](const pair<_string, _uint>& Left, const pair<_string, _uint>& Right) { + return Left.second > Right.second; + }); + + const _uint iMaxCount = min<_uint>(iTopN, (_uint)TypeCounts.size()); + for (_uint i = 0; i < iMaxCount; ++i) { + GUI::Text("%u) %s : %u", i + 1, TypeCounts[i].first.c_str(), TypeCounts[i].second); + } + GUI::TreePop(); + } + + if (GUI::TreeNode("Top Object Tags")) + { + vector> TagCounts( + Breakdown.ObjectTagCounts.begin(), Breakdown.ObjectTagCounts.end()); + sort(TagCounts.begin(), TagCounts.end(), + [](const pair<_uint, _uint>& Left, const pair<_uint, _uint>& Right) { + return Left.second > Right.second; + }); + + const _uint iMaxCount = min<_uint>(iTopN, (_uint)TagCounts.size()); + for (_uint i = 0; i < iMaxCount; ++i) { + GUI::Text("%u) Tag[%u] : %u", i + 1, TagCounts[i].first, TagCounts[i].second); + } + GUI::TreePop(); + } + + GUI::TreePop(); + } +} +#endif // RELEASE_DEBUGGER + void CRenderer::Render_Decal() { m_pGameInstance->Copy_RenderTargetAToB(TEXT("Target_Normal"), TEXT("Target_NormalCopy")); diff --git a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp index 5b52ed677..a2732f9b7 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer_Declare.cpp @@ -722,6 +722,10 @@ void CRenderer::Describe_Entitiy() 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); + _float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold(); + if (GUI::SliderFloat("DepthOcclusionThreshold", &fDepthOcclusionThreshold, 50.f, 150.f, "%.1f")) { + m_pGameInstance->Set_DepthOcclusionThreshold(fDepthOcclusionThreshold); + } } if (GUI::CollapsingHeader("PostProcessing_Bloom")) { @@ -749,6 +753,16 @@ 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("Render_Breakdown")) + { + GUI::Checkbox("Show Breakdown", &m_bShowRenderBreakdown); + if (m_bShowRenderBreakdown) + { + Draw_RenderBreakdown("NonBlend", m_NonBlendBreakdown, 10); + Draw_RenderBreakdown("Shadow_Near", m_ShadowNearBreakdown, 10); + Draw_RenderBreakdown("Shadow_Middle", m_ShadowMiddleBreakdown, 10); + } + } #ifdef _DEBUG if (GUI::Button("Refresh_Shader")) { m_pShader->Shader_Refresh(); diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index a956becc9..09507144f 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -32,6 +32,8 @@ class ENGINE_DLL CGameInstance final : public CBase void Set_RenderCollider(_bool bRender) { m_bRenderCollider = bRender; } void Toggle_RenderCollider() { m_bRenderCollider = !m_bRenderCollider; } #endif RELEASE_DEBUGGER + _float Get_DepthOcclusionThreshold() const { return m_fDepthOcclusionThreshold; } + void Set_DepthOcclusionThreshold(_float fThreshold) { m_fDepthOcclusionThreshold = max(50.f, min(150.f, fThreshold)); } #pragma region GRAPHIC_DEVICE public: void Render_Begin(const _float4* pClearColor); @@ -392,6 +394,7 @@ class ENGINE_DLL CGameInstance final : public CBase #endif // _DEBUG _bool m_bRenderCollider = false; _bool m_bRenderSystem = false; + _float m_fDepthOcclusionThreshold = 50.f; map m_sModelMap; public: diff --git a/Jusin154_Team3D/Engine/Public/Renderer.h b/Jusin154_Team3D/Engine/Public/Renderer.h index 60a2c1020..954c64b7a 100644 --- a/Jusin154_Team3D/Engine/Public/Renderer.h +++ b/Jusin154_Team3D/Engine/Public/Renderer.h @@ -39,6 +39,27 @@ class CRenderer final : public CBase #ifdef RELEASE_DEBUGGER private: list m_DebugComponents; + + struct RENDER_PASS_BREAKDOWN + { + _uint iObjectCount = 0; + _uint iRenderFailCount = 0; + unordered_map<_string, _uint> ObjectTypeCounts = {}; + unordered_map<_uint, _uint> ObjectTagCounts = {}; + + void Reset() + { + iObjectCount = 0; + iRenderFailCount = 0; + ObjectTypeCounts.clear(); + ObjectTagCounts.clear(); + } + }; + + RENDER_PASS_BREAKDOWN m_NonBlendBreakdown = {}; + RENDER_PASS_BREAKDOWN m_ShadowNearBreakdown = {}; + RENDER_PASS_BREAKDOWN m_ShadowMiddleBreakdown = {}; + _bool m_bShowRenderBreakdown = true; #endif private: class CShader* m_pShader = { nullptr }; @@ -146,6 +167,8 @@ class CRenderer final : public CBase #ifdef RELEASE_DEBUGGER private: void Render_Debug(); + void Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult); + void Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN = 10); #endif private: