Created
December 5, 2018 13:49
-
-
Save zyouyowa/31e12c0a7d354f4ad47f022acf72d4b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma kernel CSMain | |
Texture2D<float4> srcTex; | |
RWTexture2D<float4> dstTex; | |
[numthreads(32, 32, 1)] | |
void CSMain(uint3 id : SV_DispatchThreadID) { | |
float4 up = srcTex[id.xy + int2(0, 1)]; | |
float4 down = srcTex[id.xy + int2(0, -1)]; | |
float4 left = srcTex[id.xy + int2(-1, 0)]; | |
float4 right = srcTex[id.xy + int2(1, 0)]; | |
float4 middle = -4.0 * srcTex[id.xy]; | |
float4 sum = middle + up + down + left + right; | |
sum.w = 1.0; | |
dstTex[id.xy] = sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment