Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kernel Grayscale
- < namespace : "YourNamespace";
- vendor : "YourVendor";
- version : 1;
- description : "Converts an image to grayscale.";
- >
- {
- input image4 src;
- output pixel4 dst;
- void evaluatePixel()
- {
- // Get the RGBA color values of the source pixel
- float4 color = sampleNearest(src, outCoord());
- // Calculate the grayscale value
- float gray = dot(color.rgb, float3(0.299, 0.587, 0.114));
- // Set the grayscale value for each color channel
- dst = float4(gray, gray, gray, color.a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement