From 7a9d70db9c407631098c56fc5565b2258d05eb28 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Tue, 30 Dec 2025 00:41:34 +0900 Subject: [PATCH] [fix] ReleaseModeV1 --- Jusin154_Team3D/Client/Default/Client.vcxproj | 2 - .../Client/Default/Client.vcxproj.filters | 9 - .../Client/Private/Camera_Model.cpp | 246 ------------------ .../Client/Private/Level_GamePlay.cpp | 7 +- Jusin154_Team3D/Client/Private/Loader.cpp | 7 +- Jusin154_Team3D/Client/Private/MapInfo.cpp | 4 - Jusin154_Team3D/Client/Private/Player.cpp | 7 + Jusin154_Team3D/Client/Public/Camera_Model.h | 50 ---- Jusin154_Team3D/Client/Public/Player.h | 2 +- .../ShaderFiles/Engine_Shader_Functions.hlsli | 62 +++-- .../ShaderFiles/Shader_Deferred.hlsl | 18 ++ .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 114 ++++---- .../ShaderFiles/Shader_VtxModelInstance.hlsl | 152 +++++------ Jusin154_Team3D/Editor/Default/Editor.vcxproj | 4 + .../ShaderFiles/Engine_Shader_Functions.hlsli | 62 +++-- .../ShaderFiles/Shader_Deferred.hlsl | 18 ++ .../Engine/Private/GameInstance.cpp | 7 + .../Engine/Private/PhysX_Manager.cpp | 2 +- Jusin154_Team3D/Engine/Private/Renderer.cpp | 2 +- Jusin154_Team3D/Engine/Public/Engine_Enum.h | 2 +- 20 files changed, 280 insertions(+), 497 deletions(-) delete mode 100644 Jusin154_Team3D/Client/Private/Camera_Model.cpp delete mode 100644 Jusin154_Team3D/Client/Public/Camera_Model.h diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 4a66f8208..e031d03d7 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -166,7 +166,6 @@ call Update_Resources.bat - @@ -415,7 +414,6 @@ call Update_Resources.bat - diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 39d5b3924..9e5cf3d69 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -746,9 +746,6 @@ 02.GameObjects\Player\Robe - - 02.GameObjects\Cameras\Camera_Model - 02.GameObjects\NPC\Hostile\Monster\Goblin\Goblin_Assassin @@ -1575,9 +1572,6 @@ {f3c7cf8d-2b83-49d3-85da-fe135e376a11} - - {f8d55057-c0f8-4cac-8a6c-6f11345a83bb} - {af9f5cf6-151a-49bc-9af4-28ba0bde1d37} @@ -2286,9 +2280,6 @@ 04.Mechanic\Dialogue\Dialogue_Data - - 02.GameObjects\Cameras\Camera_Model - 02.GameObjects\NPC\Hostile\Monster\Goblin\Goblin_Assassin diff --git a/Jusin154_Team3D/Client/Private/Camera_Model.cpp b/Jusin154_Team3D/Client/Private/Camera_Model.cpp deleted file mode 100644 index 2038d0675..000000000 --- a/Jusin154_Team3D/Client/Private/Camera_Model.cpp +++ /dev/null @@ -1,246 +0,0 @@ -#include "pch.h" -#include "Camera_Model.h" -#include "Shader.h" -#include "Layer.h" -#include "Player.h" - - -CCamera_Model::CCamera_Model(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) - : CCamera(pDevice, pContext) -{ -} - -CCamera_Model::CCamera_Model(const CCamera_Model& rhs) - : CCamera(rhs) -{ -} - -void CCamera_Model::Priority_Update(_float fTimeDelta) -{ -#ifdef _DEBUG - m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_MODEL, false); -#endif // _DEBUG - - if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_MODEL))) { - return; - } - //Transition(fTimeDelta); - _float3 vCamPos = {}; - _float3 vSetPos = {}; - XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION)); -#ifdef _DEBUG - GUI::Text("Cam Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); -#endif // _DEBUG - - if (m_pGameInstance->Key_Up(DIK_GRAVE)) { - m_bMovable = !m_bMovable; - } - if (m_pGameInstance->Mouse_Down(DIM_MBUTTON)) { - m_pGameInstance->Toggle_MouseCenter(); - } - - __super::Bind_Matrices(); -} - -void CCamera_Model::Update(_float fTimeDelta) -{ - m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); - - -#ifdef _DEBUG - Describe_Entity(); -#endif // _DEBUG -} - -void CCamera_Model::Late_Update(_float fTimeDelta) -{ - /*if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_MODEL))) { - return; - }*/ - - auto M = m_pModelCom->Get_BoneMatrix("lookat_target"); - GUI::Text("Bone T: %.3f %.3f %.3f", M.r[3].m128_f32[0], M.r[3].m128_f32[1], M.r[3].m128_f32[2]); - - - _vector vTargetPos = m_pModelCom->Get_BoneMatrix("lookat_target").r[3]; - - m_pTransformCom->LookAt( - XMVectorSetW(vTargetPos, 1.f) - ); - -// m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); -} - -HRESULT CCamera_Model::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_Material(i, m_pShaderCom))) { - return E_FAIL; - } - - 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_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { - return E_FAIL; - } - - m_pModelCom->Bind_OutPut_SRV_VS(31, 0); - m_pModelCom->Bind_OutPut_SRV_VS_Prev(32, 0); - - - if (FAILED(m_pModelCom->Render(i))) { - return E_FAIL; - } - } - - return S_OK; -} - -HRESULT CCamera_Model::Initialize_Prototype() -{ - return S_OK; -} - -HRESULT CCamera_Model::Initialize(void* pArg) -{ - CAMERA_MODEL_DESC* pDesc = static_cast(pArg); - - if (FAILED(__super::Initialize(pArg))) { - return E_FAIL; - } - - if (FAILED(Ready_Components(pArg))) { - return E_FAIL; - } - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vEye), 1.f)); - m_pTransformCom->LookAt(XMVectorSetW(XMLoadFloat3(&pDesc->vAt), 1.f)); - m_matInitial = *m_pTransformCom->Get_WorldMatrixPtr(); - m_bActive = true; - - - m_pModelCom->Set_Temp(true); - return S_OK; -} - -HRESULT CCamera_Model::Ready_Components(void* pArg) -{ - if (FAILED(__super::Ready_Components(pArg))) { - return E_FAIL; - } - - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_CCL_CameraRig.001_Model"), - reinterpret_cast(&m_pModelCom)))) { - return E_FAIL; - } - - - if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH, - reinterpret_cast(&m_pShaderCom)))) { - return E_FAIL; - } - - - return S_OK; -} - -HRESULT CCamera_Model::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; - } -#ifdef 기무리 - 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; - } -#endif // 기무리 - - if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { - return E_FAIL; - } - return S_OK; -} - -void CCamera_Model::Set_InitialPos() -{ - m_pTransformCom->Set_WorldMatrix(m_matInitial); -} - -CCamera_Model* CCamera_Model::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) -{ - CCamera_Model* pInstance = new CCamera_Model(pDevice, pContext); - if (FAILED(pInstance->Initialize_Prototype())) - { - MSG_BOX("Failed to Created : CCamera_Model"); - SAFE_RELEASE(pInstance); - } - - return pInstance; -} - -CGameObject* CCamera_Model::Clone(void* pArg, CGameObject* pOwner) -{ - CCamera_Model* pInstance = new CCamera_Model(*this); - pInstance->m_pOwner = pOwner; - if (FAILED(pInstance->Initialize(pArg))) - { - MSG_BOX("Failed to Cloned : CCamera_Model"); - SAFE_RELEASE(pInstance); - } - - return pInstance; -} - -void CCamera_Model::Free() -{ - __super::Free(); - - SAFE_RELEASE(m_pModelCom); - SAFE_RELEASE(m_pShaderCom); -} -#ifdef _DEBUG - -void CCamera_Model::Describe_Entity() -{ - _float3 vPosition = {}; - GUI::Begin("CameraAnim List"); - for (_int i = 0; i < m_pModelCom->Get_AnimSize(); i++) - { - if (GUI::Button(m_pModelCom->Get_AnimList(i))) - { - m_pModelCom->Set_AnimationIndex(i); - } - } - - - GUI::End(); -} - -#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 84ebb9e3b..54130a091 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -4,7 +4,6 @@ #include "Level_Loading.h" #include "Light_Main.h" #include "Camera_Debug.h" -#include "Camera_Model.h" #include "InfoInstance.h" #include "UI_Manager.h" #include "Layer.h" @@ -42,6 +41,7 @@ CLevel_GamePlay::CLevel_GamePlay(ID3D11Device* pDevice, ID3D11DeviceContext* pCo HRESULT CLevel_GamePlay::Initialize(void* pArg) { +#ifdef _DEBUG // 낮, 밤 설정 #ifdef gimch m_isDay = false; @@ -58,6 +58,8 @@ HRESULT CLevel_GamePlay::Initialize(void* pArg) #ifdef 인혁 m_isDay = true; #endif // +#endif // _DEBUG + if (FAILED(Ready_Lights())) { return E_FAIL; @@ -311,6 +313,7 @@ HRESULT CLevel_GamePlay::Ready_Background() _bool isReady_Background = { true }; _bool isReady_Hogsmeade = { true }; _bool isReady_Hogwart = { true }; +#ifdef _DEBUG #ifdef gimch isReady_Background = true; @@ -337,6 +340,8 @@ HRESULT CLevel_GamePlay::Ready_Background() isReady_Hogsmeade = false; isReady_Hogwart = false; #endif // +#endif // _DEBUG + /* Map Containters */ diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 9be1927a0..de1e898aa 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -14,7 +14,6 @@ #include "CamPosition_Socket.h" #include "CamPosition_Target.h" #include "CamPosition_AI.h" -#include "Camera_Model.h" #include "SkyBox.h" #include "Troll_Weapon.h" #include "Troll_Rock.h" @@ -355,7 +354,7 @@ HRESULT CLoader::Loading_For_GamePlay() m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); _bool isLoad_Background = { true }; - _bool isLoad_Hogwart = { false }; + _bool isLoad_Hogwart = { true }; _bool isLoad_UI_SEQUANTIAL = { true }; _bool isLoad_NPC = { true }; _bool isLoad_Monster = { true }; @@ -2877,10 +2876,6 @@ HRESULT CLoader::Loading_For_GamePlay() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamPosition_Arm::Create(m_pDevice, m_pContext)))) return E_FAIL; - /* For.Prototype_GameObject_Camera_Model */ - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CCamera_Model::Create(m_pDevice, m_pContext)))) - return E_FAIL; - /* For.Prototype_GameObject_Wand */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 1b8501711..341a74d9c 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -395,10 +395,6 @@ HRESULT CMapInfo::Load_LightElements(const _char* pFileName, const _wchar* pLaye if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } -#ifndef 기무리 - //MSG_BOX("Successed to Load File"); -#endif - return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index a652385c1..45981e1c8 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -408,6 +408,13 @@ void CPlayer::Start_CameraShake(_float fTime, _float fIntense) m_bCameraShake = true; } +void CPlayer::Set_RaceRing(CRaceRing* pRaceRing) +{ + SAFE_RELEASE(m_pRaceRing); + m_pRaceRing = pRaceRing; + SAFE_ADDREF(m_pRaceRing); +} + HRESULT CPlayer::Ready_Components() { CTransform::TRANSFORM_DESC Desc = {}; diff --git a/Jusin154_Team3D/Client/Public/Camera_Model.h b/Jusin154_Team3D/Client/Public/Camera_Model.h deleted file mode 100644 index eee7bdcfc..000000000 --- a/Jusin154_Team3D/Client/Public/Camera_Model.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "Client_Define.h" -#include "Camera.h" - -NS_BEGIN(Client) - -class CCamera_Model final : public CCamera -{ -public: - typedef struct tagCamera_Model : public CCamera::CAMERA_DESC - { - _float3 vEye{}, vAt{}; - _float fMouseSensor{}; - }CAMERA_MODEL_DESC; -private: - CCamera_Model(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - CCamera_Model(const CCamera_Model& rhs); - virtual ~CCamera_Model() = default; - -public: - virtual void Priority_Update(_float fTimeDelta) override; - virtual void Update(_float fTimeDelta) override; - virtual void Late_Update(_float fTimeDelta) override; - virtual HRESULT Render() override; - -private: - class CModel* m_pModelCom = { nullptr }; - class CShader* m_pShaderCom = { nullptr }; - _bool m_bMovable = true; - _float4x4 m_matInitial = {}; - -private: - virtual HRESULT Initialize_Prototype() override; - virtual HRESULT Initialize(void* pArg) override; - virtual HRESULT Ready_Components(void* pArg) override; - HRESULT Bind_ShaderResources() override; - void Set_InitialPos(); - -public: - static CCamera_Model* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - virtual CGameObject* Clone(void* pArg, CGameObject* pOwner) override; - virtual void Free() override; -#ifdef _DEBUG - void Describe_Entity() override; -#endif // _DEBUG - -}; - -NS_END diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h index 874aaf0aa..aa933ac63 100644 --- a/Jusin154_Team3D/Client/Public/Player.h +++ b/Jusin154_Team3D/Client/Public/Player.h @@ -32,7 +32,7 @@ class CPlayer final : public CUnit void Set_Shield(_bool bShield) { m_bShield = bShield; } void Start_CameraShake(_float fTime, _float fIntense); _int Get_UIState() { return m_eUIState; } - void Set_RaceRing(class CRaceRing* pRaceRing) { m_pRaceRing = pRaceRing; } + void Set_RaceRing(class CRaceRing* pRaceRing); class CBroom* Get_Broom() { return m_pBroom; } #ifdef _DEBUG void Render_CameraCoordinateSystem(); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index 18416faf2..dfc581080 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -44,6 +44,7 @@ float ShadowVisibility_hwPCF(Texture2D ShadowMap, float4 vLightClip, float2 vSha float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float fRimPower, float fRimStrength) { float fRimLight = (1 - dot(normalize(vCamPosition - vPosition), vNormal)); + fRimLight = max(fRimLight, 1e-6f); fRimLight = pow(fRimLight, fRimPower); fRimLight = fRimLight * fRimStrength; return fRimLight; @@ -70,24 +71,55 @@ float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndex return vOriginalUV * vDelta + vOffset; } -float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame) +float2 UV_Cutting(float2 originalUV, float2 uvCuttingCountFloat, int currentFrameIndex) { - float2 UV = vUV; // 이미지의 UV값 - - int iTotalFrame = vUVCutting.x * vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지) - - int iFrameX = iCurrentFrame % (int) vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지) - int iFrameY = iCurrentFrame / (int) vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지) - - float fFreamWidth = 1.0 / vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다. - float fFreamHeight = 1.0 / vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다. - - UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다. - UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다. - - return UV; + // (1) 칸 개수는 정수로 취급 (0 방지) + int uvCuttingCountX = max((int) uvCuttingCountFloat.x, 1); + int uvCuttingCountY = max((int) uvCuttingCountFloat.y, 1); + + int totalFrameCount = uvCuttingCountX * uvCuttingCountY; + + // (2) currentFrameIndex를 [0, totalFrameCount)로 래핑 (정수 % 제거) + int wrappedFrameIndex = currentFrameIndex; + if (totalFrameCount > 0) + { + float inverseTotalFrameCount = 1.0f / (float) totalFrameCount; + + // loopCount = floor(currentFrameIndex / totalFrameCount) + int loopCount = (int) floor((float) currentFrameIndex * inverseTotalFrameCount); + + wrappedFrameIndex = currentFrameIndex - loopCount * totalFrameCount; + + // 음수 프레임까지 방어(선택) + if (wrappedFrameIndex < 0) + { + wrappedFrameIndex += totalFrameCount; + } + } + else + { + wrappedFrameIndex = 0; + } + + // (3) 가로 기준으로 행/열 구하기 (정수 /, % 제거) + float inverseCuttingCountX = 1.0f / (float) uvCuttingCountX; + float inverseCuttingCountY = 1.0f / (float) uvCuttingCountY; + + // frameIndexY = floor(wrappedFrameIndex / uvCuttingCountX) + int frameIndexY = (int) floor((float) wrappedFrameIndex * inverseCuttingCountX); + + // frameIndexX = wrappedFrameIndex - frameIndexY * uvCuttingCountX (% 대체) + int frameIndexX = wrappedFrameIndex - frameIndexY * uvCuttingCountX; + + // (4) UV 변환 + float2 resultUV = originalUV; + resultUV.x = resultUV.x * inverseCuttingCountX + (float) frameIndexX * inverseCuttingCountX; + resultUV.y = resultUV.y * inverseCuttingCountY + (float) frameIndexY * inverseCuttingCountY; + + return resultUV; } + // (Kd F(Lambert)) + (Ks F(cook-torrance)) //float LambertDiffuse(float c) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0a4ed6bb2..d1a19270a 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -685,6 +685,15 @@ PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In) Out.vEnvironment = float4(0.f, 0.f, 0.f, 0.f); return Out; +}; +PS_OUT_BACKBUFFER PS_MAIN_PRINT(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + + Out.vBackBuffer = g_Texture.Sample(DefaultSampler, In.vTexcoord); + Out.vEnvironment = float4(0.f, 0.f, 0.f, 0.f); + return Out; + }; PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) @@ -1522,4 +1531,13 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } + pass PrintToBackBufferPass // 22 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_PRINT(); + } } 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 bf7098a39..4012669d4 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 @@ -356,9 +356,8 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; - if (AlphaMask < 0.2f) { - discard; - } + clip(AlphaMask - 0.2f); + 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)); @@ -368,8 +367,8 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) float SpecMask = vTHV_Mask.g; float AoMask_Thv = vTHV_Mask.b; - float3 vColorRoot = vDAO_Mask * 0.6f; - float3 vColorTip = vDAO_Mask; + float3 vColorRoot = vDAO_Mask.rgb * 0.6f; + float3 vColorTip = vDAO_Mask.rgb; float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); @@ -396,9 +395,9 @@ PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); @@ -429,9 +428,8 @@ PS_OUT PS_EYE_DN_SRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); @@ -471,11 +469,9 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) float fDiffuseMask = vDAO_Mask.r; float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; + + clip(AlphaMask - 0.2f); - 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)); @@ -517,11 +513,9 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) float fDiffuseMask = vDAO_Mask.r; float AlphaMask = vDAO_Mask.g; float AoMask_Dao = vDAO_Mask.b; + + clip(AlphaMask - 0.2f); - 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)); @@ -559,9 +553,9 @@ PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -591,9 +585,9 @@ PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -623,9 +617,9 @@ PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -655,9 +649,9 @@ PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In) float4 vBurnColor = g_DeadDisolveBurnTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -689,9 +683,9 @@ PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In) vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } vDiffuse.rgb += vEmissive.rgb * 3.f; - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -723,9 +717,9 @@ PS_OUT PS_DNMRO_ToMRO(PS_IN In) vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } vDiffuse.rgb += vEmissive.rgb * 3.f; - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -757,9 +751,9 @@ PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In) } float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse.rgb += vEmissive.rgb; - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -790,10 +784,9 @@ PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In) vDiffuse = ApplyDissolve(g_DeadDisolveTexture, g_fDisolveRatio, g_fDisolveAmount, g_fDisolveEdgeWidth, vBurnColor, vDiffuse, In.vTexcoord); } float4 vAlpha = g_TransmissionTexture.Sample(DefaultSampler, In.vTexcoord); - if (vAlpha.r < 0.2f) - { - discard; - } + + clip(vAlpha.r - 0.2f); + vDiffuse.a = vAlpha.r; float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); @@ -833,9 +826,9 @@ PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In) float4 vAmbient = g_AmbientTexture.Sample(DefaultSampler, In.vTexcoord); vDiffuse.rgb += vEmissive.rgb; vDiffuse.rgb += vAmbient.rgb; - if (vDiffuse.a < 0.2f) { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -890,10 +883,8 @@ PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In) float3 vColorTip = vColorHair; float3 vBaseColor = lerp(vColorRoot, vColorTip, RootTip); - if (fAlpha < 0.3f) - { - discard; - } + clip(fAlpha - 0.2f); + Out.vAlbedo = float4(vBaseColor, fAlpha); Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), @@ -1031,10 +1022,9 @@ PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) float fAlphaRoot = AlphaMask; float fBaseAlpha = lerp(fAlphaRoot, fAlphaTip, (1.f - RootTip)); float fAlpha = (fBaseAlpha); - if (fAlpha < 0.2f) - { - discard; - } + + clip(fAlpha - 0.2f); + Out.vAlbedo = float4(vBaseColor, fAlpha); Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), @@ -1099,10 +1089,9 @@ PS_OUT PS_Dragon_Body(PS_IN In) } float fOppacity = g_NormalBlendTexture.Sample(DefaultSampler, uv).r; vDiffuse.a = fOppacity; - if (vDiffuse.a < 0.2f) - { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); @@ -1137,10 +1126,9 @@ PS_OUT PS_Dragon_Wings(PS_IN In) float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, uv); vDiffuse += vEmissive; - if (vDiffuse.a < 0.2f) - { - discard; - } + + clip(vDiffuse.a - 0.2f); + 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)); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl index 7fee21d02..280881843 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl @@ -78,7 +78,7 @@ float g_fUsingSurfaceParams; float g_fMBIntensity = 1.f; /* 디퓨즈 */ -vector g_vColor; +float4 g_vColor; float g_fDiffuseAlpha; float2 g_vDiffuseUVGainAmount; @@ -286,18 +286,18 @@ VS_BULR_MESH_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_InstanceID) - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; - Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); - Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; - Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vNormal = normalize(mul(float4(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(float4(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(float4(In.vBinormal, 0.f), matW)).xyz; Out.vTexcoord = In.vTexcoord; Out.vLifeTime = In.vLifeTime; - Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.vWorldPos = mul(float4(In.vPosition, 1.f), matW); Out.iGPUIndex = iGPUIndex; Out.vProjPos = vPosition; - Out.vPrevProjPos = mul(vector(In.vPosition, 1.f), matPrevWVP); + Out.vPrevProjPos = mul(float4(In.vPosition, 1.f), matPrevWVP); return Out; } @@ -313,7 +313,7 @@ VS_BULR_MESH_OUT VS_MAIN_NO_POS(VS_IN In, uint iGPUIndex : SV_InstanceID) row_major matrix Wolrd_NonPosMatrix = g_WorldMatrix; - Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + Wolrd_NonPosMatrix[3] = float4(0.f, 0.f, 0.f, 1.f); matW = mul(TransformMatrix, Wolrd_NonPosMatrix); @@ -329,7 +329,7 @@ VS_BULR_MESH_OUT VS_MAIN_NO_POS(VS_IN In, uint iGPUIndex : SV_InstanceID) row_major matrix PreWolrd_NonPosMatrix = g_PrevWorldMatrix; - Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + Wolrd_NonPosMatrix[3] = float4(0.f, 0.f, 0.f, 1.f); matrix matPrevW, matPrevWV, matPrevWVP; @@ -341,18 +341,18 @@ VS_BULR_MESH_OUT VS_MAIN_NO_POS(VS_IN In, uint iGPUIndex : SV_InstanceID) matPrevWVP = mul(matPrevWV, g_PrevProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; - Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); - Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; - Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vNormal = normalize(mul(float4(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(float4(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(float4(In.vBinormal, 0.f), matW)).xyz; Out.vTexcoord = In.vTexcoord; Out.vLifeTime = In.vLifeTime; - Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.vWorldPos = mul(float4(In.vPosition, 1.f), matW); Out.iGPUIndex = iGPUIndex; Out.vProjPos = vPosition; - Out.vPrevProjPos = mul(vector(In.vPosition, 1.f), matPrevWVP); + Out.vPrevProjPos = mul(float4(In.vPosition, 1.f), matPrevWVP); return Out; } @@ -370,15 +370,15 @@ VS_OUT VS_NOWORLD(VS_IN In, uint iGPUIndex : SV_InstanceID) matWV = mul(matW, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; - Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); - Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; - Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vNormal = normalize(mul(float4(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(float4(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(float4(In.vBinormal, 0.f), matW)).xyz; Out.vTexcoord = In.vTexcoord; Out.vLifeTime = In.vLifeTime; - Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.vWorldPos = mul(float4(In.vPosition, 1.f), matW); Out.iGPUIndex = iGPUIndex; Out.vProjPos = vPosition; @@ -395,7 +395,7 @@ VS_OUT VS_NONPOS(VS_IN In, uint iGPUIndex : SV_InstanceID) row_major matrix Wolrd_NonPosMatrix = g_WorldMatrix; - Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + Wolrd_NonPosMatrix[3] = float4(0.f, 0.f, 0.f, 1.f); matW = mul(TransformMatrix, Wolrd_NonPosMatrix); @@ -404,15 +404,15 @@ VS_OUT VS_NONPOS(VS_IN In, uint iGPUIndex : SV_InstanceID) matWV = mul(matW, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; - Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); - Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; - Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vNormal = normalize(mul(float4(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(float4(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(float4(In.vBinormal, 0.f), matW)).xyz; Out.vTexcoord = In.vTexcoord; Out.vLifeTime = In.vLifeTime; - Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.vWorldPos = mul(float4(In.vPosition, 1.f), matW); Out.iGPUIndex = iGPUIndex; Out.vProjPos = vPosition; return Out; @@ -439,18 +439,18 @@ VS_BULR_MESH_OUT VS_BLUR_MESH(VS_IN In, uint iGPUIndex : SV_InstanceID) matPrevWVP = mul(matPrevWV, g_PrevProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; - Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); - Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; - Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vNormal = normalize(mul(float4(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(float4(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(float4(In.vBinormal, 0.f), matW)).xyz; Out.vTexcoord = In.vTexcoord; Out.vLifeTime = In.vLifeTime; - Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.vWorldPos = mul(float4(In.vPosition, 1.f), matW); Out.iGPUIndex = iGPUIndex; Out.vProjPos = vPosition; - Out.vPrevProjPos = mul(vector(In.vPosition, 1.f), matPrevWVP); + Out.vPrevProjPos = mul(float4(In.vPosition, 1.f), matPrevWVP); return Out; } @@ -487,11 +487,11 @@ struct PS_NOMAL_OUT float4 DrawEffect(PS_IN In) { - vector vMtrlDiffuse = vector(0.f ,0.f ,0.f ,0.f); - vector vMtrlMask; - vector vMtrlNoise; - vector vMtrlDissolve; - vector vMtrlDistortion; + float4 vMtrlDiffuse = float4(0.f ,0.f ,0.f ,0.f); + float4 vMtrlMask; + float4 vMtrlNoise; + float4 vMtrlDissolve; + float4 vMtrlDistortion; float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x; float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime; @@ -539,7 +539,7 @@ float4 DrawEffect(PS_IN In) } - vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV); + float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV); if (g_isDiffuse_R) vMtrlDiffuse.r = vDiffuse.r; @@ -595,7 +595,7 @@ float4 DrawEffect(PS_IN In) if (g_isNoiseColor) { - float fNoiseValue = vMtrlNoise.rgb; + float fNoiseValue = vMtrlNoise.r; if (g_isNoise_G == true) fNoiseValue = vMtrlNoise.g; @@ -607,7 +607,7 @@ float4 DrawEffect(PS_IN In) } if (length(g_vNoiseColor) > FLT_EPSILON5) - vMtrlDiffuse.rgb *= g_vNoiseColor; + vMtrlDiffuse.rgb *= g_vNoiseColor.rgb; } @@ -680,10 +680,7 @@ float4 DrawEffect(PS_IN In) vMtrlDiffuse.a *= g_fDiffuseAlpha; - if (vMtrlDiffuse.a <= FLT_EPSILON5) - discard; - - + clip(vMtrlDiffuse.a - FLT_EPSILON5); if (g_isDissolve == true) { @@ -759,16 +756,14 @@ float4 DrawEffect(PS_IN In) if (g_isNoDissolveSmoothStep == true) { - fFade = smoothstep(fTimeRatio, fTimeRatio, vMtrlDissolve.r); - + fFade = fTimeRatio; } vMtrlDiffuse.a *= fFade; } - if (vMtrlDiffuse.a <= FLT_EPSILON5) - discard; + clip(vMtrlDiffuse.a - FLT_EPSILON5); } @@ -777,7 +772,7 @@ float4 DrawEffect(PS_IN In) float4 EmissiveDraw(PS_IN In, float4 Diffuse) { - float4 vEmissiveMtrl = vector(0.f, 0.f, 0.f, 0.f); + float4 vEmissiveMtrl = float4(0.f, 0.f, 0.f, 0.f); float2 CenteredUV = In.vTexcoord - 0.5f; float fEmissive = 0.f; float fEmissiveStrength = g_fEmissiveStrength; @@ -830,7 +825,7 @@ float4 EmissiveDraw(PS_IN In, float4 Diffuse) } -PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ) +PS_OUT BlendedWeight(float4 fDiffuse, float fLinearZ) { PS_OUT Out = (PS_OUT)0; @@ -853,9 +848,11 @@ PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ) //float fWeight = pow(fLinearZ, -2.5); - float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f); + float linearZPositive = max(fLinearZ, 1e-6f); + float fWeight = clamp(pow(linearZPositive, -2.5f), 1.0f, 1000.0f); + - Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight; + Out.vDiffuse = float4(vColor.rgb * fAlpha, fAlpha) * fWeight; Out.vRevealage.r = fAlpha; @@ -919,7 +916,7 @@ PS_NOMAL_OUT PS_MAIN(PS_BLUR_MESH_IN In) PS_In.vProjPos = In.vProjPos; PS_In.iGPUIndex = In.iGPUIndex; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; float4 vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord); float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); @@ -960,7 +957,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In) { PS_OUT Out = (PS_OUT)0; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); @@ -998,7 +995,7 @@ VS_OUT VS_BLUR(VS_IN In, uint iGPUIndex : SV_InstanceID) matWV = mul(matW, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; Out.vTexcoord = In.vTexcoord; @@ -1021,7 +1018,7 @@ VS_OUT VS_BLUR_NOWORLD(VS_IN In, uint iGPUIndex : SV_InstanceID) matWV = mul(matW, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; Out.vTexcoord = In.vTexcoord; @@ -1042,7 +1039,7 @@ VS_OUT VS_BLUR_NOPOS(VS_IN In, uint iGPUIndex : SV_InstanceID) row_major matrix Wolrd_NonPosMatrix = g_WorldMatrix; - Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + Wolrd_NonPosMatrix[3] = float4(0.f, 0.f, 0.f, 1.f); matW = mul(TransformMatrix, Wolrd_NonPosMatrix); @@ -1051,7 +1048,7 @@ VS_OUT VS_BLUR_NOPOS(VS_IN In, uint iGPUIndex : SV_InstanceID) matWV = mul(matW, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); - vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + float4 vPosition = mul(float4(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; Out.vTexcoord = In.vTexcoord; @@ -1081,19 +1078,15 @@ PS_BLUR_OUT PS_BLUR_NOEMISSIVE(PS_IN In) { PS_BLUR_OUT Out; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); if (g_isBlurColor == true) { - if (length(vMtrlDiffuse.rgb) < FLT_EPSILON5) - { - discard; - } + clip(length(vMtrlDiffuse.rgb) - FLT_EPSILON5); - vMtrlDiffuse = vector(g_vBlurColor.rgb, vMtrlDiffuse.a); - + vMtrlDiffuse = float4(g_vBlurColor.rgb, vMtrlDiffuse.a); } vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse); @@ -1111,7 +1104,7 @@ PS_BLUR_OUT PS_BLUR_NOEMISSIVE(PS_IN In) fBulrIntensity = saturate(fBulrIntensity); } - Out.vDiffuse = vector(vMtrlDiffuse.rgb * fBulrIntensity, vMtrlDiffuse.a); + Out.vDiffuse = float4(vMtrlDiffuse.rgb * fBulrIntensity, vMtrlDiffuse.a); return Out; } @@ -1120,19 +1113,15 @@ PS_BLUR_OUT PS_BLUR(PS_IN In) { PS_BLUR_OUT Out; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); if(g_isBlurColor == true) { - if (length(vMtrlDiffuse.rgb) < FLT_EPSILON5) - { - discard; - } + clip(length(vMtrlDiffuse.rgb) - FLT_EPSILON5); - vMtrlDiffuse = vector(g_vBlurColor.rgb, vMtrlDiffuse.a); - + vMtrlDiffuse = float4(g_vBlurColor.rgb, vMtrlDiffuse.a); } @@ -1153,7 +1142,7 @@ PS_BLUR_OUT PS_BLUR(PS_IN In) fBulrIntensity = saturate(fBulrIntensity); } - Out.vDiffuse = vector(vMtrlDiffuse.rgb * fBulrIntensity, vMtrlDiffuse.a); + Out.vDiffuse = float4(vMtrlDiffuse.rgb * fBulrIntensity, vMtrlDiffuse.a); return Out; } @@ -1166,7 +1155,7 @@ PS_BLOOM_OUT PS_BLOOM(PS_IN In) if (FLT_EPSILON5 >= (In.vLifeTime.x / In.vLifeTime.y)) discard; - vector vMtrlDiffuse = vector(0.f, 0.f, 0.f, 0.f); + float4 vMtrlDiffuse = float4(0.f, 0.f, 0.f, 0.f); vMtrlDiffuse = DrawEffect(In); @@ -1202,7 +1191,7 @@ PS_BLNED_OUT PS_BLEND(PS_IN In) { PS_BLNED_OUT Out; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); @@ -1220,7 +1209,7 @@ PS_BLNED_OUT PS_WEIGHTED_FOR_BLEND(PS_IN In) { PS_BLNED_OUT Out; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); @@ -1239,7 +1228,7 @@ PS_OUT PS_NO_DEPTH_COMPARE(PS_IN In) { PS_OUT Out = (PS_OUT)0; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); @@ -1256,7 +1245,7 @@ PS_BLOOM_OUT PS_DISTORTION(PS_IN In) { PS_BLOOM_OUT Out; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(In); @@ -1298,7 +1287,6 @@ PS_BLUR_MESH_OUT PS_BLUR_MESH(PS_BLUR_MESH_IN In) { PS_BLUR_MESH_OUT Out; - PS_OUT PS_Out; PS_IN PS_In; PS_In.vPosition = In.vPosition; @@ -1311,7 +1299,7 @@ PS_BLUR_MESH_OUT PS_BLUR_MESH(PS_BLUR_MESH_IN In) PS_In.vProjPos = In.vProjPos; PS_In.iGPUIndex = In.iGPUIndex; - vector vMtrlDiffuse; + float4 vMtrlDiffuse; vMtrlDiffuse = DrawEffect(PS_In); @@ -1326,7 +1314,7 @@ PS_BLUR_MESH_OUT PS_BLUR_MESH(PS_BLUR_MESH_IN In) Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1) (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z 0.f, // 서페이스 파라미터 - 1.f); + 1.f).rg; return Out; } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 79c54b2b6..6df53479c 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -711,6 +711,10 @@ call Update_Shaders.bat Effect Effect 5.0 + + + + Effect diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli index 18416faf2..dfc581080 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -44,6 +44,7 @@ float ShadowVisibility_hwPCF(Texture2D ShadowMap, float4 vLightClip, float2 vSha float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float fRimPower, float fRimStrength) { float fRimLight = (1 - dot(normalize(vCamPosition - vPosition), vNormal)); + fRimLight = max(fRimLight, 1e-6f); fRimLight = pow(fRimLight, fRimPower); fRimLight = fRimLight * fRimStrength; return fRimLight; @@ -70,24 +71,55 @@ float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndex return vOriginalUV * vDelta + vOffset; } -float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame) +float2 UV_Cutting(float2 originalUV, float2 uvCuttingCountFloat, int currentFrameIndex) { - float2 UV = vUV; // 이미지의 UV값 - - int iTotalFrame = vUVCutting.x * vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지) - - int iFrameX = iCurrentFrame % (int) vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지) - int iFrameY = iCurrentFrame / (int) vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지) - - float fFreamWidth = 1.0 / vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다. - float fFreamHeight = 1.0 / vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다. - - UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다. - UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다. - - return UV; + // (1) 칸 개수는 정수로 취급 (0 방지) + int uvCuttingCountX = max((int) uvCuttingCountFloat.x, 1); + int uvCuttingCountY = max((int) uvCuttingCountFloat.y, 1); + + int totalFrameCount = uvCuttingCountX * uvCuttingCountY; + + // (2) currentFrameIndex를 [0, totalFrameCount)로 래핑 (정수 % 제거) + int wrappedFrameIndex = currentFrameIndex; + if (totalFrameCount > 0) + { + float inverseTotalFrameCount = 1.0f / (float) totalFrameCount; + + // loopCount = floor(currentFrameIndex / totalFrameCount) + int loopCount = (int) floor((float) currentFrameIndex * inverseTotalFrameCount); + + wrappedFrameIndex = currentFrameIndex - loopCount * totalFrameCount; + + // 음수 프레임까지 방어(선택) + if (wrappedFrameIndex < 0) + { + wrappedFrameIndex += totalFrameCount; + } + } + else + { + wrappedFrameIndex = 0; + } + + // (3) 가로 기준으로 행/열 구하기 (정수 /, % 제거) + float inverseCuttingCountX = 1.0f / (float) uvCuttingCountX; + float inverseCuttingCountY = 1.0f / (float) uvCuttingCountY; + + // frameIndexY = floor(wrappedFrameIndex / uvCuttingCountX) + int frameIndexY = (int) floor((float) wrappedFrameIndex * inverseCuttingCountX); + + // frameIndexX = wrappedFrameIndex - frameIndexY * uvCuttingCountX (% 대체) + int frameIndexX = wrappedFrameIndex - frameIndexY * uvCuttingCountX; + + // (4) UV 변환 + float2 resultUV = originalUV; + resultUV.x = resultUV.x * inverseCuttingCountX + (float) frameIndexX * inverseCuttingCountX; + resultUV.y = resultUV.y * inverseCuttingCountY + (float) frameIndexY * inverseCuttingCountY; + + return resultUV; } + // (Kd F(Lambert)) + (Ks F(cook-torrance)) //float LambertDiffuse(float c) diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0a4ed6bb2..d1a19270a 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -685,6 +685,15 @@ PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In) Out.vEnvironment = float4(0.f, 0.f, 0.f, 0.f); return Out; +}; +PS_OUT_BACKBUFFER PS_MAIN_PRINT(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + + Out.vBackBuffer = g_Texture.Sample(DefaultSampler, In.vTexcoord); + Out.vEnvironment = float4(0.f, 0.f, 0.f, 0.f); + return Out; + }; PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) @@ -1522,4 +1531,13 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } + pass PrintToBackBufferPass // 22 + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_None, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN_PRINT(); + } } diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 01a3bcf11..1c0c529c9 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -51,12 +51,19 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De } } } +#ifdef _DEBUG #ifdef 기무리 m_pThreadHolder = CThreadHolder::Create(12); #endif // 기무리 #ifndef 기무리 m_pThreadHolder = CThreadHolder::Create(6); #endif // !기무리 +#endif // _DEBUG +#ifndef _DEBUG + m_pThreadHolder = CThreadHolder::Create(12); +#endif // !_DEBUG + + if (nullptr == m_pThreadHolder) { diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index 55b6d05d5..8627d6fb7 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -763,7 +763,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel) sceneDesc.gravity = PSX::PxVec3(0.f, -GRAVITY, 0.f); - m_pDispatcher = PSX::PxDefaultCpuDispatcherCreate(2/*cpu 코어 갯수*/); + m_pDispatcher = PSX::PxDefaultCpuDispatcherCreate(4 /*cpu 코어 스레드 갯수에 따라 유동적으로 선택*/); if (nullptr == m_pDispatcher) { assert(false); return E_FAIL; diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 011ef2521..930720aab 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -584,7 +584,7 @@ void CRenderer::Render_Fog() return; } - m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::FOG)); + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::PRINT_BACKBUFFER)); m_pVIBuffer->Bind_Resources(); m_pVIBuffer->Render(); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 9cab65c86..1000992b4 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -48,7 +48,7 @@ enum class SHADER_PASS_CELL { DEBUG, END }; enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, UPSAMPLE, BLOOM_BLURX, BLOOM_BLURY, EMBOSSING, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT, - POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, MOTIONBLUR, DOWNSAMPLE, MOTIONBLURTILE, MOTIONBLURTENT, + POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, MOTIONBLUR, DOWNSAMPLE, MOTIONBLURTILE, MOTIONBLURTENT, PRINT_BACKBUFFER, END }; enum class SHADER_PASS_BLUR { BLUR_X , BLUR_Y , COMBINED, END};