[add] 그림자 작게 나눔
This commit is contained in:
@@ -258,7 +258,7 @@ HRESULT CLevel_GamePlay::Ready_Background()
|
||||
isReady_Background = false;
|
||||
#endif //
|
||||
#ifdef 기무리
|
||||
isReady_Background = false;
|
||||
isReady_Background = true;
|
||||
#endif //
|
||||
#ifdef 인혁
|
||||
isReady_Background = true;
|
||||
|
||||
@@ -335,7 +335,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
isLoad_Background = false;
|
||||
#endif //
|
||||
#ifdef 기무리
|
||||
isLoad_Background = false;
|
||||
isLoad_Background = true;
|
||||
#endif //
|
||||
#ifdef 인혁
|
||||
isLoad_Background = true;
|
||||
|
||||
@@ -411,6 +411,15 @@ HRESULT CRanrak::Bind_ShaderResources()
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_PrevWorldMatrix", m_pTransformCom->Get_PrevWorldMatrixPtr()))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevViewMatrix", D3DTS::VIEW))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_PrevMatrix(m_pShaderCom, "g_PrevProjMatrix", D3DTS::PROJ))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -14,8 +14,10 @@ float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
uint g_iMaxShadowHeight;
|
||||
float2 g_vNearShadowResolution;
|
||||
float2 g_vMiddleShadowResolution;
|
||||
float2 g_vFarShadowResolution;
|
||||
float2 g_vPreShadowResolution;
|
||||
float2 g_vResolution;
|
||||
float2 g_vSrcResolution;
|
||||
float4 g_vShadowBias;
|
||||
@@ -61,7 +63,6 @@ Texture2D g_DepthTexture;
|
||||
Texture2D g_SpecularTexture;
|
||||
Texture2D g_ShadowNearTexture;
|
||||
Texture2D g_ShadowMiddleTexture;
|
||||
Texture2D g_ShadowFarTexture;
|
||||
Texture2D g_PreShadowTexture;
|
||||
Texture2D g_BlurTexture;
|
||||
Texture2D g_BlurXTexture;
|
||||
@@ -804,10 +805,9 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix);
|
||||
}
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, g_vNearShadowResolution, g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, g_vMiddleShadowResolution, g_vShadowBias.y);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, g_vPreShadowResolution, g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
// 케스케이드
|
||||
@@ -824,9 +824,6 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
@@ -1234,30 +1231,34 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
float4 vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (true == g_bFogVisible)
|
||||
{
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fOriginalAlpha = vColor.a;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float4 vFinalColor;
|
||||
float fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
vFinalColor.a = 1.f; // fOriginalAlpha;
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
}
|
||||
else
|
||||
if (0.f == g_fFogPow)
|
||||
{
|
||||
vColor.a = 1.f;
|
||||
Out.vFirstTarget = vColor;
|
||||
if (1 == vDepthDesc.y)
|
||||
Out.vFirstTarget = float4(vColor.rgb, 0.f);
|
||||
else
|
||||
Out.vFirstTarget = float4(vColor.rgb, 1.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
vector vFinalColor;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fRatio;
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_BACKBUFFER PS_TONE_MAPPING(PS_IN In)
|
||||
@@ -1462,7 +1463,7 @@ technique11 DefaultTechnique
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_None, 0);
|
||||
SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_CAPTURE();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_EMBOSS();
|
||||
|
||||
@@ -14,8 +14,10 @@ float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
uint g_iMaxShadowHeight;
|
||||
float2 g_vNearShadowResolution;
|
||||
float2 g_vMiddleShadowResolution;
|
||||
float2 g_vFarShadowResolution;
|
||||
float2 g_vPreShadowResolution;
|
||||
float2 g_vResolution;
|
||||
float2 g_vSrcResolution;
|
||||
float4 g_vShadowBias;
|
||||
@@ -61,7 +63,6 @@ Texture2D g_DepthTexture;
|
||||
Texture2D g_SpecularTexture;
|
||||
Texture2D g_ShadowNearTexture;
|
||||
Texture2D g_ShadowMiddleTexture;
|
||||
Texture2D g_ShadowFarTexture;
|
||||
Texture2D g_PreShadowTexture;
|
||||
Texture2D g_BlurTexture;
|
||||
Texture2D g_BlurXTexture;
|
||||
@@ -804,10 +805,9 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix);
|
||||
}
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, g_vNearShadowResolution, g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, g_vMiddleShadowResolution, g_vShadowBias.y);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, g_vPreShadowResolution, g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
// 케스케이드
|
||||
@@ -824,9 +824,6 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
|
||||
@@ -312,7 +312,27 @@ void CPipeLine::Make_LightBoxes()
|
||||
fMinZ += m_vShadowBoxMarginMin.z;
|
||||
fMaxZ += m_vShadowBoxMarginMax.z;
|
||||
|
||||
Adjust_ShadowTexcel(fMinX, fMinY, fMaxX, fMaxY, g_iMaxShadowWidth, g_iMaxShadowHeight);
|
||||
_uint iShadowWidth = { 0 };
|
||||
_uint iShadowHeight = { 0 };
|
||||
switch (iIndex)
|
||||
{
|
||||
case 0:
|
||||
iShadowWidth = g_iNearShadowWidth;
|
||||
iShadowHeight = g_iNearShadowHeight;
|
||||
break;
|
||||
case 1:
|
||||
iShadowWidth = g_iMiddleShadowWidth;
|
||||
iShadowHeight = g_iMiddleShadowHeight;
|
||||
break;
|
||||
case 2:
|
||||
iShadowWidth = g_iFarShadowWidth;
|
||||
iShadowHeight = g_iFarShadowHeight;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Adjust_ShadowTexcel(fMinX, fMinY, fMaxX, fMaxY, iShadowWidth, iShadowHeight);
|
||||
|
||||
targetPlanes[0] = _float4(-1.f, 0.f, 0.f, fMinX); // Left
|
||||
targetPlanes[1] = _float4(1.f, 0.f, 0.f, -fMaxX); // Right
|
||||
@@ -386,7 +406,7 @@ void CPipeLine::Update_ShadowDepthNdcZ()
|
||||
}
|
||||
}
|
||||
|
||||
// Out으로 _float4를 새롭게 메모리로 받고 다시 밖에서 할당할 바에 레퍼런스로 쓰는게 더 나은듯
|
||||
// Out으로 _float4를 새롭게 메모리로 받고 다시 밖에서 할당할 바에 레퍼런스로 쓰는게 더 나을지도?
|
||||
// 카메라 미세 흔들림으로 인한 그림자 튐 보정
|
||||
void CPipeLine::Adjust_ShadowTexcel(_float& fMinX, _float& fMinY, _float& fMaxX, _float& fMaxY, _uint iShadowWidth, _uint iShadowHeight)
|
||||
{
|
||||
|
||||
@@ -6,14 +6,7 @@
|
||||
|
||||
void CRenderer::Render()
|
||||
{
|
||||
_uint iNumViewPort = { 1 };
|
||||
D3D11_VIEWPORT vp = {};
|
||||
m_pContext->RSGetViewports(&iNumViewPort, &vp);
|
||||
_float2 vResolution = { vp.Width, vp.Height };
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
Bind_RawValue();
|
||||
Render_Priority();
|
||||
Render_Shadow();
|
||||
Render_NonBlend();
|
||||
@@ -133,6 +126,29 @@ HRESULT CRenderer::Bind_PrevMatrix(class CShader* pShader, const _char* pConstan
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CRenderer::Bind_RawValue()
|
||||
{
|
||||
_uint iNumViewPort = { 1 };
|
||||
D3D11_VIEWPORT vp = {};
|
||||
m_pContext->RSGetViewports(&iNumViewPort, &vp);
|
||||
_float2 vResolution = { vp.Width, vp.Height };
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vNearShadowResolution", &m_vNearShadowResoltion, sizeof(_float2)))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vMiddleShadowResolution", &m_vMiddleShadowResoltion, sizeof(_float2)))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vFarShadowResolution", &m_vFarShadowResoltion, sizeof(_float2)))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vPreShadowResolution", &m_vPreShadowResoltion, sizeof(_float2)))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Occlusion");
|
||||
@@ -212,8 +228,8 @@ void CRenderer::Render_Shadow()
|
||||
{
|
||||
ViewPortDesc.TopLeftX = 0;
|
||||
ViewPortDesc.TopLeftY = 0;
|
||||
ViewPortDesc.Width = (_float)(g_iMaxShadowWidth);
|
||||
ViewPortDesc.Height = (_float)(g_iMaxShadowHeight);
|
||||
ViewPortDesc.Width = (_float)(m_vNearShadowResoltion.x);
|
||||
ViewPortDesc.Height = (_float)(m_vNearShadowResoltion.y);
|
||||
ViewPortDesc.MinDepth = 0.f;
|
||||
ViewPortDesc.MaxDepth = 1.f;
|
||||
}
|
||||
@@ -245,8 +261,8 @@ void CRenderer::Render_Shadow()
|
||||
{
|
||||
ViewPortDesc.TopLeftX = 0;
|
||||
ViewPortDesc.TopLeftY = 0;
|
||||
ViewPortDesc.Width = (_float)(g_iMaxShadowWidth);
|
||||
ViewPortDesc.Height = (_float)(g_iMaxShadowHeight);
|
||||
ViewPortDesc.Width = (_float)(m_vMiddleShadowResoltion.x);
|
||||
ViewPortDesc.Height = (_float)(m_vMiddleShadowResoltion.y);
|
||||
ViewPortDesc.MinDepth = 0.f;
|
||||
ViewPortDesc.MaxDepth = 1.f;
|
||||
}
|
||||
@@ -270,7 +286,6 @@ void CRenderer::Render_Shadow()
|
||||
}
|
||||
m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc);
|
||||
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Shadow");
|
||||
}
|
||||
|
||||
@@ -359,13 +374,7 @@ void CRenderer::Render_Combined()
|
||||
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));
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_iMaxShadowWidth", &g_iMaxShadowWidth, sizeof(_uint)))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_iMaxShadowHeight", &g_iMaxShadowHeight, sizeof(_uint)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return;
|
||||
}
|
||||
@@ -416,9 +425,6 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Shadow_Middle"), m_pShader, "g_ShadowMiddleTexture"))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Shadow_Far"), m_pShader, "g_ShadowFarTexture"))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_PreShadow"), m_pShader, "g_PreShadowTexture"))) {
|
||||
return;
|
||||
}
|
||||
@@ -824,8 +830,10 @@ void CRenderer::Render_PostProcessing()
|
||||
m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_VelocityTile"), TEXT("Target_VelocityTent"), SHADER_PASS_DEFERRED::MOTIONBLURTENT);
|
||||
}
|
||||
/* MotionBlur */
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_MotionBlur")))) {
|
||||
assert(false); return;
|
||||
if (false == m_bMB) {
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_MotionBlur")))) {
|
||||
assert(false); return;
|
||||
}
|
||||
}
|
||||
{ // Bind_Resorces
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix))) {
|
||||
@@ -883,8 +891,10 @@ void CRenderer::Render_PostProcessing()
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
if (false == m_bMB) {
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Bloom")))) {
|
||||
return;
|
||||
|
||||
@@ -37,15 +37,15 @@ HRESULT CRenderer::Add_DebugComponent(CComponent* pDebugCom)
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CRenderer::Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY)
|
||||
HRESULT CRenderer::Ready_ShadowDepthStencilView(_float2 vSize, ID3D11DepthStencilView** pDSV)
|
||||
{
|
||||
ID3D11Texture2D* pShadowDepthStencilTexture = nullptr;
|
||||
|
||||
D3D11_TEXTURE2D_DESC TextureDesc;
|
||||
ZeroMemory(&TextureDesc, sizeof(D3D11_TEXTURE2D_DESC));
|
||||
|
||||
TextureDesc.Width = iSizeX;
|
||||
TextureDesc.Height = iSizeY;
|
||||
TextureDesc.Width = (_uint)vSize.x;
|
||||
TextureDesc.Height = (_uint)vSize.y;
|
||||
TextureDesc.MipLevels = 1;
|
||||
TextureDesc.ArraySize = 1;
|
||||
TextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
@@ -62,18 +62,7 @@ HRESULT CRenderer::Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateDepthStencilView(pShadowDepthStencilTexture, nullptr, &m_pShadowDSV_NEAR))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateDepthStencilView(pShadowDepthStencilTexture, nullptr, &m_pShadowDSV_MIDDLE))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateDepthStencilView(pShadowDepthStencilTexture, nullptr, &m_pShadowDSV_FAR))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pDevice->CreateDepthStencilView(pShadowDepthStencilTexture, nullptr, &m_pPreShadowDSV))) {
|
||||
if (FAILED(m_pDevice->CreateDepthStencilView(pShadowDepthStencilTexture, nullptr, pDSV))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -199,22 +188,17 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_Shadow_Near */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Near"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Near"), (_uint)m_vNearShadowResoltion.x, (_uint)m_vNearShadowResoltion.y,
|
||||
DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_Shadow_Middle */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Middle"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
|
||||
DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_Shadow_Far */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Far"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shadow_Middle"), (_uint)m_vMiddleShadowResoltion.x, (_uint)m_vMiddleShadowResoltion.y,
|
||||
DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_PreShadow */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_PreShadow"), (_uint)g_iMaxShadowWidth, (_uint)g_iMaxShadowHeight,
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_PreShadow"), (_uint)m_vPreShadowResoltion.x, (_uint)m_vPreShadowResoltion.y,
|
||||
DXGI_FORMAT_R32_FLOAT, _float4(1.f, 1.f, 1.f, 1.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -385,7 +369,19 @@ HRESULT CRenderer::Initialize()
|
||||
|
||||
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(g_iMaxShadowWidth, g_iMaxShadowHeight))) {
|
||||
if (FAILED(Ready_ShadowDepthStencilView(m_vNearShadowResoltion, &m_pShadowDSV_NEAR))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(m_vMiddleShadowResoltion, &m_pShadowDSV_MIDDLE))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(m_vFarShadowResoltion, &m_pShadowDSV_FAR))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(m_vPreShadowResoltion, &m_pPreShadowDSV))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -443,10 +439,6 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Shadow_Middle"), TEXT("Target_Shadow_Middle")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* MRT_Shadow_Far */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Shadow_Far"), TEXT("Target_Shadow_Far")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_PreShadow */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_PreShadow"), TEXT("Target_PreShadow")))) {
|
||||
|
||||
@@ -113,13 +113,20 @@
|
||||
#define SSAO_SAMPLE_NUMBER 64
|
||||
#define TIMER_SHORT_LERP 0.16f
|
||||
|
||||
|
||||
constexpr unsigned int g_iNearShadowWidth = 8192;
|
||||
constexpr unsigned int g_iNearShadowHeight = 4096;
|
||||
|
||||
constexpr unsigned int g_iMiddleShadowWidth = 4096;
|
||||
constexpr unsigned int g_iMiddleShadowHeight = 2304;
|
||||
|
||||
constexpr unsigned int g_iFarShadowWidth = 6144;
|
||||
constexpr unsigned int g_iFarShadowHeight = 3072;
|
||||
|
||||
constexpr unsigned int g_iPreShadowWidth = 16384;
|
||||
constexpr unsigned int g_iPreShadowHeight = 9216;
|
||||
|
||||
constexpr unsigned int g_iMaxShadowWidth = 16384;
|
||||
constexpr unsigned int g_iMaxShadowHeight = 9216;
|
||||
//constexpr unsigned int g_iMaxShadowWidth = 4096;
|
||||
//constexpr unsigned int g_iMaxShadowHeight = 2304;
|
||||
|
||||
|
||||
#ifndef AI_TEXTURE_TYPE_MAX
|
||||
#define AI_TEXTURE_TYPE_MAX 27
|
||||
|
||||
@@ -52,6 +52,13 @@ class CRenderer final : public CBase
|
||||
ID3D11DepthStencilView* m_pShadowDSV_NEAR = { nullptr };
|
||||
ID3D11DepthStencilView* m_pShadowDSV_MIDDLE = { nullptr };
|
||||
ID3D11DepthStencilView* m_pShadowDSV_FAR = { nullptr };
|
||||
|
||||
_float2 m_vNearShadowResoltion = { (_float)g_iNearShadowWidth,(_float)g_iNearShadowHeight };
|
||||
_float2 m_vMiddleShadowResoltion = { (_float)g_iMiddleShadowWidth,(_float)g_iMiddleShadowHeight };
|
||||
_float2 m_vFarShadowResoltion = { (_float)g_iFarShadowWidth,(_float)g_iFarShadowHeight };
|
||||
_float2 m_vPreShadowResoltion = { (_float)g_iPreShadowWidth,(_float)g_iPreShadowHeight };
|
||||
|
||||
|
||||
ID3D11DepthStencilView* m_pPreShadowDSV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pSSAO_NoiseSRV = { nullptr };
|
||||
ID3D11Texture2D* m_pSSAO_NoiseTexture = { nullptr };
|
||||
@@ -101,6 +108,7 @@ class CRenderer final : public CBase
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
void Bind_RawValue();
|
||||
void Render_Occlusion();
|
||||
void Render_Priority();
|
||||
void Render_Shadow();
|
||||
@@ -132,7 +140,7 @@ class CRenderer final : public CBase
|
||||
|
||||
private:
|
||||
void Fill_Geometry(_uint iNumSample);
|
||||
HRESULT Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
HRESULT Ready_ShadowDepthStencilView(_float2 vSize, ID3D11DepthStencilView** pDSV);
|
||||
|
||||
private:
|
||||
HRESULT Initialize();
|
||||
|
||||
Reference in New Issue
Block a user