씬뷰.cpp
void FSceneView::SetupViewRectUniformBufferParameters(FViewUniformShaderParameters& ViewUniformShaderParameters,
const FIntPoint& BufferSize,
const FIntRect& EffectiveViewRect,
const FViewMatrices& InViewMatrices,
const FViewMatrices& InPrevViewMatrices) const
{
checkfSlow(EffectiveViewRect.Area() > 0, TEXT("Invalid-size EffectiveViewRect passed to CreateUniformBufferParameters [%d * %d]."), EffectiveViewRect.Width(), EffectiveViewRect.Height());
ensureMsgf((BufferSize.X > 0 && BufferSize.Y > 0), TEXT("Invalid-size BufferSize passed to CreateUniformBufferParameters [%d * %d]."), BufferSize.X, BufferSize.Y);
ViewUniformShaderParameters.ViewRectMin = FVector4(EffectiveViewRect.Min.X, EffectiveViewRect.Min.Y, 0.0f, 0.0f);
ViewUniformShaderParameters.ViewSizeAndInvSize = FVector4(EffectiveViewRect.Width(), EffectiveViewRect.Height(), 1.0f / float(EffectiveViewRect.Width()), 1.0f / float(EffectiveViewRect.Height()));
// The light probe ratio is only different during separate forward translucency when r.SeparateTranslucencyScreenPercentage != 100
ViewUniformShaderParameters.LightProbeSizeRatioAndInvSizeRatio = FVector4(1.0f, 1.0f, 1.0f, 1.0f);
// Calculate the vector used by shaders to convert clip space coordinates to texture space.
const float InvBufferSizeX = 1.0f / BufferSize.X;
const float InvBufferSizeY = 1.0f / BufferSize.Y;
// to bring NDC (-1..1, 1..-1) into 0..1 UV for BufferSize textures
const FVector4 ScreenPositionScaleBias(
EffectiveViewRect.Width() * InvBufferSizeX / +2.0f,
EffectiveViewRect.Height() * InvBufferSizeY / (-2.0f * GProjectionSignY),
(EffectiveViewRect.Height() / 2.0f + EffectiveViewRect.Min.Y) * InvBufferSizeY,
(EffectiveViewRect.Width() / 2.0f + EffectiveViewRect.Min.X) * InvBufferSizeX);
ViewUniformShaderParameters.ScreenPositionScaleBias = ScreenPositionScaleBias;
}