ComputeShader/Assets/Shaders/ColorInverter.compute

18 lines
374 B
Plaintext

#pragma kernel cs_main
// The output texture
RWTexture2D<float4> result;
// Input texture
Texture2D<float4> source_texture;
[numthreads(8, 8, 1)]
void cs_main(uint3 id : SV_DispatchThreadID)
{
float4 color = source_texture[id.xy];
color.rgb = 1 - color.rgb;
//color.rgb = float4(0, 1, 1, 0);
//color.rgb = float4(0, 1, 1, 0);
result[id.xy] = color;
}