From 9fb3a96210d910e99bd26050c07fcfbcb6722736 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Fri, 12 Dec 2025 05:34:40 +0900 Subject: [PATCH] [add] GerboldOllivander_Base --- Jusin154_Team3D/Client/Default/Client.vcxproj | 2 + .../Client/Default/Client.vcxproj.filters | 27 +- .../Client/Private/Level_GamePlay.cpp | 4 + Jusin154_Team3D/Client/Private/Loader.cpp | 22 + .../Client/Private/NPC_Ollivander.cpp | 212 +++++++ Jusin154_Team3D/Client/Public/Client_Enum.h | 1 + Jusin154_Team3D/Client/Public/Client_Macro.h | 1 + .../Client/Public/NPC_Ollivander.h | 40 ++ .../GerboldOllivander/GerboldOlivander.bin | 3 + ...oldOllivander.xml => GerboldOlivander.xml} | 24 +- .../GerboldOlivander_Anim.bin | 3 + .../GerboldOlivander_Anim.fbx | 3 + .../Models/Monster/SubTroll/troll.xml | 14 +- .../Resources/Models/Object/Broom/Broom.xml | 2 +- .../SubTroll_Weapon/SK_WPN_Troll_Club07.xml | 2 +- .../Models/Object/SubTroll_Weapon/troll.xml | 14 +- .../ShaderFiles/Shader_Deferred.hlsl | 4 +- .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 557 ++++++++++++++++++ .../ShaderFiles/Shader_VtxAnimMesh.hlsl | 33 +- .../Resources/ShaderFiles/Shader_VtxMesh.hlsl | 34 +- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 4 + .../Editor/Default/Editor.vcxproj.filters | 3 + Jusin154_Team3D/Editor/Private/Loader.cpp | 10 +- Jusin154_Team3D/Editor/Public/Editor_Define.h | 1 + Jusin154_Team3D/Editor/Public/Editor_Macro.h | 1 + .../ShaderFiles/Shader_Deferred.hlsl | 4 +- Jusin154_Team3D/Engine/Private/Material.cpp | 63 +- Jusin154_Team3D/Engine/Private/Model.cpp | 62 +- Jusin154_Team3D/Engine/Public/Engine_Enum.h | 2 +- Jusin154_Team3D/Engine/Public/Material.h | 6 +- Jusin154_Team3D/Engine/Public/Model.h | 46 +- 31 files changed, 1102 insertions(+), 102 deletions(-) create mode 100644 Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp create mode 100644 Jusin154_Team3D/Client/Public/NPC_Ollivander.h create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin rename Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/{GerboldOllivander.xml => GerboldOlivander.xml} (97%) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.fbx create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 429af2e83..62d7a3245 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -193,6 +193,7 @@ call Update_Resources.bat + @@ -364,6 +365,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 7437ad89f..3034c4ba0 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -508,7 +508,7 @@ 02.GameObjects\Effect\State_Effect\Stun - + 04.Mechanic\State\Broom_Player\State_Broom_Ride_Move @@ -520,7 +520,7 @@ 04.Mechanic\State\Broom\Fly - + 02.GameObjects\UI\GamePlay_Canvas\Enemy_Penel\Boss_HpBar @@ -529,13 +529,16 @@ 04.Mechanic\State\Broom_Player\State_Broom_Fly - + 02.GameObjects\Cameras\MiniMap_Camera 02.GameObjects\UI\Enemy_Detection + + 02.GameObjects\NPC\Ally\Shopper + @@ -1097,7 +1100,7 @@ {c9370e36-317e-45e7-a8c7-98a623864824} - + {48b905c1-b91e-44ca-a61b-86633826768b} @@ -1115,7 +1118,7 @@ {537c9208-b8e7-4e3b-a818-27335e3f0469} - + {b49a3671-96d0-47b8-833f-28190d549b0f} @@ -1124,13 +1127,16 @@ {f24321bb-6750-4baa-b19a-bf5a3c2a8909} - + {dbf4ff12-e5eb-439a-aa02-e5a424453b08} {34a4beb9-ccb9-4847-ae45-af4e7dc25d94} + + {02cb243a-f63e-4e55-9d55-b47e31a4c13e} + @@ -1583,7 +1589,7 @@ 02.GameObjects\Effect\State_Effect\Stun - + 04.Mechanic\State\Broom_Player\State_Broom_Ride_Move @@ -1595,7 +1601,7 @@ 04.Mechanic\State\Broom\Fly - + 02.GameObjects\UI\GamePlay_Canvas\Enemy_Penel\Boss_HpBar @@ -1604,13 +1610,16 @@ 04.Mechanic\State\Broom_Player\State_Broom_Fly - + 02.GameObjects\Cameras\MiniMap_Camera 02.GameObjects\UI\Enemy_Detection + + 02.GameObjects\NPC\Ally\Shopper + diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index f834d357a..a69dc9ee1 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -24,6 +24,7 @@ #include "Goblin.h" #include "Goblin_Mage.h" #include "Goblin_Spector.h" +#include "NPC_Ollivander.h" #pragma endregion @@ -477,6 +478,9 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) { return E_FAIL; } + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index e910e2351..fda72a2e8 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -27,6 +27,7 @@ #include "Goblin_Mage.h" #include "Goblin_Spector.h" #include "Troll.h" +#include "NPC_Ollivander.h" #pragma endregion @@ -1273,6 +1274,12 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_NPC_PBR_ANIM, + CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl"), + VTXANIMMESH::Elements, VTXANIMMESH::iNumElements)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_MESH, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl"), VTXMESH::Elements, VTXMESH::iNumElements)))) { @@ -1439,6 +1446,16 @@ HRESULT CLoader::Loading_For_GamePlay() CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/GoblinSpector/GoblinSpector.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GerboldOlivander_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Troll_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Troll_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ return E_FAIL; @@ -2105,6 +2122,11 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTroll::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Troll */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CNPC_Ollivander::Create(m_pDevice, m_pContext)))){ + return E_FAIL; + } + #pragma endregion diff --git a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp new file mode 100644 index 000000000..e28b231a6 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp @@ -0,0 +1,212 @@ +#include "pch.h" +#include "NPC_Ollivander.h" + +#include "GameInstance.h" +#include "InfoInstance.h" +#include "Player.h" + +CNPC_Ollivander::CNPC_Ollivander(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CUnit(pDevice, pContext) +{ +} + +CNPC_Ollivander::CNPC_Ollivander(const CNPC_Ollivander& Prototype) + : CUnit(Prototype), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +void CNPC_Ollivander::Priority_Update(_float fTimeDelta) +{ + m_pTransformCom->RewindMomentum(); + __super::Priority_Update(fTimeDelta); +} + +void CNPC_Ollivander::Update(_float fTimeDelta) +{ + m_pFSM->Update_State(fTimeDelta); + + m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); + __super::Update(fTimeDelta); +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG + +} + +void CNPC_Ollivander::Late_Update(_float fTimeDelta) +{ + m_pTransformCom->Set_State(STATE::POSITION, m_pTransformCom->Get_EstimatedPositionByMomentum()); + + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + + __super::Late_Update(fTimeDelta); +} + +HRESULT CNPC_Ollivander::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CNPC_Ollivander::Render_Shadow() +{ + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ViewMatrix", D3DTS::VIEW))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ProjMatrix", D3DTS::PROJ))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", &m_pGameInstance->Get_ShadowDesc()->fFar, sizeof(_float)))) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CNPC_Ollivander::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { + return E_FAIL; + } + return S_OK; +} + +HRESULT CNPC_Ollivander::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CNPC_Ollivander::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + if (FAILED(Ready_Components(pArg))) { + return E_FAIL; + } + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-34.f, 5, -11.4f, 1.f)); + return S_OK; +} + +HRESULT CNPC_Ollivander::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_NPC_PBR_ANIM, + reinterpret_cast(&m_pShaderCom)))) { + return E_FAIL; + } + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_GerboldOlivander_Model"), + reinterpret_cast(&m_pModelCom)))) { + return E_FAIL; + } + + return S_OK; +} + +CNPC_Ollivander* CNPC_Ollivander::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CNPC_Ollivander* pInstance = new CNPC_Ollivander(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CNPC_Ollivander"); + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +CGameObject* CNPC_Ollivander::Clone(void* pArg, CGameObject* pOwner) +{ + CNPC_Ollivander* pInstance = new CNPC_Ollivander(*this); + + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CNPC_Ollivander"); + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CNPC_Ollivander::Free() +{ + __super::Free(); +} +#ifdef _DEBUG + +void CNPC_Ollivander::Describe_Entity() +{ + m_pModelCom->Describe_Entity(); + if (ImGui::TreeNode("ANIM STATE")) { + + for (auto& pState : m_States) + { + if (ImGui::Button(to_string(pState.first).c_str())) + { + m_pFSM->Change_State(pState.first); + } + } + + GUI::Text(to_string(m_pModelCom->Get_CurrentTrackProgressRatio()).c_str()); + + ImGui::TreePop(); + } +} + +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 201976bb7..e37734eb7 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -14,6 +14,7 @@ namespace Client enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, END }; enum class SHADER_PASS_UIEDITOR { DEFAULT, LOGO, LOGO_TEXT, LOGO_GLOW, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTYPE, UVMULT, NINECLICE, ROTATION, SLOT, TYPE, HPBAR, MAGIC_METER, MAGIC_ICON, REMOVEUV, REVELIO, POTION, MAGIC_ITEM, SPELL_PREVIEW, SPELL_HEADER, SPELL_HEADER_LINE, SPELL_DRAG, CAMERA_LOCKON, LODING_SCREEN, ENEMY_HPBAR, BOSS_HPBAR, ENEMY_DETECTION, END }; enum class SHADER_PASS_UIINTANCE { DEFAULT, ALPHABLEND, UVALPHABLEND, MAGIC_METER, SPELL_LIST, EESSENTIAL_SPELL_SOLT, EESSENTIAL_SPELL, COLOR, SPELL_HOVER, SPELL_SLOT_EFFECT, SPELL_SLOT, END }; + enum class SHADER_PASS_NPC_PBR_ANIM { EYELASH_DAOTHV_TOSRO, TEETH_SRXO_ToSRO, EYE_DN_SRO, FACIAL_HAIR_DAOTHV_ToSRO, HEAD_HAIR_DAOTHV_ToSRO, HEADwtHAND_DSRXON_ToSRO, LOWER_DSRON_ToSRO, UPPER_DMRON_ToSRO, GLASSES_DMRON_ToSRO, END }; enum class UI_STATE { GAMEPLAYER, SPELL, POTION, INVENTORY, END }; diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h index 23581ecff..cd522d1de 100644 --- a/Jusin154_Team3D/Client/Public/Client_Macro.h +++ b/Jusin154_Team3D/Client/Public/Client_Macro.h @@ -21,6 +21,7 @@ namespace Client { #define FX_UIEDITOR TEXT("FX_UIEDITOR") #define FX_UIINSTANCE TEXT("FX_UIINSTANCE") #define FX_VTXPOS TEXT("FX_VTXPOS") +#define FX_NPC_PBR_ANIM TEXT("FX_NPC_PBR_ANIM") #pragma endregion #pragma region MACRO_PROTOTYPE diff --git a/Jusin154_Team3D/Client/Public/NPC_Ollivander.h b/Jusin154_Team3D/Client/Public/NPC_Ollivander.h new file mode 100644 index 000000000..7e2dd976a --- /dev/null +++ b/Jusin154_Team3D/Client/Public/NPC_Ollivander.h @@ -0,0 +1,40 @@ +#pragma once + +#include "Client_Define.h" +#include "Unit.h" + +NS_BEGIN(Client) + +class CNPC_Ollivander final : public CUnit +{ +protected: + CNPC_Ollivander(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CNPC_Ollivander(const CNPC_Ollivander& Prototype); + virtual ~CNPC_Ollivander() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + virtual HRESULT Render_Shadow() override; +protected: + CInfoInstance* m_pInfoInstance = { nullptr }; + +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + HRESULT Ready_Components(void* pArg); + HRESULT Bind_ShaderResources() override; + +public: + static CNPC_Ollivander* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr); + virtual void Free() override; +#ifdef _DEBUG + virtual void Describe_Entity() override; + +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin new file mode 100644 index 000000000..459598ade --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45edbad61d9d6f8891b2009ec64951195a58e0fa50134a9d3b3dd0c5e34bee30 +size 6393892 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOllivander.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.xml similarity index 97% rename from Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOllivander.xml rename to Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.xml index c2d85e495..73e1be0ce 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOllivander.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.xml @@ -1,5 +1,5 @@ - + @@ -28,9 +28,9 @@ - - - + + + @@ -57,7 +57,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -173,7 +173,7 @@ - + @@ -202,7 +202,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -260,7 +260,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.bin new file mode 100644 index 000000000..16e04855b --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c3d337a05c5621c027dec7cfd5345c13b8c46b243a072d4c8cf5c11d0d34039 +size 12951064 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.fbx new file mode 100644 index 000000000..0aa5ad418 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:436a9c2d497061156640f0f2011616d41e0eacb3763eb86d18442bf4e2b4a193 +size 19497756 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/SubTroll/troll.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/SubTroll/troll.xml index 3cbe11bcd..97cc47e34 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/SubTroll/troll.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Monster/SubTroll/troll.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 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Broom/Broom.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Broom/Broom.xml index 61b4827cf..7293d00b7 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Broom/Broom.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Broom/Broom.xml @@ -1,5 +1,5 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/SK_WPN_Troll_Club07.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/SK_WPN_Troll_Club07.xml index aa4a724b3..85d151845 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/SK_WPN_Troll_Club07.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/SK_WPN_Troll_Club07.xml @@ -1,5 +1,5 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/troll.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/troll.xml index 6d1d8c574..cd780ed52 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/troll.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/SubTroll_Weapon/troll.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 @@ - + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 41166db92..edd08da29 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -229,7 +229,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) - if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_METALNESS)) // Metallic + if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_METALNESS)) // Metallic Roughness Occ { float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; fMetallic = vMRO.r; @@ -238,7 +238,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic); } - else if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_SPECULAR)) // Specular + else if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_SPECULAR)) // Specular Roughness Occ { fMetallic = 0.f; 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 new file mode 100644 index 000000000..c9d569ba5 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -0,0 +1,557 @@ + +#include "Engine_Shader_Defines.hlsli" + +float4x4 g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; + +int g_bRimLight; +int g_bUseNormalMap; +int g_bDisolve; + +float4 g_vDisolveEdgeColor; +float4 g_vCamPosition; +float4 g_vOutLineColor; +float g_fFar; +float g_fOutLineScale; +float g_fOutLineThickness; +float g_fOutLinePower; +float g_fUsingSurfaceParams; + + +Texture2D g_DiffuseTexture; +Texture2D g_SpecularTexture; +Texture2D g_AmbientTexture; +Texture2D g_EmissiveTexture; +Texture2D g_HeightTexture; +Texture2D g_NormalTexture; +Texture2D g_ShininessTexture; +Texture2D g_OpacityTexture; +Texture2D g_DisplacementTexture; +Texture2D g_LightMapTexture; +Texture2D g_ReflectionTexture; +Texture2D g_BaseColorTexture; +Texture2D g_NormalCameraTexture; +Texture2D g_EmissionColorTexture; +Texture2D g_MetalnessTexture; +Texture2D g_Diffuse_RoughnessTexture; +Texture2D g_AmbientOcclusionTexture; +Texture2D g_UnknownTexture; +Texture2D g_SheenTexture; +Texture2D g_ClearcoadTexture; +Texture2D g_TransmissionTexture; +Texture2D g_Maya_BaseTexture; +Texture2D g_Maya_SpecularTexture; +Texture2D g_Maya_Specular_ColorTexture; +Texture2D g_Maya_Specular_RoughnessTexture; +Texture2D g_AnisotropyTexture; + + +Texture2D g_SurfaceParamsTexture; + + +int g_iBinded_Texture[27]; +matrix g_BoneMatrices[512]; + +struct VS_IN +{ + float3 vPosition : POSITION; + float3 vNormal : NORMAL; + float3 vTangent : TANGENT; + float3 vBinormal : BINORMAL; + float2 vTexcoord : TEXCOORD0; + + uint4 vBlendIndex : BLENDINDEX; + float4 vBlendWeight : BLENDWEIGHT; +}; +struct VS_OUT +{ + float4 vPosition : SV_Position; + float3 vNormal : NORMAL; + float3 vTangent : TANGENT; + float3 vBinormal : BINORMAL; + float2 vTexcoord : TEXCOORD0; + float4 vWorldPos : TEXCOORD1; + float4 vProjPos : TEXCOORD2; +}; +VS_OUT VS_MAIN(VS_IN In) +{ + VS_OUT Out; + + float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z); + + matrix BoneMatrix = + mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) + + mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) + + mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) + + mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW); + + vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix); + vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix); + vector vBinormal = mul(vector(In.vBinormal, 0.f), BoneMatrix); + vector vTangent = mul(vector(In.vTangent, 0.f), BoneMatrix); + + + matrix matWV, matWVP; + matWV = mul(g_WorldMatrix, g_ViewMatrix); + matWVP = mul(matWV, g_ProjMatrix); + + Out.vPosition = mul(vPosition, matWVP); + Out.vNormal = normalize(mul(vNormal, g_WorldMatrix)).xyz; + Out.vBinormal = normalize(mul(vBinormal, g_WorldMatrix)).xyz; + Out.vTangent = normalize(mul(vTangent, g_WorldMatrix)).xyz; + Out.vTexcoord = In.vTexcoord; + Out.vWorldPos = mul(vPosition, g_WorldMatrix); + Out.vProjPos = Out.vPosition; + return Out; +} +struct VS_OUT_SHADOW +{ + float4 vPosition : SV_POSITION; + float4 vProjPos : TEXCOORD0; +}; + +VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In) +{ + VS_OUT_SHADOW Out; + + float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z); + + matrix BoneMatrix = mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) + + mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) + + mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) + + mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW); + + vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix); + + matrix matWV, matWVP; + + matWV = mul(g_WorldMatrix, g_ViewMatrix); + matWVP = mul(matWV, g_ProjMatrix); + + Out.vPosition = mul(vPosition, matWVP); + Out.vProjPos = Out.vPosition; + + return Out; +} +struct PS_IN +{ + float4 vPosition : SV_Position; + float3 vNormal : NORMAL; + float3 vTangent : TANGENT; + float3 vBinormal : BINORMAL; + float2 vTexcoord : TEXCOORD0; + float4 vWorldPos : TEXCOORD1; + float4 vProjPos : TEXCOORD2; +}; + +struct PS_OUT +{ + float4 vAlbedo : SV_TARGET0; + float4 vNormal : SV_TARGET1; + float4 vDepth : SV_TARGET2; + float4 vColor : SV_Target3; + float4 vSurface : SV_Target4; +}; + +PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + float fDiffuseMask = vDAO_Mask.r; + float AlphaMask = vDAO_Mask.g; + float AoMask_Dao = vDAO_Mask.b; + + if (AlphaMask < 0.2f) { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vTHV_Mask = g_DisplacementTexture.Sample(DefaultSampler, In.vTexcoord); + float RootTip = vTHV_Mask.r; + float SpecMask = vTHV_Mask.g; + float AoMask_Thv = vTHV_Mask.b; + + float3 vColorRoot = vDAO_Mask * 0.6f; + float3 vColorTip = vDAO_Mask; + float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); + + + Out.vAlbedo = float4(fDiffuseMask, fDiffuseMask, fDiffuseMask, AlphaMask); + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); + // SRO + return Out; +} + +PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vSRXO_MASK = g_AnisotropyTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(vSRXO_MASK.r, vSRXO_MASK.g, vSRXO_MASK.a, 0.f); + // SRO + return Out; +} + +PS_OUT PS_EYE_DN_SRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(0.5f, 0.5f, 1.f, 0.f); + // SRO + return Out; +} + +PS_OUT PS_EYE_OCC(PS_IN In) +{ + PS_OUT Out; + discard; + return Out; +} + +PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) +{ + + PS_OUT Out; + + float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + float fDiffuseMask = vDAO_Mask.r; + float AlphaMask = vDAO_Mask.g; + float AoMask_Dao = vDAO_Mask.b; + + if (AlphaMask < 0.2f) + { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vTHV_Mask = g_DisplacementTexture.Sample(DefaultSampler, In.vTexcoord); + float RootTip = vTHV_Mask.r; + float SpecMask = vTHV_Mask.g; + float AoMask_Thv = vTHV_Mask.b; + + float3 vColorRoot = vDAO_Mask * 0.6f; + float3 vColorTip = vDAO_Mask; + float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); + + + Out.vAlbedo = float4(fDiffuseMask, fDiffuseMask, fDiffuseMask, AlphaMask); + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); + // SRO + return Out; +} + +PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) +{ + + PS_OUT Out; + + float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + float fDiffuseMask = vDAO_Mask.r; + float AlphaMask = vDAO_Mask.g; + float AoMask_Dao = vDAO_Mask.b; + + if (AlphaMask < 0.2f) + { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vTHV_Mask = g_DisplacementTexture.Sample(DefaultSampler, In.vTexcoord); + float RootTip = vTHV_Mask.r; + float SpecMask = vTHV_Mask.g; + float AoMask_Thv = vTHV_Mask.b; + + float3 vColorRoot = vDAO_Mask * 0.6f; + float3 vColorTip = vDAO_Mask; + float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); + + + Out.vAlbedo = float4(fDiffuseMask, fDiffuseMask, fDiffuseMask, AlphaMask); + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); + // SRO + return Out; +} + +PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vSRXO_Mask = g_AnisotropyTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(vSRXO_Mask.r, vSRXO_Mask.g, vSRXO_Mask.a, 0.f); + // SRO + return Out; +} + +PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vSRO_Mask = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(vSRO_Mask.r, vSRO_Mask.g, vSRO_Mask.b, 0.f); + // SRO + return Out; +} + +PS_OUT PS_UPPER_DMRON_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vMRO_Mask = g_MetalnessTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_METALNESS / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f); + // MRO + return Out; +} + +PS_OUT PS_GLASSES_DSRON_ToSRO(PS_IN In) +{ + PS_OUT Out; + + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (vDiffuse.a < 0.2f) { + discard; + } + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); + + float4 vSRO_Mask = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vAlbedo = vDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + AI_TEXTURE_TYPE_SPECULAR / AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = float4(vSRO_Mask.r, vSRO_Mask.g, vSRO_Mask.b, 0.f); + // SRO + return Out; +} + +struct PS_IN_SHADOW +{ + float4 vPosition : SV_POSITION; + float4 vProjPos : TEXCOORD0; +}; + +struct PS_OUT_SHADOW +{ + float fShadowLightDepth : SV_TARGET0; +}; + +PS_OUT_SHADOW PS_MAIN_SHADOW(PS_IN_SHADOW In) +{ + PS_OUT_SHADOW Out = (PS_OUT_SHADOW) 0; + + Out.fShadowLightDepth = In.vProjPos.z; + + return Out; +} + +technique11 DefaultTechnique +{ + pass EYELASH_DAOTHV_ToSRO // 0 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_EYELASH_DAOTHV_ToSRO(); + } + pass TEETH_SRXO_ToSRO // 1 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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 // 2 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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 EYE_OCC // 3 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_OCC(); + } + pass FACIAL_HAIR_DAOTHV_ToSRO // 4 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_FACIAL_HAIR_DAOTHV_ToSRO(); + } + pass HEAD_HAIR_DAOTHV_ToSRO // 5 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_HEAD_HAIR_DAOTHV_ToSRO(); + } + pass HEADwtHAND_DSRXON_ToSRO // 6 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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 LOWER_DSRON_ToSRO // 7 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_LOWER_DSRON_ToSRO(); + } + pass UPPER_DMRON_ToSRO // 8 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_ToSRO(); + } + pass GLASSES_DMRON_ToSRO // 9 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + 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_GLASSES_DSRON_ToSRO(); + } +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index 5900f9e22..9f348d1d2 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl @@ -24,19 +24,38 @@ float g_fDisolveEdgeWidth; float4 g_vDisolveEdgeColor; float4 g_vCamPosition; -Texture2D g_DiffuseTexture; -Texture2D g_NormalTexture; Texture2D g_DAOTexture; Texture2D g_THVTexture; Texture2D g_SurfaceParamsTexture; -Texture2D g_TransmissionTexture; -Texture2D g_EmissiveTexture; -Texture2D g_AmbientTexture; -Texture2D g_AmbientOcclusionTexture; -Texture2D g_UnknownTexture; Texture2D g_DeadDisolveTexture; Texture2D g_DeadDisolveBurnTexture; +Texture2D g_DiffuseTexture; +Texture2D g_SpecularTexture; +Texture2D g_AmbientTexture; +Texture2D g_EmissiveTexture; +Texture2D g_HeightTexture; +Texture2D g_NormalTexture; +Texture2D g_ShininessTexture; +Texture2D g_OpacityTexture; +Texture2D g_DisplacementTexture; +Texture2D g_LightMapTexture; +Texture2D g_ReflectionTexture; +Texture2D g_BaseColorTexture; +Texture2D g_NormalCameraTexture; +Texture2D g_EmissionColorTexture; +Texture2D g_MetalnessTexture; +Texture2D g_Diffuse_RoughnessTexture; +Texture2D g_AmbientOcclusionTexture; +Texture2D g_UnknownTexture; +Texture2D g_SheenTexture; +Texture2D g_ClearcoadTexture; +Texture2D g_TransmissionTexture; +Texture2D g_Maya_BaseTexture; +Texture2D g_Maya_SpecularTexture; +Texture2D g_Maya_Specular_ColorTexture; +Texture2D g_Maya_Specular_RoughnessTexture; +Texture2D g_AnisotropyTexture; int g_iBinded_Texture[27]; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index e1ae3b5f2..bae2d8601 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -29,19 +29,39 @@ float2 g_vClipBoxLTPos; float g_fDisolveAmount; float g_fDisolveEdgeWidth; -Texture2D g_DiffuseTexture; -Texture2D g_NormalTexture; Texture2D g_DAOTexture; Texture2D g_THVTexture; Texture2D g_SurfaceParamsTexture; -Texture2D g_TransmissionTexture; -Texture2D g_EmissiveTexture; -Texture2D g_AmbientTexture; -Texture2D g_AmbientOcclusionTexture; -Texture2D g_UnknownTexture; Texture2D g_NoiseTexture; Texture2D g_CausticsTexture; +Texture2D g_DiffuseTexture; +Texture2D g_SpecularTexture; +Texture2D g_AmbientTexture; +Texture2D g_EmissiveTexture; +Texture2D g_HeightTexture; +Texture2D g_NormalTexture; +Texture2D g_ShininessTexture; +Texture2D g_OpacityTexture; +Texture2D g_DisplacementTexture; +Texture2D g_LightMapTexture; +Texture2D g_ReflectionTexture; +Texture2D g_BaseColorTexture; +Texture2D g_NormalCameraTexture; +Texture2D g_EmissionColorTexture; +Texture2D g_MetalnessTexture; +Texture2D g_Diffuse_RoughnessTexture; +Texture2D g_AmbientOcclusionTexture; +Texture2D g_UnknownTexture; +Texture2D g_SheenTexture; +Texture2D g_ClearcoadTexture; +Texture2D g_TransmissionTexture; +Texture2D g_Maya_BaseTexture; +Texture2D g_Maya_SpecularTexture; +Texture2D g_Maya_Specular_ColorTexture; +Texture2D g_Maya_Specular_RoughnessTexture; +Texture2D g_AnisotropyTexture; + int g_iBinded_Texture[AI_TEXTURE_TYPE_MAX]; Texture2D g_MaskingTexture; diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 8981c3340..df3851f2f 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -587,6 +587,10 @@ call Update_Shaders.bat + + Effect + 5.0 + Effect 5.0 diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index b35a3774d..4488e7c02 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -1730,5 +1730,8 @@ 99.Define\SHADER + + 99.Define\SHADER + \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 9ee568c00..78806e52d 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -1750,7 +1750,7 @@ HRESULT CLoader::Loading_For_PhysXLevel() _wstring strFileName = L"Prototype_GameObject_" + file.path().stem().wstring(); - CModel* pModel = CModel::Create(m_pDevice, m_pContext, MODEL::ENVIROMENT, szFilePath); + CModel* pModel = CModel::Create(m_pDevice, m_pContext, MODEL::ENVIRONMENT, szFilePath); /*For Prototype_Component_Model_*/ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, strFileName, pModel))) { @@ -2263,8 +2263,12 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Desc_Box") )); futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.fbx", XMMatrixIdentity(), - TEXT("Prototype_Component_GerboldOlivander") + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander.bin", XMMatrixIdentity(), + TEXT("Prototype_Component_GerboldOlivander_Model") + )); + futures.emplace_back(Deferred_ModelLoad( + MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/GerboldOllivander/GerboldOlivander_Anim.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + TEXT("Prototype_Component_GerboldOlivander_Anim_Model") )); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index d374e1cac..6fa71934a 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -19,6 +19,7 @@ namespace Editor enum class MAPOBJECT_RENDER_TYPE { NORMAL, DECAL, GLASS }; 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_SRO, FACIAL_HAIR_DAOTHV_ToSRO, HEAD_HAIR_DAOTHV_ToSRO, HEADwtHAND_DSRXON_ToSRO, LOWER_DSRON_ToSRO, UPPER_DMRON_ToSRO, GLASSES_DMRON_ToSRO, 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 }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; diff --git a/Jusin154_Team3D/Editor/Public/Editor_Macro.h b/Jusin154_Team3D/Editor/Public/Editor_Macro.h index 4f18a9b2d..25ed8e3dc 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Macro.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Macro.h @@ -21,6 +21,7 @@ namespace Editor { #define FX_UIEDITOR TEXT("FX_UIEDITOR") #define FX_UIINSTANCE TEXT("FX_UIINSTANCE") #define FX_VTXPOS TEXT("FX_VTXPOS") +#define FX_NPC_PBR_ANIM TEXT("FX_NPC_PBR_ANIM") #pragma endregion #pragma region MACRO_PROTOTYPE diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 41166db92..edd08da29 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -229,7 +229,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) - if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_METALNESS)) // Metallic + if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_METALNESS)) // Metallic Roughness Occ { float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; fMetallic = vMRO.r; @@ -238,7 +238,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In) vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic); } - else if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_SPECULAR)) // Specular + else if (true == AlmostEqual3(vDepth.b * AI_TEXTURE_TYPE_MAX, AI_TEXTURE_TYPE_SPECULAR)) // Specular Roughness Occ { fMetallic = 0.f; diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 7dad02917..89b11dfdf 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -496,7 +496,7 @@ HRESULT CMaterial::UnbindAllMaterialTextures(CShader* shader) return S_OK; } -HRESULT CMaterial::Bind_SRV(CShader* pShader) +HRESULT CMaterial::Bind_SRV(CShader* pShader, MODEL eType) { if (FAILED(UnbindAllMaterialTextures(pShader))) { return E_FAIL; @@ -527,11 +527,16 @@ HRESULT CMaterial::Bind_SRV(CShader* pShader) break; case aiTextureType_SPECULAR: { - _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); - pConstantName = "g_SurfaceParamsTexture"; - if (!m_SRVs[iTextureType].empty()) { - if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { - return E_FAIL; + if (MODEL::PBR_ANIM == eType || MODEL::PBR_NONANIM == eType) { + pConstantName = "g_SpecularTexture"; + } + else { + pConstantName = "g_SurfaceParamsTexture"; + if (!m_SRVs[iTextureType].empty()) { + _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); + if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { + return E_FAIL; + } } } } break; @@ -542,37 +547,52 @@ HRESULT CMaterial::Bind_SRV(CShader* pShader) pConstantName = "g_EmissiveTexture"; break; case aiTextureType_HEIGHT: + pConstantName = "g_HeightTexture"; break; case aiTextureType_NORMALS: pConstantName = "g_NormalTexture"; break; case aiTextureType_SHININESS: + pConstantName = "g_ShininessTexture"; break; case aiTextureType_OPACITY: + pConstantName = "g_OpacityTexture"; break; case aiTextureType_DISPLACEMENT: + pConstantName = "g_DisplacementTexture"; break; case aiTextureType_LIGHTMAP: + pConstantName = "g_LightMapTexture"; break; case aiTextureType_REFLECTION: + pConstantName = "g_ReflectionTexture"; break; case aiTextureType_BASE_COLOR: + pConstantName = "g_BaseColorTexture"; break; case aiTextureType_NORMAL_CAMERA: + pConstantName = "g_NormalCameraTexture"; break; case aiTextureType_EMISSION_COLOR: + pConstantName = "g_EmissionColorTexture"; break; case aiTextureType_METALNESS: { - _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); - pConstantName = "g_SurfaceParamsTexture"; - if (!m_SRVs[iTextureType].empty()) { - if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { - return E_FAIL; + if (MODEL::PBR_ANIM == eType || MODEL::PBR_NONANIM == eType) { + pConstantName = "g_MetalnessTexture"; + } + else { + pConstantName = "g_SurfaceParamsTexture"; + if (!m_SRVs[iTextureType].empty()) { + _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); + if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { + return E_FAIL; + } } } } break; case aiTextureType_DIFFUSE_ROUGHNESS: + pConstantName = "g_Diffuse_RoughnessTexture"; break; case aiTextureType_AMBIENT_OCCLUSION: pConstantName = "g_AmbientOcclusionTexture"; @@ -581,27 +601,38 @@ HRESULT CMaterial::Bind_SRV(CShader* pShader) pConstantName = "g_UnknownTexture"; break; case aiTextureType_SHEEN: + pConstantName = "g_SheenTexture"; break; case aiTextureType_CLEARCOAT: + pConstantName = "g_ClearcoadTexture"; break; case aiTextureType_TRANSMISSION: pConstantName = "g_TransmissionTexture"; break; case aiTextureType_MAYA_BASE: + pConstantName = "g_Maya_BaseTexture"; break; case aiTextureType_MAYA_SPECULAR: + pConstantName = "g_Maya_SpecularTexture"; break; case aiTextureType_MAYA_SPECULAR_COLOR: + pConstantName = "g_Maya_Specular_ColorTexture"; break; case aiTextureType_MAYA_SPECULAR_ROUGHNESS: + pConstantName = "g_Maya_Specular_RoughnessTexture"; break; case aiTextureType_ANISOTROPY: { - _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); - pConstantName = "g_SurfaceParamsTexture"; - if (!m_SRVs[iTextureType].empty()) { - if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { - return E_FAIL; + if (MODEL::PBR_ANIM == eType || MODEL::PBR_NONANIM == eType) { + pConstantName = "g_AnisotropyTexture"; + } + else { + pConstantName = "g_SurfaceParamsTexture"; + if (!m_SRVs[iTextureType].empty()) { + _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX); + if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float)))) { + return E_FAIL; + } } } } break; diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 9482843a4..ae016340d 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -92,7 +92,21 @@ HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader) if (iMaterialIndex >= m_iNumMaterials) { return E_FAIL; } - return m_Materials[iMaterialIndex]->Bind_SRV(pShader); + return m_Materials[iMaterialIndex]->Bind_SRV(pShader, m_eType); +} + +HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader) +{ + if (iMeshIndex >= m_iNumMeshes) { + return E_FAIL; + } + + _uint iMaterialIndex = m_Meshes[iMeshIndex]->Get_MaterialIndex(); + + if (iMaterialIndex >= m_iNumMaterials) { + return E_FAIL; + } + return pShader->Begin(m_Materials[iMaterialIndex]->Get_UsingPass()); } HRESULT CModel::Bind_BoneMatrices(_uint iMeshIndex, CShader* pShader, const _char* pConstantName) @@ -1429,7 +1443,9 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _ if (FAILED(Ready_Materials(pModelFilePath))) { return E_FAIL; } - + if (MODEL::PBR_ANIM == m_eType || MODEL::PBR_NONANIM == m_eType) { + ParseMaterialXml(pModelFilePath); + } if (FAILED(Ready_Animations(m_Bones))) { return E_FAIL; } @@ -1464,6 +1480,9 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _ if (FAILED(Ready_Materials(pModelFilePath))) { return E_FAIL; } + if (MODEL::PBR_ANIM == m_eType || MODEL::PBR_NONANIM == m_eType) { + ParseMaterialXml(pModelFilePath); + } if (FAILED(Ready_Animations(m_Bones))) { return E_FAIL; @@ -1502,6 +1521,38 @@ void CModel::LoadAdditionalAnimations(const char* ModelFilePath) } } +void CModel::ParseMaterialXml(const _char* pFilePath) +{ + filesystem::path xmlFilePath = pFilePath; + xmlFilePath.replace_extension(".xml"); + + tinyxml2::XMLDocument xmlDoc; + if (xmlDoc.LoadFile(xmlFilePath.string().c_str()) != tinyxml2::XML_SUCCESS){ + return; + } + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Material"); + if (root == nullptr){ + return; + } + + _int iVisitIndex = 0; + + for (tinyxml2::XMLElement* pElement = root->FirstChildElement(); + pElement != nullptr; + pElement = pElement->NextSiblingElement(), ++iVisitIndex) + { + _int iOrderIndex = iVisitIndex; + + const _char* szShaderIndex = pElement->Attribute("ShaderIndex"); + _int iShaderIndex = -1; + if (szShaderIndex != nullptr) { + iShaderIndex = atoi(szShaderIndex); + } + + m_Materials[iOrderIndex]->Set_UsingPass(iShaderIndex); + } +} _bool CModel::LoadData(const _char* filename) { @@ -1913,6 +1964,13 @@ void CModel::Free() void CModel::Describe_Entity() { GUI::Begin("Model_Desc"); + if (GUI::CollapsingHeader("ModelAnimations")) { + for (_uint i = 0; i < m_iNumAnimations; ++i) { + if (GUI::Button(m_Animations[i]->Get_Name().c_str())) { + Set_AnimationIndex(i, false); + } + } + } if (GUI::Button("SaveAnimIndexWithName")) { _wstring wstrPath = TEXT("../Bin/AnimIndex.txt"); HANDLE hFile = CreateFile(wstrPath.c_str(), diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index ac47dc5d9..732969a8a 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -32,7 +32,7 @@ enum class PXBODYSTATE { enum class MOUSEKEYSTATE { LBUTTON, RBUTTON, WBUTTON, XBUTTON }; enum class MOUSEMOVESTATE { X, Y, W }; enum class D3DTS { VIEW, PROJ, VIEW_INV, PROJ_INV, END }; -enum class MODEL { ANIM, NONANIM, PBR_NONANIM, PBR_ANIM, ENVIRONMENT, ANIM_LOCAL,NONANIM_LOCAL}; +enum class MODEL { ANIM, NONANIM, PBR_NONANIM, PBR_ANIM, ENVIRONMENT, ANIM_LOCAL,NONANIM_LOCAL, END}; enum class NAVI_POINT { A, B, C, END }; enum class NAVI_LINE { AB, BC, CA, END }; diff --git a/Jusin154_Team3D/Engine/Public/Material.h b/Jusin154_Team3D/Engine/Public/Material.h index c8abcc0e1..9daa9c388 100644 --- a/Jusin154_Team3D/Engine/Public/Material.h +++ b/Jusin154_Team3D/Engine/Public/Material.h @@ -13,7 +13,9 @@ class ENGINE_DLL CMaterial final : public CBase public: HRESULT UnbindAllMaterialTextures(class CShader* shader); - HRESULT Bind_SRV(class CShader* pShader); + HRESULT Bind_SRV(class CShader* pShader, MODEL eType = MODEL::END); + _int Get_UsingPass() { return m_iUsingPass; } + void Set_UsingPass(_int iPass) { m_iUsingPass = iPass; } private: class CGameInstance* m_pGameInstance = { nullptr }; @@ -21,7 +23,7 @@ class ENGINE_DLL CMaterial final : public CBase ID3D11DeviceContext* m_pContext = { nullptr }; vector m_SRVs[AI_TEXTURE_TYPE_MAX]; - + _int m_iUsingPass = { -1 }; #ifdef EDITOR_PROJECT public: diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index 9b6a022c0..49a1bfcf0 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -32,19 +32,19 @@ class ENGINE_DLL CModel final : public CComponent virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation); #pragma endregion #pragma region Animation - _bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌 - _bool Play_Anim(_float fTimeDelta, CTransform* pTransform); - _bool Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform); - void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false,_float fAnimSpeed = 1.f); - void Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop = false); - _bool IsFinishedAnim() const { return m_bIsFinishedAnim; } - _bool IsFinishedSecondAnim() const { return m_bIsSecondFinishedAnim; } - _bool IsLoopAnim() const { return m_bIsLoop; } - void Set_CurrentTrackPosition(_float TrackPosition); - const _char* Get_AnimList(_uint iIndex); - _float Get_CurrentTrackPosition(); - _float Get_CurrentTrackProgressRatio(); - _float Get_TrackProgressRatio(_uint iIndex); + _bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌 + _bool Play_Anim(_float fTimeDelta, CTransform* pTransform); + _bool Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform); + void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false,_float fAnimSpeed = 1.f); + void Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop = false); + _bool IsFinishedAnim() const { return m_bIsFinishedAnim; } + _bool IsFinishedSecondAnim() const { return m_bIsSecondFinishedAnim; } + _bool IsLoopAnim() const { return m_bIsLoop; } + void Set_CurrentTrackPosition(_float TrackPosition); + const _char* Get_AnimList(_uint iIndex); + _float Get_CurrentTrackPosition(); + _float Get_CurrentTrackProgressRatio(); + _float Get_TrackProgressRatio(_uint iIndex); size_t Get_AnimSize() { return m_Animations.size(); } void Set_PlayAnim(_bool bPlayAnim) { m_bPlayAnim = bPlayAnim; } @@ -59,26 +59,25 @@ class ENGINE_DLL CModel final : public CComponent void Set_BlendDuration(_float Duration) { m_fBlendDuration = Duration; } #pragma endregion #pragma region Mesh - const _char* Get_MeshName(_uint iIndex); - _uint Get_NumMeshes() const { return m_iNumMeshes; } - void Update_RootBone(_float Amount = 1.f); - void Initialize_RootBone(); + const _char* Get_MeshName(_uint iIndex); + _uint Get_NumMeshes() const { return m_iNumMeshes; } + void Update_RootBone(_float Amount = 1.f); + void Initialize_RootBone(); #pragma endregion #pragma region Bone HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName); - const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const; - _matrix Get_BoneMatrix(const _char* pBoneName) const; - _matrix Get_BoneLocalMatrix(const _char* pBoneName) const; + const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const; + _matrix Get_BoneMatrix(const _char* pBoneName) const; + _matrix Get_BoneLocalMatrix(const _char* pBoneName) const; static _int Get_BoneIndex(const _char* pBoneName, vector Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 ) _int Get_BoneIndex(const _char* pBoneName) const; _matrix Get_BoneMatrix(_uint iBoneIndex); void Combined_BoneMatrix(); - #pragma endregion #pragma region Material - HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader); - + HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader); + HRESULT Begin(_uint iMeshIndex, class CShader* pShader); #pragma endregion void ComputeAnimation(_uint AnimIndex); @@ -208,6 +207,7 @@ class ENGINE_DLL CModel final : public CComponent void LoadAdditionalAnimations(const char* ModelFilePath); bool LoadData(const _char* filename); void LoadAnim(const _char* fileName); + void ParseMaterialXml(const _char* filePath); // virtual HRESULT Initialize(void* pArg) override;