Files
UnrealEngineUWP/Engine/Shaders/Private/ODSCapture.usf
Marc Audy 360d078ca3 Second batch of remaining Engine copyright updates.
#rnx
#rb none

[CL 10871248 by Marc Audy in Main branch]
2019-12-27 09:26:59 -05:00

49 lines
1.4 KiB
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
ODSCapture.usf: Shader for reconstructing a lat-long from a previously rendered
stereo cube capture with omni-directional stereo displacement.
See: https://developers.google.com/vr/jump/rendering-ods-content.pdf
Note: The left eye is packed on top of the right eye.
=============================================================================*/
#include "Common.ush"
TextureCube LeftEyeTexture;
TextureCube RightEyeTexture;
SamplerState LeftEyeTextureSampler;
SamplerState RightEyeTextureSampler;
void MainPS(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
#if ODS_CAPTURE
bool bIsTop = (Input.UV.y < 0.5);
float OffsetY = bIsTop ? 0.0 : -1.0;
float2 UVs;
UVs.x = Input.UV.x;
UVs.y = Input.UV.y * 2.0 + OffsetY;
float4 ScaleOffset = float4(2.0 * PI, -PI, -PI, PI * 0.5);
float2 Angles = UVs * ScaleOffset.xy + ScaleOffset.zw;
float2 AngleCos = cos(Angles);
float2 AngleSin = sin(Angles);
float3 EyeUVs = float3(AngleSin.x * AngleCos.y, -AngleCos.x * AngleCos.y, AngleSin.y);
if (bIsTop)
{
OutColor = float4(TextureCubeSample(LeftEyeTexture, LeftEyeTextureSampler, EyeUVs).rgb, 1.0);
}
else
{
OutColor = float4(TextureCubeSample(RightEyeTexture, RightEyeTextureSampler, EyeUVs).rgb, 1.0);
}
#else
OutColor = float4(0.0, 0.0, 0.0, 1.0);
#endif
}