diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 38eea62d7..285ef01bc 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -336,6 +336,107 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) return Out; } +PS_OUT_BACKBUFFER PS_MAIN_MROCOMBINED(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + + vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (0.f == vDiffuse.a) + { + discard; + } + + vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord); + + vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vBackBuffer = vDiffuse * vShade + vSpecular; + + vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + + + float fViewZ = vDepthDesc.y * g_fFar; + + + vector vPosition, vPreShadowPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = In.vTexcoord.x * 2.f - 1.f; + vPosition.y = In.vTexcoord.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + vPosition = vPosition * fViewZ; + + vPosition = mul(vPosition, g_invmatProj); + vPosition = mul(vPosition, g_invMatView); + vPreShadowPosition = vPosition; + /* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */ + vPosition = mul(vPosition, g_LightViewMatrix); + vPosition = mul(vPosition, g_LightProjMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightViewMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix); + + /* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */ + float2 vTexcoord, vPreShadowTexcoord; + vTexcoord.x = (vPosition.x / vPosition.w) * 0.5f + 0.5f; + vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f; + vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f; + vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f; + + /* 광원의 NDC에서 샘플링 */ + float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + + Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static)); + //float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x; + //float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x; + //bool IsShadow = { false }; + //if (vPosition.z - 0.0005f > fShadowDepth) + //{ + // IsShadow = true; + //} + //if (vPreShadowPosition.z - 0.0005f > fPreShadowDepth) + //{ + // IsShadow = true; + //} + //if (true == IsShadow) + //{ + // Out.vBackBuffer *= 0.5f; + //} + float4 vColor = 0.f; + + //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f; + + //int iBlurMin; + //int iBlurMax; + + //if (iBlurWeight % 2 == 0) + //{ + // iBlurMin = -1 * iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2; + //} + //else + //{ + // iBlurMin = -iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2 + 1; + //} + + //[loop] // 변수로 루프돌리려면 반드시 필요함 + for (int i = -15; i < 16; ++i) + { + vTexcoord.x = In.vTexcoord.x; + vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y; + + vColor += g_fWeights[i + 15] * g_BlurXTexture.Sample(ClampSampler, vTexcoord); + } + + Out.vBackBuffer += vColor; + + return Out; +} + struct PS_OUT_BLUR_X { float4 vBlurX : SV_TARGET0; @@ -444,4 +545,13 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN_SPOT(); } + pass MROCombinedPass + { + 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_MROCOMBINED(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin index c50ee846f..ae6f282af 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin new file mode 100644 index 000000000..8bfee58f2 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a474ee4079f2727f72b82ad260f074dd07eb4c1711f604b7ed9b4aff689f7933 +size 739778 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx new file mode 100644 index 000000000..3cb8313b1 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04095b30fb71db8aa5a1f88b789368f538077f5310d3f087c68af30ebaaf418a +size 302236 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds new file mode 100644 index 000000000..30a480528 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds new file mode 100644 index 000000000..fc183f014 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds new file mode 100644 index 000000000..2a74db500 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds new file mode 100644 index 000000000..020dc3728 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds new file mode 100644 index 000000000..dbd482408 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds new file mode 100644 index 000000000..81928a67b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds new file mode 100644 index 000000000..9e747644c Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds new file mode 100644 index 000000000..87c321c86 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds new file mode 100644 index 000000000..7489e9c83 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 38eea62d7..285ef01bc 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -336,6 +336,107 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) return Out; } +PS_OUT_BACKBUFFER PS_MAIN_MROCOMBINED(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + + vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (0.f == vDiffuse.a) + { + discard; + } + + vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord); + + vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vBackBuffer = vDiffuse * vShade + vSpecular; + + vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + + + float fViewZ = vDepthDesc.y * g_fFar; + + + vector vPosition, vPreShadowPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = In.vTexcoord.x * 2.f - 1.f; + vPosition.y = In.vTexcoord.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + vPosition = vPosition * fViewZ; + + vPosition = mul(vPosition, g_invmatProj); + vPosition = mul(vPosition, g_invMatView); + vPreShadowPosition = vPosition; + /* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */ + vPosition = mul(vPosition, g_LightViewMatrix); + vPosition = mul(vPosition, g_LightProjMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightViewMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix); + + /* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */ + float2 vTexcoord, vPreShadowTexcoord; + vTexcoord.x = (vPosition.x / vPosition.w) * 0.5f + 0.5f; + vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f; + vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f; + vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f; + + /* 광원의 NDC에서 샘플링 */ + float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + + Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static)); + //float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x; + //float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x; + //bool IsShadow = { false }; + //if (vPosition.z - 0.0005f > fShadowDepth) + //{ + // IsShadow = true; + //} + //if (vPreShadowPosition.z - 0.0005f > fPreShadowDepth) + //{ + // IsShadow = true; + //} + //if (true == IsShadow) + //{ + // Out.vBackBuffer *= 0.5f; + //} + float4 vColor = 0.f; + + //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f; + + //int iBlurMin; + //int iBlurMax; + + //if (iBlurWeight % 2 == 0) + //{ + // iBlurMin = -1 * iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2; + //} + //else + //{ + // iBlurMin = -iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2 + 1; + //} + + //[loop] // 변수로 루프돌리려면 반드시 필요함 + for (int i = -15; i < 16; ++i) + { + vTexcoord.x = In.vTexcoord.x; + vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y; + + vColor += g_fWeights[i + 15] * g_BlurXTexture.Sample(ClampSampler, vTexcoord); + } + + Out.vBackBuffer += vColor; + + return Out; +} + struct PS_OUT_BLUR_X { float4 vBlurX : SV_TARGET0; @@ -444,4 +545,13 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN_SPOT(); } + pass MROCombinedPass + { + 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_MROCOMBINED(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index 37ae44db6..51cc8a940 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -24,6 +24,7 @@ Texture2D g_ClippingTexture; Texture2D g_DisolveTexture; Texture2D g_NormalTexture; Texture2D g_GlowTexture; +Texture2D g_MROTexture; struct VS_IN { @@ -181,6 +182,30 @@ PS_OUT PS_MAIN(PS_IN In) return Out; } +PS_OUT PS_PROP(PS_IN In) +{ + PS_OUT Out; + + vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + if (vMtrlDiffuse.a < 0.2f) + { + discard; + } + + vector vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord); + float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); + + float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); + + float fRoughness = g_MROTexture.Sample(DefaultSampler, In.vTexcoord).g; + + + Out.vDiffuse = vMtrlDiffuse; + Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f); + Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, fRoughness, 1.f); + + return Out; +} PS_OUT PS_MAIN_SELECT(PS_IN In) { PS_OUT Out; @@ -479,4 +504,22 @@ technique11 MeshTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_GLASS(); } + pass PropPass // 13 + { + 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_PROP(); + } + pass NoMROPropPass // 14 + { + 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_MAIN(); + } } diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 3b42004f1..503b80cbd 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -172,6 +172,7 @@ + true true @@ -204,6 +205,7 @@ + @@ -276,6 +278,7 @@ + true true @@ -308,6 +311,7 @@ + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index c8ca1bd92..ec64a48ce 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -280,6 +280,12 @@ {83781d7f-b84d-45a3-8361-b6bed2722b74} + + {19c5f600-e566-4903-ab74-448904dcbc99} + + + {04d044a9-3cab-4425-9adf-8eea436e71d4} + @@ -549,6 +555,12 @@ 02.GameObjects\Dummys\DummyPhysX\00.Callback\Behavior\Playable + + 01.Level\65.BloomViewer + + + 02.GameObjects\Dummys\DummyGlobe + @@ -814,6 +826,12 @@ 02.GameObjects\Dummys\DummyPhysX\00.Callback\Behavior\Playable + + 01.Level\65.BloomViewer + + + 02.GameObjects\Dummys\DummyGlobe + diff --git a/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp b/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp new file mode 100644 index 000000000..1637e8af0 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp @@ -0,0 +1,166 @@ +#include "pch.h" +#include "Dummy_Globe.h" + +#include "GameInstance.h" + + +CDummy_Globe::CDummy_Globe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CGameObject{ pDevice, pContext } +{ +} + +CDummy_Globe::CDummy_Globe(const CDummy_Globe& rhs) + : CGameObject(rhs) +{ +} + +HRESULT CDummy_Globe::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDummy_Globe::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + + return S_OK; +} + +void CDummy_Globe::Priority_Update(_float fTimeDelta) +{ + +} + +void CDummy_Globe::Update(_float fTimeDelta) +{ +} + +void CDummy_Globe::Late_Update(_float fTimeDelta) +{ + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + } +} + +HRESULT CDummy_Globe::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, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_MROTexture", aiTextureType_SHININESS, 0))) { + return E_FAIL; + } + + if (true == m_bMRO) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::PROP)))) { + return E_FAIL; + } + } + else { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::NOMROPROP)))) { + return E_FAIL; + } + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + + return S_OK; +} + +HRESULT CDummy_Globe::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Desc_Globe"), + reinterpret_cast(&m_pModelCom)))){ + return E_FAIL; + } + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&m_pShaderCom)))){ + return E_FAIL; + } + + return S_OK; +} + +HRESULT CDummy_Globe::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; +} + +CDummy_Globe* CDummy_Globe::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDummy_Globe* pInstance = new CDummy_Globe(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDummy_Globe"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDummy_Globe::Clone(void* pArg, CGameObject* pOwner) +{ + CDummy_Globe* pInstance = new CDummy_Globe(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDummy_Globe"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDummy_Globe::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pModelCom); + SAFE_RELEASE(m_pShaderCom); +} + +void CDummy_Globe::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp new file mode 100644 index 000000000..77f9b689a --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp @@ -0,0 +1,125 @@ +#include "pch.h" +#include "Level_BloomViewer.h" +#include "GameInstance.h" +#include "DebugCamera.h" +#include "Dummy_Cube.h" +#include "Dummy_Globe.h" +#include "MainLight.h" +#include "Dummy_Plane.h" + +CLevel_BloomViewer::CLevel_BloomViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) + : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } +{ + +} + +HRESULT CLevel_BloomViewer::Initialize() +{ + if (FAILED(Ready_Layer_Light())) { + return E_FAIL; + } + + if (FAILED(Ready_Layer_Camera(TEXT("Layer_Camera")))) + { + return E_FAIL; + } + + if (FAILED(Ready_Layer_Effect(TEXT("Layer_Effect")))) + { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))){ + return E_FAIL; + } + + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))){ + // return E_FAIL; + //} + + //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))){ + // return E_FAIL; + //} + + return S_OK; +} + +void CLevel_BloomViewer::Update(_float fTimeDelta) +{ + +} + +HRESULT CLevel_BloomViewer::Render() +{ + SetWindowText(g_hWnd, TEXT("이펙트 레벨입니다")); + GUI::ShowDemoWindow(); + return S_OK; +} + + + +HRESULT CLevel_BloomViewer::Ready_Layer_Camera(const _wstring& strLayerTag) +{ + CDebugCamera::CAMERA_DEBUG_DESC CameraDesc{}; + CameraDesc.fFovy = XMConvertToRadians(60.0f); + CameraDesc.fNear = 0.1f; + CameraDesc.fFar = 500.f; + CameraDesc.vEye = _float3(0.f, 10.f, -10.f); + CameraDesc.vAt = _float3(0.f, 0.f, 0.f); + CameraDesc.fSpeedPerSec = 5.f; + CameraDesc.pCameraKey = TEXT("Debug_Camera"); + CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f); + CameraDesc.fMouseSensor = 0.1f; + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, + strLayerTag, &CameraDesc))) + return E_FAIL; + + return S_OK; +} + +HRESULT CLevel_BloomViewer::Ready_Layer_Light() +{ + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, LAYER_LIGHT))){ + return E_FAIL; + } + + return S_OK; +} + +HRESULT CLevel_BloomViewer::Ready_Layer_UI(const _wstring& strLayerTag) +{ + return S_OK; +} + + +HRESULT CLevel_BloomViewer::Ready_Layer_Effect(const _wstring& strLayerTag) +{ + + return S_OK; +} + + + +CLevel_BloomViewer* CLevel_BloomViewer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) +{ + CLevel_BloomViewer* pInstance = new CLevel_BloomViewer(pDevice, pContext, eLevelID); + + if (FAILED(pInstance->Initialize())) + { + MSG_BOX("Failed to Created : CLevel_BloomViewer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + + + +void CLevel_BloomViewer::Free() +{ + __super::Free(); + + +} diff --git a/Jusin154_Team3D/Editor/Private/Level_Loading.cpp b/Jusin154_Team3D/Editor/Private/Level_Loading.cpp index f8f1dca2e..9ef8407d7 100644 --- a/Jusin154_Team3D/Editor/Private/Level_Loading.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_Loading.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "Level_Loading.h" #include "Loader.h" #include "GameInstance.h" @@ -8,6 +8,7 @@ #include "Level_ObjectViewer.h" #include "Level_EffectViewer.h" #include "Level_MapViewer.h" +#include "Level_BloomViewer.h" #include "Level_PhysXLab.h" @@ -62,9 +63,9 @@ void CLevel_Loading::Update(_float fTimeDelta) case LEVEL::PHYSX: pNewLevel = CLevel_PhysXLab::Create(m_pDevice, m_pContext, m_eNextLevelID); break; - //case LEVEL::PARTICLE: - // pNewLevel = CLevel_ParticleViewer::Create(m_pDevice, m_pContext, m_eNextLevelID); - // break; + case LEVEL::BLOOM: + pNewLevel = CLevel_BloomViewer::Create(m_pDevice, m_pContext, m_eNextLevelID); + break; } if (FAILED(m_pGameInstance->Change_Level(pNewLevel))) diff --git a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp index 7b3736fd5..2621663c9 100644 --- a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "Level_Logo.h" #include "GameInstance.h" #include "Level_Loading.h" @@ -42,10 +42,10 @@ void CLevel_Logo::Update(_float fTimeDelta) if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::PHYSX)))) return; } - //else if (GUI::Button("Particle Editor", { 100, 100 })) { - // if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::PARTICLE)))) - // return; - //} + else if (GUI::SameLine(), GUI::Button("Bloom Editor", { 100, 100 })) { + if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::BLOOM)))) + return; + } else if (GUI::Button("UI Editor", { 100, 100 })) { if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::UI)))) return; @@ -55,7 +55,7 @@ void CLevel_Logo::Update(_float fTimeDelta) HRESULT CLevel_Logo::Render() { - SetWindowText(g_hWnd, TEXT("·ΰí·¹º§ÀԴϴÙ")); + SetWindowText(g_hWnd, TEXT("로고레벨입니다")); GUI::ShowDemoWindow(); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 3003534f5..a46728b7d 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -21,7 +21,6 @@ #include "DummySkyBox.h" #include "DummyObject.h" #include "Player.h" -#include #pragma endregion @@ -91,6 +90,12 @@ #pragma endregion +#pragma region BLOOM_HEADER + +#include "Dummy_Globe.h" + +#pragma endregion + CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : m_pDevice{ pDevice } , m_pContext{ pContext } @@ -120,8 +125,9 @@ HRESULT CLoader::Initialize(LEVEL eNextLevelID) InitializeCriticalSection(&m_CriticalSection); m_hThread = (HANDLE)_beginthreadex(nullptr, 0, LoadingMain, this, 0, nullptr); - if (0 == m_hThread) + if (0 == m_hThread){ return E_FAIL; + } return S_OK; } @@ -160,9 +166,9 @@ HRESULT CLoader::Loading() case LEVEL::PHYSX: hr = Loading_For_PhysXLevel(); break; - //case LEVEL::PARTICLE: - // hr = Loading_For_Particle(); - // break; + case LEVEL::BLOOM: + hr = Loading_For_Bloom(); + break; default: assert(false); break; @@ -869,6 +875,43 @@ HRESULT CLoader::Loading_For_PhysXLevel() return S_OK; } +HRESULT CLoader::Loading_For_Bloom() +{ + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Desc_Box"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixScaling(10.f, 10.f, 10.f) * XMMatrixIdentity())))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Model_DummyPlane"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx", XMMatrixTranslation(0.f, -10.f, 0.f) * XMMatrixIdentity())))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Desc_Globe"), + CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Globe::Create(m_pDevice, m_pContext)))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Cube::Create(m_pDevice, m_pContext)))){ + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Plane::Create(m_pDevice, m_pContext)))){ + return E_FAIL; + } + + m_strMessage = TEXT("Loading Success!"); + + m_isFinished = true; + + return S_OK; +} + HRESULT CLoader::Asset_FileLoad(const _char* pDirectoryPath, const _tchar* pPreName, function AddPrototypeEvent) { for (const auto& file : filesystem::directory_iterator(pDirectoryPath)) diff --git a/Jusin154_Team3D/Editor/Public/Dummy_Globe.h b/Jusin154_Team3D/Editor/Public/Dummy_Globe.h new file mode 100644 index 000000000..fec2a6743 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Dummy_Globe.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Editor_Define.h" +#include "GameObject.h" + +NS_BEGIN(Engine) +class CModel; +class CShader; +NS_END + +NS_BEGIN(Editor) + +class CDummy_Globe final : public CGameObject +{ +private: + CDummy_Globe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDummy_Globe(const CDummy_Globe& rhs); + virtual ~CDummy_Globe() = 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: + CModel* m_pModelCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + _bool m_bMRO = { false }; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Bind_ShaderResources() override; + +public: + static CDummy_Globe* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index bfb365bca..8c4247415 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -13,13 +13,13 @@ namespace Editor const unsigned int g_iWinSizeX = 1920; const unsigned int g_iWinSizeY = 1080; - enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, END }; + enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, BLOOM, END }; enum class COLLIDABLEOBJECT { PLAYER, MONSTER, HOSTILE_HITBOX, ALLY_HITBOX, NEUTRAL_HITBOX, ENVIRIONMENT, NPC, ITEM, TRIGGERBOX, REGION, NOCOLLIDE, END }; enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT }; enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, END }; enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, 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, 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, PROP, NOMROPROP, END }; enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, END }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END }; diff --git a/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h b/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h new file mode 100644 index 000000000..028c7e1a8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h @@ -0,0 +1,31 @@ +#pragma once + +#include "Editor_Define.h" +#include "Level.h" + +NS_BEGIN(Editor) + +class CLevel_BloomViewer final : public CLevel +{ +private: + CLevel_BloomViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID); + virtual ~CLevel_BloomViewer() = default; + +public: + virtual void Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +private: + /* 이 레벨에서 쓰기위한 객체들을 생성한다. */ + virtual HRESULT Initialize() override; + HRESULT Ready_Layer_Camera(const _wstring& strLayerTag); + HRESULT Ready_Layer_Light(); + HRESULT Ready_Layer_UI(const _wstring& strLayerTag); + HRESULT Ready_Layer_Effect(const _wstring& strLayerTag); + +public: + static CLevel_BloomViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID); + virtual void Free() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Loader.h b/Jusin154_Team3D/Editor/Public/Loader.h index 62caaffda..de7392328 100644 --- a/Jusin154_Team3D/Editor/Public/Loader.h +++ b/Jusin154_Team3D/Editor/Public/Loader.h @@ -48,6 +48,7 @@ class CLoader final : public CBase HRESULT Loading_For_UI(); HRESULT Loading_For_Effect(); HRESULT Loading_For_PhysXLevel(); + HRESULT Loading_For_Bloom(); private: HRESULT Asset_FileLoad(const _char* pDirectoryPath, const _tchar* pPreName, function AddPrototypeEvent); diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 38eea62d7..285ef01bc 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -336,6 +336,107 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In) return Out; } +PS_OUT_BACKBUFFER PS_MAIN_MROCOMBINED(PS_IN In) +{ + PS_OUT_BACKBUFFER Out; + + vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + + if (0.f == vDiffuse.a) + { + discard; + } + + vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord); + + vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord); + + Out.vBackBuffer = vDiffuse * vShade + vSpecular; + + vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + + + float fViewZ = vDepthDesc.y * g_fFar; + + + vector vPosition, vPreShadowPosition; + + /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */ + vPosition.x = In.vTexcoord.x * 2.f - 1.f; + vPosition.y = In.vTexcoord.y * -2.f + 1.f; + vPosition.z = vDepthDesc.x; + vPosition.w = 1.f; + + vPosition = vPosition * fViewZ; + + vPosition = mul(vPosition, g_invmatProj); + vPosition = mul(vPosition, g_invMatView); + vPreShadowPosition = vPosition; + /* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */ + vPosition = mul(vPosition, g_LightViewMatrix); + vPosition = mul(vPosition, g_LightProjMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightViewMatrix); + vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix); + + /* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */ + float2 vTexcoord, vPreShadowTexcoord; + vTexcoord.x = (vPosition.x / vPosition.w) * 0.5f + 0.5f; + vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f; + vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f; + vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f; + + /* 광원의 NDC에서 샘플링 */ + float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f); + + Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static)); + //float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x; + //float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x; + //bool IsShadow = { false }; + //if (vPosition.z - 0.0005f > fShadowDepth) + //{ + // IsShadow = true; + //} + //if (vPreShadowPosition.z - 0.0005f > fPreShadowDepth) + //{ + // IsShadow = true; + //} + //if (true == IsShadow) + //{ + // Out.vBackBuffer *= 0.5f; + //} + float4 vColor = 0.f; + + //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f; + + //int iBlurMin; + //int iBlurMax; + + //if (iBlurWeight % 2 == 0) + //{ + // iBlurMin = -1 * iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2; + //} + //else + //{ + // iBlurMin = -iBlurWeight / 2; + // iBlurMax = iBlurWeight / 2 + 1; + //} + + //[loop] // 변수로 루프돌리려면 반드시 필요함 + for (int i = -15; i < 16; ++i) + { + vTexcoord.x = In.vTexcoord.x; + vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y; + + vColor += g_fWeights[i + 15] * g_BlurXTexture.Sample(ClampSampler, vTexcoord); + } + + Out.vBackBuffer += vColor; + + return Out; +} + struct PS_OUT_BLUR_X { float4 vBlurX : SV_TARGET0; @@ -444,4 +545,13 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MAIN_SPOT(); } + pass MROCombinedPass + { + 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_MROCOMBINED(); + } } diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 67b8586bf..2a314d2fa 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -278,7 +278,7 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType eTexture = aiTextureType::aiTextureType_SPECULAR; else if (!strcmp(FileType.c_str(), "HRO")) eTexture = aiTextureType::aiTextureType_SPECULAR; - else if (!strcmp(FileType.c_str(), "SROH")) + else if (!strcmp(FileType.c_str(), "SROH")) eTexture = aiTextureType::aiTextureType_SPECULAR; else if (!strcmp(FileType.c_str(), "SROA")) eTexture = aiTextureType::aiTextureType_SPECULAR;