// Each #kernel tells which function to compile; you can have many kernels #pragma kernel cs_main // Create a RenderTexture with enableRandomWrite flag and set it // with cs.SetTexture RWTexture2D result; // Input texture Texture2D source_texture; [numthreads(8,8,1)] void cs_main (uint3 id : SV_DispatchThreadID) { float4 color = result[id.xy]; color.rgb = 1 - color.rgb; // invert the color result[id.xy] = color; }