2019-11-04 21:39:02 +00:00
|
|
|
#pragma kernel CSMain
|
|
|
|
|
|
|
|
Texture2D<float> Input;
|
|
|
|
RWTexture2D<float> Previous;
|
|
|
|
RWTexture2D<float> Result;
|
|
|
|
float Factor;
|
|
|
|
|
|
|
|
[numthreads(8,8,1)]
|
|
|
|
void CSMain (uint3 id : SV_DispatchThreadID)
|
|
|
|
{
|
2019-12-12 16:48:03 +00:00
|
|
|
int xOffset = id.x * 256; // 2048 / 8
|
|
|
|
int yOffset = id.y * 192; // 1536 / 8
|
2019-11-04 21:39:02 +00:00
|
|
|
|
2019-12-12 16:48:03 +00:00
|
|
|
for(int localY = 0; localY < 192; ++localY)
|
2019-11-04 21:39:02 +00:00
|
|
|
{
|
2019-12-12 16:48:03 +00:00
|
|
|
for(int localX = 0; localX < 256; ++localX)
|
2019-11-04 21:39:02 +00:00
|
|
|
{
|
|
|
|
uint2 coordinate = uint2(xOffset + localX, yOffset + localY);
|
|
|
|
float inputValue = (float)Input[coordinate];
|
|
|
|
float previousValue = (float)Previous[coordinate];
|
|
|
|
|
|
|
|
Result[coordinate] = abs(inputValue - previousValue) / Factor;
|
|
|
|
Previous[coordinate] = Input[coordinate];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|