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 75d7484e7..444f13d38 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -231,7 +231,7 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv) // BackGround ForeGround 합은 1 float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale) { - return saturate(0.5f + 0.5f + 0.5f*(float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth))); + return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth)); } float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 37e606277..0accabe12 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -74,6 +74,7 @@ Texture2D g_OriginalTexture; Texture2D g_ColorTexture; Texture2D g_VelocityTexture; +Texture2D g_TileVelocityTexture; int g_iMBSampleCount; int g_iMBMaxSampleCount; @@ -246,96 +247,86 @@ struct PS_OUT_SSAO_BLUR PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) { PS_OUT_VELOCITYBLUR Out = (PS_OUT_VELOCITYBLUR) 0; - - float2 centerUV = In.vTexcoord; - - float4 centerColor = g_ColorTexture.Sample(ClampLinearSampler, centerUV); - float centerDepth = g_DepthTexture.Sample(PointSampler, centerUV).y; - - // encoded(0..1) -> signed(-1..1) - float2 centerVelocitySignedUV = g_VelocityTexture.Sample(PointSampler, centerUV).xy * 2.0f - 1.0f; - - // UV -> pixels - float2 centerVelocityPixels = centerVelocitySignedUV * g_vResolution.xy; - float centerSpeedPixels = length(centerVelocityPixels); - - // **정지 데드존** - if (centerSpeedPixels < 0.5f) - { - Out.vColor = centerColor; + + float2 vCenterUV = In.vTexcoord; + float2 vFullResolutionTexelSize = 1.f / g_vResolution; + float fCenterDepth = g_DepthTexture.Sample(PointSampler, vCenterUV).y; + float2 vCenterVelo = g_VelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; // 0~1 -> -1~+1 + float2 vCenterVeloPixel = vCenterVelo * g_vResolution.xy; + bool bBorrowedVelocityFromTile = false; + + float2 vBlurVelo = vCenterVelo; + float2 vBlurVeloPixel = vCenterVeloPixel; + if (length(vBlurVeloPixel) < 0.5f) { + vBlurVelo = g_TileVelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; + vBlurVeloPixel = vBlurVelo * g_vResolution.xy; + bBorrowedVelocityFromTile = true; + } + + if (length(vBlurVeloPixel) < 0.5f) { + Out.vColor = g_ColorTexture.Sample(ClampLinearSampler, vCenterUV); Out.vVelocity = float2(0.5f, 0.5f); return Out; } - - // **방향(정규화)** - float2 velocityDirectionPixels = centerVelocityPixels / max(centerSpeedPixels, FLT_EPSILON5); - - // **최대 블러 반경(픽셀)** - float blurRadiusPixels = min(centerSpeedPixels, g_fMBBlurRadius); - - int maximumSampleCount = min(g_iMBSampleCount, g_iMBMaxSampleCount); - int tapRadius = min(maximumSampleCount, (int) ceil(blurRadiusPixels)); // 옵션: 속도에 따라 탭 줄이기 - - float sampleStepPixels = blurRadiusPixels / max((float) tapRadius, 1.0f); - - // SpreadCompare용 스케일 (픽셀 -> 샘플단위) - float pixelToSampleUnitsScale = (float) tapRadius / max(blurRadiusPixels, FLT_EPSILON5); - - float depthScale = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); - - float4 weightedColorSum = float4(0, 0, 0, 0); - float2 weightedVelocitySum = float2(0, 0); - float weightSum = 0.0f; - - // 픽셀 오프셋 -> UV 오프셋 - float2 pixelToUV = 1.0f / g_vResolution.xy; - - // center spread는 "반경"으로 잡는 편이 안정적 - float centerSpreadLength = blurRadiusPixels; + + float2 vBlurDirPixel = (vBlurVeloPixel / max(length(vBlurVeloPixel), FLT_EPSILON5)); + int iMaxRadius = min(g_iMBSampleCount, g_iMBMaxSampleCount); + + // 샘플링 당 이동 픽셀 + float fSamplePixelSpeed = g_fMBBlurRadius / max((float) iMaxRadius, 1.f); + + // 샘플유닛의 크기 + float fScalePixelToSampleUnit = (float) iMaxRadius / max(g_fMBBlurRadius, FLT_EPSILON5); + float fScaleDepth = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); + float4 vAccColorSum = float4(0.f, 0.f, 0.f, 0.f); + float2 vAccVeloSum = float2(0.f, 0.f); + float fAccWeight = 0.f; + + // 센터의 스프레드 길이 + float2 vReferenceVelocityPixel = vCenterVeloPixel; + if (true == bBorrowedVelocityFromTile) + { + vReferenceVelocityPixel = vBlurVeloPixel; + } + float fCenterSpreadLengthPixel = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, g_fMBBlurRadius); [loop] - for (int i = -tapRadius; i <= tapRadius; ++i) - { - float offsetLengthSamples = (float) abs(i); - - float2 offsetPixels = velocityDirectionPixels * ((float) i * sampleStepPixels); - float2 sampleUV = centerUV + offsetPixels * pixelToUV; - - // Clamp 샘플러를 쓰면 굳이 IsValidUV가 필수는 아니지만, 남겨도 됩니다. - if (false == IsValidUV(sampleUV)) + for (int iInterval = -iMaxRadius; iInterval <= iMaxRadius; ++iInterval) { + float fOffset = (float) abs(iInterval); + float2 vOffsetPixel = vBlurDirPixel * ((float) iInterval * fSamplePixelSpeed); + float2 vSamplingUV = vCenterUV + vOffsetPixel * vFullResolutionTexelSize; + if (false == IsValidUV(vSamplingUV)) { continue; + } - float sampleDepth = g_DepthTexture.Sample(PointSampler, sampleUV).y; + float fSampledDepth = g_DepthTexture.Sample(PointSampler, vSamplingUV).y; + float2 vSampledVelo = g_VelocityTexture.Sample(PointSampler, vSamplingUV).xy * 2.f - 1.f; + float2 vSampledVeloPixel = vSampledVelo * g_vResolution.xy; - float2 sampleVelocitySignedUV = g_VelocityTexture.Sample(PointSampler, sampleUV).xy * 2.0f - 1.0f; - float2 sampleVelocityPixels = sampleVelocitySignedUV * g_vResolution.xy; + // 샘플의 스프레드 길이 + float fBlurSampleAccurate = abs(dot(vSampledVeloPixel, vBlurDirPixel)); + float fSampleSpreadLengthPixel = clamp(fBlurSampleAccurate, 0.f, g_fMBBlurRadius); + if (true == bBorrowedVelocityFromTile) + { + fSampleSpreadLengthPixel = max(fSampleSpreadLengthPixel, fCenterSpreadLengthPixel); + } - float sampleSpreadLength = clamp(length(sampleVelocityPixels), 0.0f, g_fMBBlurRadius); - - float weightCalculated = SampleWeight( - centerDepth, sampleDepth, - offsetLengthSamples, - centerSpreadLength, sampleSpreadLength, - pixelToSampleUnitsScale, - depthScale - ); - - if (weightCalculated <= 0.0f) + // 샘플과 센터의 (깊이테스트 + 스프레드테스트) + float fWeightCalculated = SampleWeight(fCenterDepth, fSampledDepth, fOffset, fCenterSpreadLengthPixel, fSampleSpreadLengthPixel, fScalePixelToSampleUnit, fScaleDepth); + + if (fWeightCalculated <= 0.f) { continue; - - float4 sampleColor = g_ColorTexture.Sample(ClampLinearSampler, sampleUV); - - weightedColorSum += sampleColor * weightCalculated; - weightedVelocitySum += sampleVelocitySignedUV * weightCalculated; - weightSum += weightCalculated; + } + + float4 vSampledColor = g_ColorTexture.Sample(ClampLinearSampler, vSamplingUV); + vAccColorSum += vSampledColor * fWeightCalculated; + vAccVeloSum += vSampledVelo * fWeightCalculated; + fAccWeight += fWeightCalculated; } - - float4 blurColor = weightedColorSum / max(weightSum, FLT_EPSILON5); - float2 blurVelocitySignedUV = weightedVelocitySum / max(weightSum, FLT_EPSILON5); - - Out.vColor = blurColor; - Out.vVelocity = blurVelocitySignedUV * 0.5f + 0.5f; // 다시 encode - + float4 vBlurredColor = vAccColorSum / max(fAccWeight, FLT_EPSILON5); + float2 vBlurredVelo = vAccVeloSum / max(fAccWeight, FLT_EPSILON5); + Out.vColor = vBlurredColor; + Out.vVelocity = vBlurredVelo * 0.5f + 0.5f; return Out; } PS_OUT_VELOCITYTILE PS_MOTIONBLUR_TILESAMPLE(PS_IN In) @@ -1578,7 +1569,7 @@ technique11 DefaultTechnique 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(); + VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TILESAMPLE(); } @@ -1587,7 +1578,7 @@ technique11 DefaultTechnique 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(); + VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } 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 75d7484e7..444f13d38 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -231,7 +231,7 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv) // BackGround ForeGround 합은 1 float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale) { - return saturate(0.5f + 0.5f + 0.5f*(float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth))); + return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth)); } float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale) diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index f36c5a3ae..0accabe12 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -74,6 +74,7 @@ Texture2D g_OriginalTexture; Texture2D g_ColorTexture; Texture2D g_VelocityTexture; +Texture2D g_TileVelocityTexture; int g_iMBSampleCount; int g_iMBMaxSampleCount; @@ -246,75 +247,86 @@ struct PS_OUT_SSAO_BLUR PS_OUT_VELOCITYBLUR PS_MOTIONBLUR(PS_IN In) { PS_OUT_VELOCITYBLUR Out = (PS_OUT_VELOCITYBLUR) 0; - float2 vSumVelocity = float2(0.f, 0.f); - float4 vSumColor = float4(0.f, 0.f, 0.f, 0.f); - float4 vSampledColor = float4(0.f, 0.f, 0.f, 0.f); - float fSampledDepth = 1.f; - float fWeight = 0.f; - float2 vSampledVelocityUV; - float2 vSampledVelocityPixels; - float2 vDestUV; - float fSampleSpreadLength; - float2 uv = In.vTexcoord; - float fCenterDepth = g_DepthTexture.Sample(PointSampler, uv).y; // 해당 셀의 깊이 - float2 vCenterVelocityUV = (g_VelocityTexture.Sample(PointSampler, uv).xy * 2.f - 1.f); - float2 vCenterVelocityPixels = vCenterVelocityUV * g_vResolution.xy; // UV -> 픽셀 - float fCenterSpreadLength = clamp(abs(vCenterVelocityPixels.x), 0.0f, g_fMBBlurRadius); - float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y); // 소스 셀 사이즈 g_vResolution-> 현재는 colortexture 해상도 - int iMaxMotionBlurSampleCount = min(g_iMBSampleCount, g_iMBMaxSampleCount); /* 최대 속도 */ - - float fPixelToSampleUnitsScale = (float) iMaxMotionBlurSampleCount / max(g_fMBBlurRadius, FLT_EPSILON5); - float fDepthScale = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); - float fSampleStepPixels = g_fMBBlurRadius / max((float) iMaxMotionBlurSampleCount, 1.0f); + float2 vCenterUV = In.vTexcoord; + float2 vFullResolutionTexelSize = 1.f / g_vResolution; + float fCenterDepth = g_DepthTexture.Sample(PointSampler, vCenterUV).y; + float2 vCenterVelo = g_VelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; // 0~1 -> -1~+1 + float2 vCenterVeloPixel = vCenterVelo * g_vResolution.xy; + bool bBorrowedVelocityFromTile = false; - [loop] - for (int i = -iMaxMotionBlurSampleCount; i <= iMaxMotionBlurSampleCount; ++i) - { - // 대상이 되는 셀은 센터uv + 임의값*셀사이즈*갯수 - vDestUV.x = uv.x + (i * vSrcTexelSize.x) * fSampleStepPixels; - vDestUV.y = uv.y; - - // [UVTest] - if (false == IsValidUV(vDestUV)) - { // UV밖에서 샘플링 해오려 하면 스킵 - continue; - } - - fSampledDepth = g_DepthTexture.Sample(PointSampler, vDestUV).y; - vSampledVelocityUV = (g_VelocityTexture.Sample(PointSampler, vDestUV).xy * 2.f - 1.f); - vSampledVelocityPixels = vSampledVelocityUV * g_vResolution.xy; - fSampleSpreadLength = clamp(abs(vSampledVelocityPixels.x), 0.0f, g_fMBBlurRadius); - - // [Sample] - float fWeightCalculated = SampleWeight(fCenterDepth, fSampledDepth, float(abs(i)), fCenterSpreadLength, fSampleSpreadLength, fPixelToSampleUnitsScale, fDepthScale); - if (fWeightCalculated <= 0.0f) - { - continue; - } - vSampledColor = g_ColorTexture.Sample(ClampLinearSampler, vDestUV); - vSumColor += vSampledColor * fWeightCalculated; - vSumVelocity += vSampledVelocityUV * fWeightCalculated; - fWeight += fWeightCalculated; + float2 vBlurVelo = vCenterVelo; + float2 vBlurVeloPixel = vCenterVeloPixel; + if (length(vBlurVeloPixel) < 0.5f) { + vBlurVelo = g_TileVelocityTexture.Sample(PointSampler, vCenterUV).xy * 2.f - 1.f; + vBlurVeloPixel = vBlurVelo * g_vResolution.xy; + bBorrowedVelocityFromTile = true; } - float4 vBlurColor = vSumColor / max(fWeight, FLT_EPSILON5); - float2 vBlurVelocity = vSumVelocity / max(fWeight, FLT_EPSILON5); - - float fTapCount = (float) (2 * iMaxMotionBlurSampleCount + 1); - float fCoverage = saturate(fWeight / max(fTapCount, 1.0f)); - - //Out.vColor = float4(vBlurColor.rgb, fCoverage); - Out.vColor = vBlurColor; - Out.vVelocity = vBlurVelocity * 0.5f + 0.5f; - float2 vBlurVelocityPixels = vBlurVelocity * g_vResolution.xy; - if (length(vBlurVelocityPixels) < 0.5f) // 0.5px 이하면 정지 취급 - { - Out.vColor = g_ColorTexture.Sample(ClampLinearSampler, uv); + if (length(vBlurVeloPixel) < 0.5f) { + Out.vColor = g_ColorTexture.Sample(ClampLinearSampler, vCenterUV); Out.vVelocity = float2(0.5f, 0.5f); return Out; } + + float2 vBlurDirPixel = (vBlurVeloPixel / max(length(vBlurVeloPixel), FLT_EPSILON5)); + int iMaxRadius = min(g_iMBSampleCount, g_iMBMaxSampleCount); + + // 샘플링 당 이동 픽셀 + float fSamplePixelSpeed = g_fMBBlurRadius / max((float) iMaxRadius, 1.f); + + // 샘플유닛의 크기 + float fScalePixelToSampleUnit = (float) iMaxRadius / max(g_fMBBlurRadius, FLT_EPSILON5); + float fScaleDepth = 0.5f / max(g_fMBSampleBias, FLT_EPSILON5); + float4 vAccColorSum = float4(0.f, 0.f, 0.f, 0.f); + float2 vAccVeloSum = float2(0.f, 0.f); + float fAccWeight = 0.f; + + // 센터의 스프레드 길이 + float2 vReferenceVelocityPixel = vCenterVeloPixel; + if (true == bBorrowedVelocityFromTile) + { + vReferenceVelocityPixel = vBlurVeloPixel; + } + float fCenterSpreadLengthPixel = clamp(abs(dot(vReferenceVelocityPixel, vBlurDirPixel)), 0.f, g_fMBBlurRadius); + [loop] + for (int iInterval = -iMaxRadius; iInterval <= iMaxRadius; ++iInterval) { + float fOffset = (float) abs(iInterval); + float2 vOffsetPixel = vBlurDirPixel * ((float) iInterval * fSamplePixelSpeed); + float2 vSamplingUV = vCenterUV + vOffsetPixel * vFullResolutionTexelSize; + if (false == IsValidUV(vSamplingUV)) { + continue; + } + + float fSampledDepth = g_DepthTexture.Sample(PointSampler, vSamplingUV).y; + float2 vSampledVelo = g_VelocityTexture.Sample(PointSampler, vSamplingUV).xy * 2.f - 1.f; + float2 vSampledVeloPixel = vSampledVelo * g_vResolution.xy; + + // 샘플의 스프레드 길이 + float fBlurSampleAccurate = abs(dot(vSampledVeloPixel, vBlurDirPixel)); + float fSampleSpreadLengthPixel = clamp(fBlurSampleAccurate, 0.f, g_fMBBlurRadius); + if (true == bBorrowedVelocityFromTile) + { + fSampleSpreadLengthPixel = max(fSampleSpreadLengthPixel, fCenterSpreadLengthPixel); + } + + // 샘플과 센터의 (깊이테스트 + 스프레드테스트) + float fWeightCalculated = SampleWeight(fCenterDepth, fSampledDepth, fOffset, fCenterSpreadLengthPixel, fSampleSpreadLengthPixel, fScalePixelToSampleUnit, fScaleDepth); + + if (fWeightCalculated <= 0.f) { + continue; + } + + float4 vSampledColor = g_ColorTexture.Sample(ClampLinearSampler, vSamplingUV); + vAccColorSum += vSampledColor * fWeightCalculated; + vAccVeloSum += vSampledVelo * fWeightCalculated; + fAccWeight += fWeightCalculated; + } + float4 vBlurredColor = vAccColorSum / max(fAccWeight, FLT_EPSILON5); + float2 vBlurredVelo = vAccVeloSum / max(fAccWeight, FLT_EPSILON5); + Out.vColor = vBlurredColor; + Out.vVelocity = vBlurredVelo * 0.5f + 0.5f; return Out; } PS_OUT_VELOCITYTILE PS_MOTIONBLUR_TILESAMPLE(PS_IN In) @@ -1557,7 +1569,7 @@ technique11 DefaultTechnique 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(); + VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TILESAMPLE(); } @@ -1566,7 +1578,7 @@ technique11 DefaultTechnique 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(); + VertexShader = compile vs_5_0 VS_CAPTURE(); GeometryShader = NULL; PixelShader = compile ps_5_0 PS_MOTIONBLUR_TENTSAMPLE(); } diff --git a/Jusin154_Team3D/Engine/Private/GameObject.cpp b/Jusin154_Team3D/Engine/Private/GameObject.cpp index be6790410..1066bd828 100644 --- a/Jusin154_Team3D/Engine/Private/GameObject.cpp +++ b/Jusin154_Team3D/Engine/Private/GameObject.cpp @@ -108,7 +108,8 @@ void CGameObject::Set_Shadow(pair<_bool, _ubyte> shadowResult) m_pGameInstance->Add_RenderGroup(RENDER::SHADOW_MIDDLE, this); } if (0 < (m_iShadow & (_ubyte)SHADOW::SHADOW_FAR)) { - m_pGameInstance->Add_RenderGroup(RENDER::SHADOW_FAR, this); + m_iShadow = 0; + assert(false); // 지금은 Shadow_Far 미사용 } } else { diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index f6c8a7e9e..46d8dcc42 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -268,39 +268,6 @@ void CRenderer::Render_Shadow() return; } } - { // MRT_Shadow_Far - if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Shadow_Far"), m_pShadowDSV_FAR))) { - return; - } - - D3D11_VIEWPORT ViewPortDesc; - ZeroMemory(&ViewPortDesc, sizeof(D3D11_VIEWPORT)); - { - ViewPortDesc.TopLeftX = 0; - ViewPortDesc.TopLeftY = 0; - ViewPortDesc.Width = (_float)(g_iMaxShadowWidth); - ViewPortDesc.Height = (_float)(g_iMaxShadowHeight); - ViewPortDesc.MinDepth = 0.f; - ViewPortDesc.MaxDepth = 1.f; - } - m_pContext->RSSetViewports(1, &ViewPortDesc); - - for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_FAR)]) { - if (nullptr != pRenderObject) { - if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_FAR))) { - assert(false); - } - } - - SAFE_RELEASE(pRenderObject); - } - - m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_FAR)].clear(); - - if (FAILED(m_pGameInstance->End_MRT())) { - return; - } - } m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc); @@ -895,7 +862,7 @@ void CRenderer::Render_PostProcessing() assert(false); return; } - if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_MotionBlur"), m_pShader, "g_ColorTexture"))) { + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_AfterBlend"), m_pShader, "g_ColorTexture"))) { assert(false); return; } @@ -907,6 +874,10 @@ void CRenderer::Render_PostProcessing() assert(false); return; } + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_VelocityTent"), m_pShader, "g_TileVelocityTexture"))) { + assert(false); + return; + } } m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::MOTIONBLUR)); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 16c78c44c..d91180014 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -5,7 +5,7 @@ NS_BEGIN(Engine) enum class STATE { RIGHT, UP, LOOK, POSITION, END }; enum class LIGHT { DIRECTIONAL, POINT, SPOT, END }; enum class COLLIDER { AABB, OBB, SPHERE, END }; -enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, UI, OCCLUSION, SHADOW_MIDDLE, SHADOW_FAR, PRESHADOW, UI_OVERLAY ,END }; +enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, UI, OCCLUSION, SHADOW_MIDDLE, PRESHADOW, UI_OVERLAY ,END }; enum class RAY { LOCAL, WORLD, END }; enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END }; enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,END};