You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Turns out our VisualizeTexture tool didn't apply proper linear -> sRGB color transformation. This hidden a long standing problem in TSR that had the wrong idea of the final backbuffer contributions. This meant TSR's MeasureBackbufferLDRQuantizationError() was overly large in shadows, which caused subtle VFX in shadows that have enough contribution to be visible in backbuffer to ghost with TSR thinking their contribution was about or smaller than lowest significant bit in backbuffer. #rb none #jira UE-166882, UE-183684, FORT-592719 #preflight 644042d3b91c130758bf162c [CL 25118487 by guillaume abadie in ue5-main branch]
70 lines
1.7 KiB
Plaintext
70 lines
1.7 KiB
Plaintext
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "TSRCommon.ush"
|
|
|
|
|
|
//------------------------------------------------------- CONFIG
|
|
|
|
#define TILE_SIZE 8
|
|
|
|
#define TILE_ROWS 2
|
|
|
|
|
|
//------------------------------------------------------- PARAMETERS
|
|
|
|
float PerceptionAdd;
|
|
|
|
Texture2D<tsr_half3> SceneColorTexture;
|
|
RWTexture2D<tsr_half> MoireLumaOutput;
|
|
|
|
|
|
//------------------------------------------------------- ENTRY POINT
|
|
|
|
[numthreads(TILE_SIZE * TILE_SIZE, 1, 1)]
|
|
void MainCS(
|
|
uint2 GroupId : SV_GroupID,
|
|
uint GroupThreadIndex : SV_GroupIndex)
|
|
{
|
|
uint2 GroupThreadId = uint2(GroupThreadIndex % TILE_SIZE, GroupThreadIndex / TILE_SIZE);
|
|
uint2 OutputPixelOrigin = (InputInfo_ViewportMin + GroupId * uint(TILE_SIZE * TILE_ROWS)) + GroupThreadId;
|
|
|
|
tsr_half3 ColorArray[TILE_ROWS * TILE_ROWS];
|
|
|
|
ISOLATE
|
|
{
|
|
UNROLL_N(TILE_ROWS)
|
|
for (uint y = 0; y < TILE_ROWS; y++)
|
|
{
|
|
UNROLL_N(TILE_ROWS)
|
|
for (uint x = 0; x < TILE_ROWS; x++)
|
|
{
|
|
const uint2 PixelOffset = uint2(x, y) * TILE_SIZE;
|
|
uint2 InputPixelPos = OutputPixelOrigin + PixelOffset;
|
|
|
|
ColorArray[x + y * TILE_ROWS] = SceneColorTexture[InputPixelPos];
|
|
}
|
|
}
|
|
}
|
|
|
|
ISOLATE
|
|
{
|
|
UNROLL_N(TILE_ROWS)
|
|
for (uint y = 0; y < TILE_ROWS; y++)
|
|
{
|
|
UNROLL_N(TILE_ROWS)
|
|
for (uint x = 0; x < TILE_ROWS; x++)
|
|
{
|
|
const uint2 PixelOffset = uint2(x, y) * TILE_SIZE;
|
|
uint2 InputPixelPos = OutputPixelOrigin + PixelOffset;
|
|
|
|
tsr_half3 Color = ColorArray[x + y * TILE_ROWS];
|
|
Color *= rcp(tsr_half(PerceptionAdd) + Color);
|
|
|
|
InputPixelPos.x = select(all(InputPixelPos < InputInfo_ViewportMax), InputPixelPos.x, uint(~0));
|
|
|
|
MoireLumaOutput[InputPixelPos] = dot(Color, kMoireLumaWeights);
|
|
}
|
|
}
|
|
}
|
|
}
|