// A minimal pixel shader that inverts the colors // The terminal graphics as a texture Texture2D shaderTexture; SamplerState samplerState; // Terminal settings such as the resolution of the texture cbuffer PixelShaderSettings { // Time since pixel shader was enabled float Time; // UI Scale float Scale; // Resolution of the shaderTexture float2 Resolution; // Background color as rgba float4 Background; }; // A pixel shader is a program that given a texture coordinate (tex) produces a color // Just ignore the pos parameter float4 main(float4 pos : SV_POSITION, float2 tex : TEXCOORD) : SV_TARGET { // Read the color value at the current texture coordinate (tex) // float4 is tuple of 4 floats, rgba float4 color = shaderTexture.Sample(samplerState, tex); float avg = (color.x + color.y + color.z) / 3.0; // Inverts the rgb values (xyz) but don't touch the alpha (w) color.xyz = avg; // Return the final color return color; }