Files
UnrealEngineUWP/Engine/Shaders/Private/RecomputeTangentsCommon.ush
Ryan Vance 7c51ff94af Merging //UE4/Dev-Main to Dev-VR (//UE4/Dev-VR)
CL 1 of 8
#rb integration

[CL 4748712 by Ryan Vance in Dev-VR branch]
2019-01-17 18:54:05 -05:00

58 lines
1.6 KiB
Plaintext

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
RecomputeTangentsCommon.usf: Recompute Skin Tangents
=============================================================================*/
#include "Common.ush"
#include "GpuSkinCommon.ush"
// constants -----------------------------
// could be larger for better precision but we need to be conservative as we sum up many triangles weighed by the angle (potentially unbound)
#define TANGENT_RANGE 0x7fff
// chunk -----------------------------
//
uint NumVertices;
//
uint NumTriangles;
// vertex input ----------------------------
//
Buffer<SNORM float4> TangentInputBuffer;
Buffer<float2> UVsInputBuffer;
RWBuffer<SNORM float4> TangentBufferUAV;
// in vertices
uint InputStreamStart;
uint NumTexCoords;
uint SelectedTexCoord;
// index input ----------------------------
// start index in IndexBuffer[]
uint IndexBufferOffset;
// todo: test 16bit and 32 bit
/// only needed for MainCS()
Buffer<uint> IndexBuffer;
// SkinCache -----------------------------
// input vertex data (SkinCache output)
// used as input in MainCS()
Buffer<float4> GPUTangentCacheBuffer;
Buffer<float> GPUPositionCacheBuffer;
// start offset in vertices
uint SkinCacheStart;
// intermediate ------------------------------
// intermediate tangent accumulation buffer, int se we can use atomics and to get deterministic results no matter what order
// uses as output on MainCS(), used and input and output (to clear) for ResolveCS()
RWBuffer<int> IntermediateAccumBufferUAV;