You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#codereview michael.trepka, nick.whiting [CL 2094271 by Mark Satterthwaite in Main branch]
62 lines
2.7 KiB
Plaintext
62 lines
2.7 KiB
Plaintext
/************************************************************************************
|
|
|
|
Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
|
|
|
|
Licensed under the Oculus VR SDK License Version 2.0 (the "License");
|
|
you may not use the Oculus VR SDK except in compliance with the License,
|
|
which is provided at the time of installation or download, or which
|
|
otherwise accompanies this software in either electronic or hard copy form.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.oculusvr.com/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
*************************************************************************************/
|
|
/*=============================================================================
|
|
PostProcessHMD.usf: PostProcessing shader to distort and chromaab correction
|
|
for HMD devices
|
|
=============================================================================*/
|
|
|
|
#include "Common.usf"
|
|
#include "PostProcessCommon.usf"
|
|
|
|
#if USE_TIMEWARP
|
|
#else
|
|
|
|
float2 EyeToSrcUVScale;
|
|
float2 EyeToSrcUVOffset;
|
|
|
|
void MainVS(in float2 Position : ATTRIBUTE0, in float2 TexCoord0 : ATTRIBUTE1, in float2 TexCoord1 : ATTRIBUTE2, in float2 TexCoord2 : ATTRIBUTE3, in float4 Color : ATTRIBUTE4,
|
|
out float4 OutPosition : SV_Position, out float4 OutColor : COLOR,
|
|
out float2 OutTexCoord0 : TEXCOORD0, out float2 OutTexCoord1 : TEXCOORD1, out float2 OutTexCoord2 : TEXCOORD2)
|
|
{
|
|
OutPosition.xy = Position.xy;
|
|
OutPosition.z = 0.5;
|
|
OutPosition.w = 1.0;
|
|
|
|
// Vertex inputs are in TanEyeAngle space for the R,G,B channels (i.e. after chromatic aberration and distortion).
|
|
// Scale them into the correct [0-1],[0-1] UV lookup space (depending on eye)
|
|
OutTexCoord0 = TexCoord0 * EyeToSrcUVScale + EyeToSrcUVOffset;
|
|
OutTexCoord1 = TexCoord1 * EyeToSrcUVScale + EyeToSrcUVOffset;
|
|
OutTexCoord2 = TexCoord2 * EyeToSrcUVScale + EyeToSrcUVOffset;
|
|
OutColor = Color; // Used for vignette fade.
|
|
}
|
|
|
|
void MainPS(in float4 Position : SV_Position, in float4 Color : COLOR,
|
|
in float2 TexCoord0 : TEXCOORD0, in float2 TexCoord1 : TEXCOORD1, in float2 TexCoord2 : TEXCOORD2, out float4 OutColor : SV_Target0)
|
|
{
|
|
float ResultR = Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, TexCoord0).r;
|
|
float ResultG = Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, TexCoord1).g;
|
|
float ResultB = Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, TexCoord2).b;
|
|
OutColor = float4(ResultR * Color.r, ResultG * Color.g, ResultB * Color.b, 1.0);
|
|
}
|
|
|
|
#endif
|
|
|