[add] MB 기반 추가 전
This commit is contained in:
@@ -228,6 +228,24 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv)
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
// BackGround ForeGround 합은 1
|
||||
float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale)
|
||||
{
|
||||
return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth));
|
||||
}
|
||||
|
||||
float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale)
|
||||
{
|
||||
return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f);
|
||||
}
|
||||
|
||||
float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale)
|
||||
{
|
||||
float2 vDepthCompare = DepthCompare(fCenterDepth, fSampleDepth, fDepthScale);
|
||||
float2 vSpreadCompare = SpreadCompare(fOffsetLength, float2(fCenterSpreadLength, fSampleSpreadLength), fPixelToSampleUnitsScale);
|
||||
return dot(vDepthCompare, vSpreadCompare);
|
||||
}
|
||||
|
||||
float4x4 RotateX(float fAngle)
|
||||
{
|
||||
float fCos = cos(radians(fAngle));
|
||||
|
||||
@@ -5,6 +5,7 @@ matrix g_LightViewMatrix_NEAR, g_LightProjMatrix_NEAR;
|
||||
matrix g_LightViewMatrix_MIDDLE, g_LightProjMatrix_MIDDLE;
|
||||
matrix g_LightViewMatrix_FAR, g_LightProjMatrix_FAR;
|
||||
matrix g_PreShadowLightViewMatrix, g_PreShadowLightProjMatrix;
|
||||
matrix g_MotionBlurPreWorldMatrix, g_MotionBlurPreViewMatrix, g_MotionBlurPreProjMatrix;
|
||||
|
||||
float4 g_SamplePos[64];
|
||||
float g_fFar;
|
||||
@@ -137,6 +138,66 @@ struct VS_OUT
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
struct VS_IN_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
};
|
||||
struct VS_OUT_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
float4 vDirection : TEXCOORD2;
|
||||
};
|
||||
struct PS_IN_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
float4 vDirection : TEXCOORD2;
|
||||
};
|
||||
struct PS_OUT_VELOCITYBLUR
|
||||
{
|
||||
float4 vColor : SV_TARGET0;
|
||||
};
|
||||
VS_OUT_VELOCITYBLUR VS_MOTIONBLUR(VS_IN_VELOCITYBLUR In)
|
||||
{
|
||||
VS_OUT_VELOCITYBLUR Out;
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(float4(In.vPosition.xyz, 1.f), matWVP);
|
||||
Out.vNormal = normalize(mul(float4(In.vNormal.xyz, 0.f), matWVP));
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
|
||||
float4 vNewPos = Out.vPosition;
|
||||
float4 vOldPos = mul(float4(In.vPosition.xyz, 1.f), g_MotionBlurPreWorldMatrix);
|
||||
vOldPos = mul(vOldPos, g_MotionBlurPreViewMatrix);
|
||||
vOldPos = mul(vOldPos, g_MotionBlurPreProjMatrix);
|
||||
|
||||
float3 vDir = vNewPos.xyz - vOldPos.xyz;
|
||||
|
||||
float fDota = dot(normalize(vDir), normalize(Out.vNormal.xyz));
|
||||
if (fDota < 0.f) { //
|
||||
Out.vPosition = vOldPos;
|
||||
}
|
||||
else {
|
||||
Out.vPosition = vNewPos;
|
||||
}
|
||||
|
||||
float2 vVelocity = (vNewPos.xy / vNewPos.w) - (vOldPos.xy / vOldPos.w);
|
||||
Out.vDirection.xy = vVelocity * 0.5f;
|
||||
Out.vDirection.y *= -1.f; // 투영좌표계 -> 스크린좌표계
|
||||
Out.vDirection.z = Out.vPosition.z;
|
||||
Out.vDirection.w = Out.vPosition.w;
|
||||
|
||||
return Out;
|
||||
}
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
@@ -213,6 +274,14 @@ struct PS_OUT_SSAO_BLUR
|
||||
{
|
||||
float fBlur : SV_TARGET0;
|
||||
};
|
||||
PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN_VELOCITYBLUR In)
|
||||
{
|
||||
PS_OUT_VELOCITYBLUR Out;
|
||||
Out.vColor.xy = In.vDirection.xy;
|
||||
Out.vColor.z = 1.f;
|
||||
Out.vColor.w = (In.vDirection.z / In.vDirection.w);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
{
|
||||
PS_OUT_LIGHT Out;
|
||||
@@ -1361,4 +1430,14 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_SSAO_BLUR();
|
||||
}
|
||||
|
||||
pass VelocityMapPass // 18
|
||||
{
|
||||
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_MOTIONBLUR();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MOTIONBLUR();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +228,24 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv)
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
// BackGround ForeGround 합은 1
|
||||
float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale)
|
||||
{
|
||||
return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth));
|
||||
}
|
||||
|
||||
float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale)
|
||||
{
|
||||
return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f);
|
||||
}
|
||||
|
||||
float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale)
|
||||
{
|
||||
float2 vDepthCompare = DepthCompare(fCenterDepth, fSampleDepth, fDepthScale);
|
||||
float2 vSpreadCompare = SpreadCompare(fOffsetLength, float2(fCenterSpreadLength, fSampleSpreadLength), fPixelToSampleUnitsScale);
|
||||
return dot(vDepthCompare, vSpreadCompare);
|
||||
}
|
||||
|
||||
float4x4 RotateX(float fAngle)
|
||||
{
|
||||
float fCos = cos(radians(fAngle));
|
||||
|
||||
@@ -5,6 +5,7 @@ matrix g_LightViewMatrix_NEAR, g_LightProjMatrix_NEAR;
|
||||
matrix g_LightViewMatrix_MIDDLE, g_LightProjMatrix_MIDDLE;
|
||||
matrix g_LightViewMatrix_FAR, g_LightProjMatrix_FAR;
|
||||
matrix g_PreShadowLightViewMatrix, g_PreShadowLightProjMatrix;
|
||||
matrix g_MotionBlurPreWorldMatrix, g_MotionBlurPreViewMatrix, g_MotionBlurPreProjMatrix;
|
||||
|
||||
float4 g_SamplePos[64];
|
||||
float g_fFar;
|
||||
@@ -137,6 +138,66 @@ struct VS_OUT
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
struct VS_IN_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
};
|
||||
struct VS_OUT_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
float4 vDirection : TEXCOORD2;
|
||||
};
|
||||
struct PS_IN_VELOCITYBLUR
|
||||
{
|
||||
float4 vPosition : POSITION;
|
||||
float4 vNormal : NORMAL;
|
||||
float2 vTexcoord : TEXCOORD1;
|
||||
float4 vDirection : TEXCOORD2;
|
||||
};
|
||||
struct PS_OUT_VELOCITYBLUR
|
||||
{
|
||||
float4 vColor : SV_TARGET0;
|
||||
};
|
||||
VS_OUT_VELOCITYBLUR VS_MOTIONBLUR(VS_IN_VELOCITYBLUR In)
|
||||
{
|
||||
VS_OUT_VELOCITYBLUR Out;
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(float4(In.vPosition.xyz, 1.f), matWVP);
|
||||
Out.vNormal = normalize(mul(float4(In.vNormal.xyz, 0.f), matWVP));
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
|
||||
float4 vNewPos = Out.vPosition;
|
||||
float4 vOldPos = mul(float4(In.vPosition.xyz, 1.f), g_MotionBlurPreWorldMatrix);
|
||||
vOldPos = mul(vOldPos, g_MotionBlurPreViewMatrix);
|
||||
vOldPos = mul(vOldPos, g_MotionBlurPreProjMatrix);
|
||||
|
||||
float3 vDir = vNewPos.xyz - vOldPos.xyz;
|
||||
|
||||
float fDota = dot(normalize(vDir), normalize(Out.vNormal.xyz));
|
||||
if (fDota < 0.f) { //
|
||||
Out.vPosition = vOldPos;
|
||||
}
|
||||
else {
|
||||
Out.vPosition = vNewPos;
|
||||
}
|
||||
|
||||
float2 vVelocity = (vNewPos.xy / vNewPos.w) - (vOldPos.xy / vOldPos.w);
|
||||
Out.vDirection.xy = vVelocity * 0.5f;
|
||||
Out.vDirection.y *= -1.f; // 투영좌표계 -> 스크린좌표계
|
||||
Out.vDirection.z = Out.vPosition.z;
|
||||
Out.vDirection.w = Out.vPosition.w;
|
||||
|
||||
return Out;
|
||||
}
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
@@ -213,6 +274,14 @@ struct PS_OUT_SSAO_BLUR
|
||||
{
|
||||
float fBlur : SV_TARGET0;
|
||||
};
|
||||
PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN_VELOCITYBLUR In)
|
||||
{
|
||||
PS_OUT_VELOCITYBLUR Out;
|
||||
Out.vColor.xy = In.vDirection.xy;
|
||||
Out.vColor.z = 1.f;
|
||||
Out.vColor.w = (In.vDirection.z / In.vDirection.w);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
{
|
||||
PS_OUT_LIGHT Out;
|
||||
@@ -1361,4 +1430,14 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_SSAO_BLUR();
|
||||
}
|
||||
|
||||
pass VelocityMapPass // 18
|
||||
{
|
||||
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_MOTIONBLUR();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MOTIONBLUR();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ void CGameInstance::Compute_FrameCount()
|
||||
m_fTimer_Render_NonLight = Get_TimeDelta(TEXT("Timer_Render_NonLight"));
|
||||
m_fTimer_Render_Blend = Get_TimeDelta(TEXT("Timer_Render_Blend"));
|
||||
m_fTimer_Render_WeightBlend = Get_TimeDelta(TEXT("Timer_Render_WeightBlend"));
|
||||
m_fTimer_Render_Bloom = Get_TimeDelta(TEXT("Timer_Render_Bloom"));
|
||||
m_fTimer_Render_PostProcessing = Get_TimeDelta(TEXT("Timer_Render_PostProcessing"));
|
||||
m_fTimer_Render_LastColor = Get_TimeDelta(TEXT("Timer_Render_LastColor"));
|
||||
m_fTimer_Render_Tone_Mapping = Get_TimeDelta(TEXT("Timer_Render_Tone_Mapping"));
|
||||
m_fTimer_Render_UI = Get_TimeDelta(TEXT("Timer_Render_UI"));
|
||||
@@ -443,7 +443,7 @@ void CGameInstance::Present_TimeCost() const
|
||||
+ m_fTimer_Render_NonLight
|
||||
+ m_fTimer_Render_Blend
|
||||
+ m_fTimer_Render_WeightBlend
|
||||
+ m_fTimer_Render_Bloom
|
||||
+ m_fTimer_Render_PostProcessing
|
||||
+ m_fTimer_Render_LastColor
|
||||
+ m_fTimer_Render_Tone_Mapping
|
||||
+ m_fTimer_Render_UI
|
||||
@@ -524,9 +524,9 @@ void CGameInstance::Present_TimeCost() const
|
||||
GUI::Text("Render_WeightBlend %d", int(m_fTimer_Render_WeightBlend / fRenderer_Total * 100.f));
|
||||
}
|
||||
{
|
||||
GUI::ProgressBar(m_fTimer_Render_Bloom / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
GUI::ProgressBar(m_fTimer_Render_PostProcessing / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x);
|
||||
GUI::Text("Render_Bloom %d", int(m_fTimer_Render_Bloom / fRenderer_Total * 100.f));
|
||||
GUI::Text("Render_PostProcessing %d", int(m_fTimer_Render_PostProcessing / fRenderer_Total * 100.f));
|
||||
}
|
||||
{
|
||||
GUI::ProgressBar(m_fTimer_Render_LastColor / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
|
||||
@@ -30,12 +30,15 @@ void CRenderer::Render()
|
||||
Render_NonLight();
|
||||
Render_Blend();
|
||||
Render_WeightBlend();
|
||||
Render_Bloom();
|
||||
Render_PostProcessing();
|
||||
Render_LastColor();
|
||||
Render_Tone_Mapping();
|
||||
Render_UI();
|
||||
Render_UI_Overley();
|
||||
|
||||
memcpy_s(&m_MotionBlurPreViewMatrix, sizeof(_float4x4), &m_ScreenViewMatrix, sizeof(_float4x4));
|
||||
memcpy_s(&m_MotionBlurPreProjMatrix, sizeof(_float4x4), &m_ScreenProjMatrix, sizeof(_float4x4));
|
||||
|
||||
#ifdef _DEBUG
|
||||
static _bool m_bToggleDebug = false;
|
||||
Describe_Entitiy();
|
||||
@@ -318,9 +321,9 @@ void CRenderer::Render_LightAcc()
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
m_pShader->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4));
|
||||
@@ -363,9 +366,9 @@ void CRenderer::Render_Combined()
|
||||
{
|
||||
// Bind_Resorces
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
|
||||
@@ -457,9 +460,9 @@ void CRenderer::Render_EnvironmentPostProcess()
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
@@ -488,9 +491,9 @@ void CRenderer::Render_EnvironmentPostProcess()
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
@@ -574,9 +577,9 @@ void CRenderer::Render_WeightBlend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_WeightBlend");
|
||||
// Bind_Resorces
|
||||
|
||||
m_pWeightBlendShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_WB_Color"), m_pWeightBlendShader, "g_MixedDiffuseTexture"))) {
|
||||
@@ -636,9 +639,9 @@ void CRenderer::Render_Blur()
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Blur"), m_pShader, "g_BlurTexture"))) {
|
||||
return;
|
||||
@@ -762,9 +765,9 @@ void CRenderer::Render_SSAO_BLUR()
|
||||
}
|
||||
{
|
||||
// Bind_Resorces
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return;
|
||||
}
|
||||
@@ -805,20 +808,11 @@ void CRenderer::Render_Blend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Blend");
|
||||
}
|
||||
|
||||
void CRenderer::Render_Bloom()
|
||||
void CRenderer::Render_PostProcessing()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Bloom");
|
||||
// "Target_Bloom_Input"
|
||||
// "Target_Bloom"
|
||||
// "Target_Bloom_2x2"
|
||||
// "Target_Bloom_4x4"
|
||||
// "Target_Bloom_8x8"
|
||||
// "Target_Bloom_2x2_1"
|
||||
// "Target_Bloom_4x4_1"
|
||||
// "Target_Bloom_8x8_1"
|
||||
// "Target_Bloom_8x8_X"
|
||||
// "Target_Bloom_4x4_2"
|
||||
// "Target_Bloom_2x2_2"
|
||||
/* POSTPROCESSING */
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_PostProcessing");
|
||||
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Bloom")))) {
|
||||
return;
|
||||
@@ -839,6 +833,19 @@ void CRenderer::Render_Bloom()
|
||||
return;
|
||||
}
|
||||
|
||||
// "Target_Bloom_Input"
|
||||
// "Target_Bloom"
|
||||
// "Target_Bloom_2x2"
|
||||
// "Target_Bloom_4x4"
|
||||
// "Target_Bloom_8x8"
|
||||
// "Target_Bloom_2x2_1"
|
||||
// "Target_Bloom_4x4_1"
|
||||
// "Target_Bloom_8x8_1"
|
||||
// "Target_Bloom_8x8_X"
|
||||
// "Target_Bloom_4x4_2"
|
||||
// "Target_Bloom_2x2_2"
|
||||
|
||||
|
||||
m_pShader->Bind_RawValue("g_fBloomThreshold", &m_fBloomThreshold, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_iBloomEmbossingPass", &m_iBloomEmbossingPass, sizeof(_int));
|
||||
|
||||
@@ -866,7 +873,7 @@ void CRenderer::Render_Bloom()
|
||||
m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::UPSAMPLE);
|
||||
m_pGameInstance->Finish_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_Input"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::BLOOM_FINISH); // 9
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Bloom");
|
||||
COMPUTE_TIMEDELTA("Timer_Render_PostProcessing");
|
||||
}
|
||||
|
||||
void CRenderer::Render_UI()
|
||||
@@ -920,9 +927,9 @@ void CRenderer::Render_LastColor()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_LastColor");
|
||||
// Bind_Resorces
|
||||
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Color"), m_pLastColorShader, "g_ColorTexture"))) {
|
||||
return;
|
||||
@@ -945,9 +952,9 @@ void CRenderer::Render_Tone_Mapping()
|
||||
SAFE_RELEASE(pBackBuffer);
|
||||
}
|
||||
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_iToneMappingType", &m_iToneMappingType, sizeof(_uint)))) {
|
||||
assert(false);
|
||||
@@ -985,10 +992,10 @@ void CRenderer::Render_Debug()
|
||||
SAFE_RELEASE(pDebugCom);
|
||||
} m_DebugComponents.clear();
|
||||
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
|
||||
@@ -337,6 +337,19 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_VelocityMap */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_VelocityMap"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM, _float4(0.0f, 0.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_BeforeNormal"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM, _float4(0.0f, 0.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_BeforeDepth"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 1.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(g_iMaxShadowWidth, g_iMaxShadowHeight))) {
|
||||
return E_FAIL;
|
||||
@@ -445,9 +458,10 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
//if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
/* MRT_VELOCITY_MAP */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_VELOCITY_MAP"), TEXT("Target_VelocityMap")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_Fog */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_Fog")))) {
|
||||
@@ -481,9 +495,9 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
XMStoreFloat4x4(&m_WorldMatrix, XMMatrixScaling(Viewport.Width, Viewport.Height, 1.f));
|
||||
XMStoreFloat4x4(&m_ViewMatrix, XMMatrixIdentity());
|
||||
XMStoreFloat4x4(&m_ProjMatrix, XMMatrixOrthographicLH(Viewport.Width, Viewport.Height, 0.f, 1.f));
|
||||
XMStoreFloat4x4(&m_ScreenWorldMatrix, XMMatrixScaling(Viewport.Width, Viewport.Height, 1.f));
|
||||
XMStoreFloat4x4(&m_ScreenViewMatrix, XMMatrixIdentity());
|
||||
XMStoreFloat4x4(&m_ScreenProjMatrix, XMMatrixOrthographicLH(Viewport.Width, Viewport.Height, 0.f, 1.f));
|
||||
|
||||
Fill_Geometry(SSAO_SAMPLE_NUMBER);
|
||||
|
||||
@@ -522,7 +536,6 @@ void CRenderer::Free()
|
||||
RenderObjects.clear();
|
||||
}
|
||||
|
||||
SAFE_RELEASE(m_pGlobalStaticCB);
|
||||
SAFE_RELEASE(m_pSSAO_NoiseTexture);
|
||||
SAFE_RELEASE(m_pSSAO_NoiseSRV);
|
||||
SAFE_RELEASE(m_pPreShadowDSV);
|
||||
|
||||
@@ -92,7 +92,7 @@ HRESULT CTimer_Manager::Initialize()
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_WeightBlend")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_Bloom")))) {
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_PostProcessing")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_LastColor")))) {
|
||||
|
||||
@@ -262,6 +262,7 @@ void CTransform::RewindMomentum()
|
||||
{
|
||||
m_vMomentum = m_vBackMomentum;
|
||||
m_vBackMomentum = { 0.f, 0.f, 0.f };
|
||||
m_PrevMatrix = m_WorldMatrix;
|
||||
}
|
||||
|
||||
void CTransform::BookMomentum(_fvector vMomentum)
|
||||
|
||||
@@ -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,
|
||||
POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, VELOCITYMAP,
|
||||
END };
|
||||
|
||||
enum class QUESTTYPE {MAIN, SUB, END};
|
||||
|
||||
@@ -335,7 +335,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
_float m_fTimer_Render_NonLight = { 0.f };
|
||||
_float m_fTimer_Render_Blend = { 0.f };
|
||||
_float m_fTimer_Render_WeightBlend = { 0.f };
|
||||
_float m_fTimer_Render_Bloom = { 0.f };
|
||||
_float m_fTimer_Render_PostProcessing = { 0.f };
|
||||
_float m_fTimer_Render_LastColor = { 0.f };
|
||||
_float m_fTimer_Render_Tone_Mapping = { 0.f };
|
||||
_float m_fTimer_Render_UI = { 0.f };
|
||||
|
||||
@@ -22,6 +22,7 @@ class CRenderTarget_Manager final : public CBase
|
||||
HRESULT Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag);
|
||||
|
||||
|
||||
// 두 랜더타겟을 하나로 모음
|
||||
HRESULT Accumulate_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB, const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass);
|
||||
// 랜더 타겟의 크기를 dest로 다시 맞춤
|
||||
|
||||
@@ -13,7 +13,7 @@ class CRenderer final : public CBase
|
||||
public:
|
||||
void Render();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -37,9 +37,9 @@ class CRenderer final : public CBase
|
||||
class CVIBuffer_Rect* m_pVIBuffer = { nullptr };
|
||||
|
||||
private:
|
||||
_float4x4 m_WorldMatrix = {};
|
||||
_float4x4 m_ViewMatrix = {};
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
_float4x4 m_ScreenWorldMatrix = {};
|
||||
_float4x4 m_ScreenViewMatrix = {};
|
||||
_float4x4 m_ScreenProjMatrix = {};
|
||||
|
||||
ID3D11DepthStencilView* m_pShadowDSV_NEAR = { nullptr };
|
||||
ID3D11DepthStencilView* m_pShadowDSV_MIDDLE = { nullptr };
|
||||
@@ -47,11 +47,16 @@ class CRenderer final : public CBase
|
||||
ID3D11DepthStencilView* m_pPreShadowDSV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pSSAO_NoiseSRV = { nullptr };
|
||||
ID3D11Texture2D* m_pSSAO_NoiseTexture = { nullptr };
|
||||
ID3D11Buffer* m_pGlobalStaticCB = { nullptr };
|
||||
|
||||
_float4x4 m_MotionBlurPreViewMatrix = {};
|
||||
_float4x4 m_MotionBlurPreProjMatrix = {};
|
||||
|
||||
_float4x4 m_PreShadowView = {};
|
||||
_float4x4 m_PreShadowProj = {};
|
||||
|
||||
|
||||
|
||||
#pragma region TunningParameters
|
||||
/* TunningParam */
|
||||
_int m_iToneMappingType = { 2 };
|
||||
_float m_fExposure = { 0.7f };
|
||||
@@ -74,6 +79,8 @@ class CRenderer final : public CBase
|
||||
|
||||
SSAO_GEOMETRY_HEMISPHERE m_tagSSAOGeometry = {};
|
||||
SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL m_tagSSAOGeometryDirections = {};
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
void Render_Occlusion();
|
||||
void Render_Priority();
|
||||
@@ -90,7 +97,7 @@ class CRenderer final : public CBase
|
||||
void Render_WeightBlend();
|
||||
void Render_NonLight();
|
||||
void Render_Blend();
|
||||
void Render_Bloom();
|
||||
void Render_PostProcessing();
|
||||
void Render_LastColor();
|
||||
void Render_Tone_Mapping();
|
||||
void Render_UI();
|
||||
@@ -103,7 +110,7 @@ class CRenderer final : public CBase
|
||||
#endif
|
||||
|
||||
private:
|
||||
void Fill_Geometry(_uint iNumSample);
|
||||
void Fill_Geometry(_uint iNumSample);
|
||||
HRESULT Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
|
||||
private:
|
||||
|
||||
@@ -33,7 +33,7 @@ class ENGINE_DLL CTransform final :
|
||||
_float3 Get_Scale() const;
|
||||
_vector Get_QuarternionVector() const; // 현재 회전정보를 담고 있는 쿼터니언 벡터를 out
|
||||
_vector Get_RollPitchYawVector() const;
|
||||
_vector Get_State(STATE eState) const {
|
||||
_vector Get_State(STATE eState) const {
|
||||
return XMLoadFloat4(reinterpret_cast<const _float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]));
|
||||
}
|
||||
const _float4* Get_StatePtr(STATE eState) { return reinterpret_cast<_float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]); }
|
||||
@@ -83,6 +83,7 @@ class ENGINE_DLL CTransform final :
|
||||
_float m_fSpeedPerSec = {};
|
||||
_float m_fRotationPerSec = {};
|
||||
_float4x4 m_WorldMatrix = {};
|
||||
_float4x4 m_PrevMatrix = {};
|
||||
_float m_fRadius = { 20.f };
|
||||
|
||||
_float3 m_vMomentum = {}; // 현재 프레임에 계산된 이동량
|
||||
|
||||
Reference in New Issue
Block a user