From 53934ad2218f54c6fb449b65cf732aa1359770a2 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Mon, 29 Dec 2025 17:30:02 +0900 Subject: [PATCH] [add] OutLine_DSS [fix] XMLPass --- .../Client/Private/BroomRacerAI.cpp | 2 +- .../Client/Private/Goblin_Assassin.cpp | 22 ++- Jusin154_Team3D/Client/Private/Monster.cpp | 10 +- Jusin154_Team3D/Client/Private/Player.cpp | 2 +- Jusin154_Team3D/Client/Private/Ranrok.cpp | 84 +++++++++++- Jusin154_Team3D/Client/Private/Troll.cpp | 19 ++- Jusin154_Team3D/Client/Public/Client_Enum.h | 2 +- Jusin154_Team3D/Client/Public/Ranrok.h | 1 + .../Npc/EleazarFig/Professor_EleazarFig.xml | 2 +- .../EleazarFig/Professor_EleazarFig_Anim.xml | 2 +- .../Monster/ConjuredDragon/ConjuredDragon.xml | 16 +-- .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 128 ++---------------- .../Editor/Private/DummyObject.cpp | 2 +- Jusin154_Team3D/Editor/Private/Ranrok.cpp | 18 ++- Jusin154_Team3D/Editor/Public/Editor_Define.h | 2 +- .../Engine/Private/GameInstance.cpp | 12 +- Jusin154_Team3D/Engine/Private/Model.cpp | 9 +- Jusin154_Team3D/Engine/Private/PipeLine.cpp | 54 +++++++- Jusin154_Team3D/Engine/Public/GameInstance.h | 2 + Jusin154_Team3D/Engine/Public/Model.h | 2 +- Jusin154_Team3D/Engine/Public/PipeLine.h | 13 +- 21 files changed, 240 insertions(+), 164 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp index d2f1f3c84..68bcb4d7e 100644 --- a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp @@ -174,7 +174,7 @@ HRESULT CBroomRacerAI::Render() } if (m_pModelCom->Get_Type() == MODEL::PBR_ANIM) { - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, false))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp index 9f2534bdf..59b0b8394 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp @@ -175,16 +175,23 @@ HRESULT CGoblin_Assassin::Render() return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } } if (true == m_bDrawOutLine) { @@ -222,13 +229,16 @@ HRESULT CGoblin_Assassin::Render_OutLine() } Compute_Depth(); - _float fRatio = (m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar()); + _float fRatio = CMyTools::Saturate((m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar())); m_fOutLineThickness = CMyTools::Lerp_f1D(0.01f, 0.1f, fRatio); - if (m_fOutLineThickness > 0.1f) { - m_fOutLineThickness = 0.1f; + if (FAILED(m_pShaderCom->Bind_Matrix("g_PrevWorldMatrix", m_pTransformCom->Get_PrevWorldMatrixPtr()))) { + return E_FAIL; } - else if (m_fOutLineThickness < 0.01f) { - m_fOutLineThickness = 0.01f; + 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_RawValue("g_vOutLineColor", &m_vOutLineColor, sizeof(_float3)))) { return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/Monster.cpp b/Jusin154_Team3D/Client/Private/Monster.cpp index 965bc70d3..953e311b3 100644 --- a/Jusin154_Team3D/Client/Private/Monster.cpp +++ b/Jusin154_Team3D/Client/Private/Monster.cpp @@ -28,7 +28,7 @@ HRESULT CMonster::Initialize(void* pArg) } m_pInfoInstance->Regist_ActiveMonster(this); - + return S_OK; } @@ -115,14 +115,8 @@ HRESULT CMonster::Render_OutLine() return E_FAIL; } Compute_Depth(); - _float fRatio = (m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar()); + _float fRatio = CMyTools::Saturate((m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar())); m_fOutLineThickness = CMyTools::Lerp_f1D(2.f, 6.f, fRatio); - if (m_fOutLineThickness > 6.f) { - m_fOutLineThickness = 6.f; - } - else if (m_fOutLineThickness < 2.f) { - m_fOutLineThickness = 2.f; - } if (FAILED(m_pShaderCom->Bind_RawValue("g_vOutLineColor", &m_vOutLineColor, sizeof(_float3)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 70979be40..9a2eaae22 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -273,7 +273,7 @@ HRESULT CPlayer::Render() { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, false))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Ranrok.cpp b/Jusin154_Team3D/Client/Private/Ranrok.cpp index 14f0c98b0..fafcd5096 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok.cpp @@ -436,16 +436,23 @@ HRESULT CRanrok::Render_Nonblend() if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } } if (m_bDrawOutLine) { @@ -498,7 +505,79 @@ HRESULT CRanrok::Render_Blend() if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + return E_FAIL; + } + + m_pModelCom->Bind_OutPut_SRV_VS(26, 0); + m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } + } + + return S_OK; +} +HRESULT CRanrok::Render_OutLine() +{ + m_bDrawOutLine = false; + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + Compute_Depth(); + _float fRatio = CMyTools::Saturate((m_fCamDepth / *m_pGameInstance->Get_CurrentCameraFar())); + m_fOutLineThickness = CMyTools::Lerp_f1D(2.f, 6.f, fRatio); + 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_RawValue("g_vOutLineColor", &m_vOutLineColor, sizeof(_float3)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLineThickness", &m_fOutLineThickness, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLineScale", &m_fOutLineScale, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOutLinePower", &m_fOutLinePower, sizeof(_float)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) { + return E_FAIL; + } + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pShaderCom->Bind_Matrices( + "g_OffsetMatrix", + m_pModelCom->Get_OffsetMatrix(i).data(), + (_int)m_pModelCom->Get_OffsetMatrix(i).size() + ))) + { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_NPC_PBR_ANIM::OUTLINE_READ)))) { return E_FAIL; } @@ -509,7 +588,6 @@ HRESULT CRanrok::Render_Blend() return E_FAIL; } } - return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Troll.cpp b/Jusin154_Team3D/Client/Private/Troll.cpp index 68ba708b4..2b2a8d415 100644 --- a/Jusin154_Team3D/Client/Private/Troll.cpp +++ b/Jusin154_Team3D/Client/Private/Troll.cpp @@ -197,16 +197,24 @@ HRESULT CTroll::Render() return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } } if (true == m_bDrawOutLine) { @@ -252,6 +260,15 @@ HRESULT CTroll::Render_OutLine() else if (m_fOutLineThickness < 2.f) { m_fOutLineThickness = 2.f; } + 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_RawValue("g_vOutLineColor", &m_vOutLineColor, sizeof(_float3)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 4c825a93d..8a40d9c90 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -25,7 +25,7 @@ namespace Client enum class SHADER_PASS_NPC_PBR_ANIM { EYELASH_DAOTHV_ToSRO, TEETH_SRXO_ToSRO, EYE_DN_ToSRO, EYE_OCC, FACIAL_HAIR_DAOTHV_ToSRO, HEAD_HAIR_DAOTHV_ToSRO, HEADwtHAND_DSRXON_ToSRO, LOWER_DSRON_ToSRO, UPPER_DMRON_ToMRO, GLASSES_DMRON_ToMRO, EmissiveMetalness_DENMRO_ToMRO, MI_ClothSim_DSEN_ToSRO, MI_Troll_Club_DAENMROSRXO_To - , OUTLINE_READ, TEETH_SRXO_ToSRO__OUTLINE_WRITE, EYE_DN_ToSRO__OUTLINE_WRITE, HEADwtHAND_DSRXON_ToSRO__OUTLINE_WRITE, UPPER_DMRON_ToMRO__OUTLINE_WRITE, EmissiveMetalness_DENMRO_ToMRO__OUTLINE_WRITE, MI_ClothSim_DSEN_ToSRO__OUTLINE_WRITE + , OUTLINE_READ , END }; enum class UI_STATE { GAMEPLAYER, SPELL, QUEST, INVENTORY, SPELLLNEARN, END }; diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 464ed9958..b2f6cf838 100644 --- a/Jusin154_Team3D/Client/Public/Ranrok.h +++ b/Jusin154_Team3D/Client/Public/Ranrok.h @@ -48,6 +48,7 @@ class CRanrok final : public CMonster virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + virtual HRESULT Render_OutLine() override; virtual HRESULT Render_Shadow(SHADOW eType) override; virtual _vector Get_LockOnPos() override; virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr)override; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.xml index 63a17c1c2..c41c58940 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig.xml @@ -173,7 +173,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.xml index 63a17c1c2..ca2a1c2a6 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.xml @@ -173,7 +173,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.xml index b82a6a608..52cde6bca 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.xml @@ -1,5 +1,5 @@ - + @@ -28,7 +28,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -173,7 +173,7 @@ - + @@ -202,7 +202,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 5ad2199ac..0786c3caa 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -1334,62 +1334,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN_OUTLINE_READ(); } - pass TEETH_SRXO_ToSRO__OUTLINE_WRITE // 14 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_TEETH_SRXO_ToSRO(); - } - pass EYE_DN_ToSRO__OUTLINE_WRITE // 15 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_EYE_DN_SRO(); - } - pass HEADwtHAND_DSRXON_ToSRO__OUTLINE_WRITE // 16 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_HEADwtHAND_DSRXON_ToSRO(); - } - pass UPPER_DMRON_ToMRO__OUTLINE_WRITE // 17 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_UPPER_DMRON_ToMRO(); - } - pass EmissiveMetalness_DENMRO_ToMRO__OUTLINE_WRITE // 18 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_EmissiveMetalness_DENMRO_ToMRO(); - } - pass MI_ClothSim_DSEN_ToSRO__OUTLINE_WRITE // 19 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MI_ClothSim_DSEN_ToSRO(); - } -/////// - pass MI_DANSROMRO_ToSRO // 20 + pass MI_DANSROMRO_ToSRO // 14 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1398,26 +1343,8 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MI_DANSROMRO_ToSRO(); } - pass MI_DANSROMRO_ToSRO_OUTLINE_WRITE // 21 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_MI_DANSROMRO_ToSRO(); - } - pass DNMRO_ToMRO__OUTLINE_WRITE // 22 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_DNMRO_ToMRO(); - } //// DRAGON - pass DragonAuraPass // 23 + pass DragonAuraPass // 15 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1426,7 +1353,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_Aura(); } - pass DragonEtherealEyesPass // 24 + pass DragonEtherealEyesPass // 16 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1435,16 +1362,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_EtherealEyes(); } - pass DragonEtherealEyes_OUTLINE_WRITEPass // 25 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_Dragon_EtherealEyes(); - } - pass DragonEtherealWingsPass // 26 + pass DragonEtherealWingsPass // 17 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1453,7 +1371,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_EtherealWings(); } - pass DragonWingsPass // 27 + pass DragonWingsPass // 18 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1462,16 +1380,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_Wings(); } - pass DragonWings_OUTLINE_WRITEPass // 28 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_Dragon_Wings(); - } - pass DragonBodyPass // 29 + pass DragonBodyPass // 19 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1480,16 +1389,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_Body(); } - pass DragonBody_OUTLINE_WRITEPass // 30 - { - SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default_OutLine_SWrite, 2); - SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); - VertexShader = compile vs_5_0 VS_MAIN(); - GeometryShader = NULL; - PixelShader = compile ps_5_0 PS_Dragon_Body(); - } - pass DragonRedHotPass // 31 + pass DragonRedHotPass // 20 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1498,7 +1398,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_RedHot(); } - pass DragonPinkHotPass // 32 + pass DragonPinkHotPass // 21 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1507,7 +1407,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Dragon_PinkHot(); } - pass DragonYellowHotPass // 33 + pass DragonYellowHotPass // 22 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1517,7 +1417,7 @@ technique11 DefaultTechnique PixelShader = compile ps_5_0 PS_Dragon_YellowHot(); } //// PLAYER_ - pass PLAYER_HAIR_DAOTHV_ToSRO // 34 + pass PLAYER_HAIR_DAOTHV_ToSRO // 23 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1526,7 +1426,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_HairDAOTHV_ToSRO(); } - pass PLAYER_Suit_DSRON_ToSRO // 35 + pass PLAYER_Suit_DSRON_ToSRO // 24 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1535,7 +1435,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_Suit_DSRON_ToSRO(); } - pass PLAYER_EyeLash_DAOTHV_ToSRO // 36 + pass PLAYER_EyeLash_DAOTHV_ToSRO // 25 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1544,7 +1444,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_EyeLash_DAOTHV_ToSRO(); } - pass PLAYER_Eye_ToSRO // 37 + pass PLAYER_Eye_ToSRO // 26 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); @@ -1553,7 +1453,7 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Player_Eye_ToMRO(); } - pass PLAYER_Robe_ToMRO // 38 + pass PLAYER_Robe_ToMRO // 27 { SetRasterizerState(RS_Default); SetDepthStencilState(DSS_Default, 0); diff --git a/Jusin154_Team3D/Editor/Private/DummyObject.cpp b/Jusin154_Team3D/Editor/Private/DummyObject.cpp index 41616f309..5924e3c82 100644 --- a/Jusin154_Team3D/Editor/Private/DummyObject.cpp +++ b/Jusin154_Team3D/Editor/Private/DummyObject.cpp @@ -84,7 +84,7 @@ HRESULT CDummyObject::Render() if (m_pModelCom->Get_Type() == MODEL::PBR_ANIM) { - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, false))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Ranrok.cpp b/Jusin154_Team3D/Editor/Private/Ranrok.cpp index ae6d38f6f..8ad10ca23 100644 --- a/Jusin154_Team3D/Editor/Private/Ranrok.cpp +++ b/Jusin154_Team3D/Editor/Private/Ranrok.cpp @@ -418,16 +418,23 @@ HRESULT CRanrok::Render_Nonblend() if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } } if (m_bDrawOutLine) { @@ -480,16 +487,23 @@ HRESULT CRanrok::Render_Blend() if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - if (FAILED(m_pModelCom->Begin(i, m_pShaderCom, m_bDrawOutLine))) { + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { return E_FAIL; } m_pModelCom->Bind_OutPut_SRV_VS(26, 0); m_pModelCom->Bind_OutPut_SRV_VS_Prev(27, 0); + if (true == m_bDrawOutLine) { + m_pGameInstance->Begin_OutLine_Write(2); + } if (FAILED(m_pModelCom->Render(i))) { return E_FAIL; } + + if (true == m_bDrawOutLine) { + m_pGameInstance->End_OutLine_Write(); + } } return S_OK; diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 0c933939a..9d74c1d76 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -20,7 +20,7 @@ namespace Editor enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, HAIR, EYELASH, OUTLINE_WRITE, OUTLINE_READ, SPECTOR, END }; enum class SHADER_PASS_NPC_PBR_ANIM { EYELASH_DAOTHV_ToSRO, TEETH_SRXO_ToSRO, EYE_DN_ToSRO, EYE_OCC, FACIAL_HAIR_DAOTHV_ToSRO, HEAD_HAIR_DAOTHV_ToSRO, HEADwtHAND_DSRXON_ToSRO, LOWER_DSRON_ToSRO, UPPER_DMRON_ToMRO, GLASSES_DMRON_ToMRO, EmissiveMetalness_DENMRO_ToMRO, MI_ClothSim_DSEN_ToSRO, MI_Troll_Club_DAENMROSRXO_To - , OUTLINE_READ, TEETH_SRXO_ToSRO__OUTLINE_WRITE, EYE_DN_ToSRO__OUTLINE_WRITE, HEADwtHAND_DSRXON_ToSRO__OUTLINE_WRITE, UPPER_DMRON_ToMRO__OUTLINE_WRITE, EmissiveMetalness_DENMRO_ToMRO__OUTLINE_WRITE, MI_ClothSim_DSEN_ToSRO__OUTLINE_WRITE + , OUTLINE_READ , END}; enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL, GLASS, OUTLINE_WRITE, OUTLINE_READ, BLOOM, LAKE, END }; enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, ENV_TERRAIN_ANISO, SHADOW, END }; diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index d6d82f0ac..92764d4e5 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -82,7 +82,7 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De if (nullptr == m_pKey_Manager) { return E_FAIL; } - m_pPipeLine = CPipeLine::Create(); + m_pPipeLine = CPipeLine::Create(*ppDevice, *ppContext); if (nullptr == m_pPipeLine) { return E_FAIL; } @@ -794,6 +794,16 @@ _float CGameInstance::Get_ShadowBoxFar(_uint iShadowBoxIndex) return m_pPipeLine->Get_ShadowBoxFar(iShadowBoxIndex); } +HRESULT CGameInstance::Begin_OutLine_Write(_uint iDSSRef) +{ + return m_pPipeLine->Begin_OutLine_Write(iDSSRef); +} + +HRESULT CGameInstance::End_OutLine_Write() +{ + return m_pPipeLine->End_OutLine_Write(); +} + void CGameInstance::Add_Light(_uint _iCurrentLevel, CLight* _pLight) { m_pLight_Manager->Add_Light(_iCurrentLevel, _pLight); diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 748494f1d..a9784e5a2 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -95,7 +95,7 @@ HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader) return m_Materials[iMaterialIndex]->Bind_SRV(pShader, m_eType); } -HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader, _bool OutLine) +HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader) { if (iMeshIndex >= m_iNumMeshes) { return E_FAIL; @@ -107,12 +107,7 @@ HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader, _bool OutLine) return E_FAIL; } HRESULT hr = { E_FAIL }; - if (false == OutLine) { - hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_UsingPass()); - } - else { - hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_OutLinePass()); - } + hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_UsingPass()); return hr; } diff --git a/Jusin154_Team3D/Engine/Private/PipeLine.cpp b/Jusin154_Team3D/Engine/Private/PipeLine.cpp index 9647912da..cbbf27b7c 100644 --- a/Jusin154_Team3D/Engine/Private/PipeLine.cpp +++ b/Jusin154_Team3D/Engine/Private/PipeLine.cpp @@ -3,9 +3,13 @@ #include "Shader.h" #include "GameInstance.h" -CPipeLine::CPipeLine() - :m_pGameInstance(CGameInstance::GetInstance()) +CPipeLine::CPipeLine(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : m_pDevice{ pDevice } + , m_pContext{ pContext } + , m_pGameInstance{ CGameInstance::GetInstance() } { + SAFE_ADDREF(m_pDevice); + SAFE_ADDREF(m_pContext); SAFE_ADDREF(m_pGameInstance); } @@ -150,6 +154,20 @@ HRESULT CPipeLine::Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::pat return S_OK; } +HRESULT CPipeLine::Begin_OutLine_Write(_uint iDSSRef) +{ + m_pContext->OMGetDepthStencilState(&m_pPrevDSS, &m_iPrevDSSRef); + m_pContext->OMSetDepthStencilState(m_pDSS_OutLineWrite, iDSSRef); + return S_OK; +} + +HRESULT CPipeLine::End_OutLine_Write() +{ + m_pContext->OMSetDepthStencilState(m_pPrevDSS, m_iPrevDSSRef); + SAFE_RELEASE(m_pPrevDSS); + return S_OK; +} + HRESULT CPipeLine::Ready_Shadow_Light(const _float4& vShadowDirRPYQuat) { _vector vShadowQuat = XMQuaternionNormalize(XMLoadFloat4(&vShadowDirRPYQuat)); @@ -256,6 +274,30 @@ HRESULT CPipeLine::Initialize() XMStoreFloat4x4(&m_TransformStateMatrices[i], XMMatrixIdentity()); } + if (nullptr == m_pDSS_OutLineWrite) { + D3D11_DEPTH_STENCIL_DESC depthStencilDescription{}; + depthStencilDescription.DepthEnable = TRUE; + depthStencilDescription.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; // true에 해당 + depthStencilDescription.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; // less_equal + + depthStencilDescription.StencilEnable = TRUE; + depthStencilDescription.StencilReadMask = 0xFF; + depthStencilDescription.StencilWriteMask = 0xFF; + + // FrontFace + depthStencilDescription.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; + depthStencilDescription.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; + depthStencilDescription.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE; // Replace + depthStencilDescription.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; // Always + + // BackFace + depthStencilDescription.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; + depthStencilDescription.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP; + depthStencilDescription.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE; + depthStencilDescription.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; + m_pDevice->CreateDepthStencilState(&depthStencilDescription, &m_pDSS_OutLineWrite); + } + return S_OK; } @@ -440,9 +482,9 @@ ID3D11ShaderResourceView* CPipeLine::Find_GlobalShaderResourceView(const _tchar* return (*iter).second; } -CPipeLine* CPipeLine::Create() +CPipeLine* CPipeLine::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { - CPipeLine* pInstance = new CPipeLine(); + CPipeLine* pInstance = new CPipeLine(pDevice, pContext); if (FAILED(pInstance->Initialize())) { @@ -455,6 +497,10 @@ CPipeLine* CPipeLine::Create() void CPipeLine::Free() { __super::Free(); + SAFE_RELEASE(m_pDevice); + SAFE_RELEASE(m_pContext); + SAFE_RELEASE(m_pDSS_OutLineWrite); + SAFE_RELEASE(m_pGameInstance); for (auto& pairSRV : m_mapGlobalSRV) { SAFE_RELEASE(pairSRV.second); } diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 18535b8c0..bcc4eb697 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -151,6 +151,8 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const; const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex); _float Get_ShadowBoxFar(_uint iShadowBoxIndex); + HRESULT Begin_OutLine_Write(_uint iDSSMask); + HRESULT End_OutLine_Write(); #pragma endregion #pragma region LIGHT_MANAGER void Add_Light(_uint _iCurrentLevel, class CLight* _pLight); diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index a633231c9..d1d36466f 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -121,7 +121,7 @@ class ENGINE_DLL CModel final : public CComponent #pragma endregion #pragma region Material HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader); - HRESULT Begin(_uint iMeshIndex, class CShader* pShader, _bool OutLine = false); + HRESULT Begin(_uint iMeshIndex, class CShader* pShader); #pragma endregion void ComputeAnimation(_uint AnimIndex, _uint MeshIndex); diff --git a/Jusin154_Team3D/Engine/Public/PipeLine.h b/Jusin154_Team3D/Engine/Public/PipeLine.h index 5a3557e6d..d03bc8752 100644 --- a/Jusin154_Team3D/Engine/Public/PipeLine.h +++ b/Jusin154_Team3D/Engine/Public/PipeLine.h @@ -21,7 +21,7 @@ cascade class CPipeLine final : public CBase { private: - CPipeLine(); + CPipeLine(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual ~CPipeLine() = default; public: void Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix); @@ -43,6 +43,9 @@ class CPipeLine final : public CBase HRESULT Bind_GlobalSRV(class CShader* pShader, const _tchar* wszKeyGlobalSRV, const _char* pConstantName); HRESULT Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::path pathSRVFolder); + HRESULT Begin_OutLine_Write(_uint iDSSRef); + HRESULT End_OutLine_Write(); + HRESULT Ready_Shadow_Light(const _float4& vShadowDirRPYQuat); HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const; const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex); @@ -51,6 +54,8 @@ class CPipeLine final : public CBase void Update(); // Objects의 Priority, Update사이에서 불려야만 함 private: + ID3D11Device* m_pDevice = { nullptr }; + ID3D11DeviceContext* m_pContext = { nullptr }; class CGameInstance* m_pGameInstance = { nullptr }; _float4x4 m_TransformStateMatrices[ENUM_CLASS(D3DTS::END)] = {}; _float4x4 m_ShadowTransformStateMatrices[3][ENUM_CLASS(D3DTS::END)] = {}; @@ -83,6 +88,10 @@ class CPipeLine final : public CBase _float4 m_vShadowInvDirectionalRPYQuat = { 0.f, 0.f, 0.f, 1.f }; unordered_map<_wstring, ID3D11ShaderResourceView*> m_mapGlobalSRV = {}; + ID3D11DepthStencilState* m_pDSS_OutLineWrite = { nullptr }; + ID3D11DepthStencilState* m_pPrevDSS = { nullptr }; + _uint m_iPrevDSSRef = { }; + private: HRESULT Initialize(); void Make_Planes(const _float4* pPoints, _float4* pPlanes); @@ -93,7 +102,7 @@ class CPipeLine final : public CBase ID3D11ShaderResourceView* Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV); public: - static CPipeLine* Create(); + static CPipeLine* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual void Free() override; #ifdef _DEBUG virtual void Describe_Entity();