I have one or more surfaces which are the render results of my engine, they’re blit to the main canvas with each render pass. I want to implement motion blur: The easiest way is by changing the alpha channel of the tile, I can easily do this with tile.set_alpha(127)
if I want each pass to be overlayed on top of the old canvas at half the transparency. But I want to make it so that brighter areas leave a trail across darker areas: For the result I want I need to set the grayscale copy of the image as the alpha channel.
How do I not only set the alpha value for an entire surface, but instead set the intensity of the image as its alpha channel? I looked at the documentation for pygame.Surface and pygame.Image but can’t seem to find the answer I’m looking for here. Note that the original image is “RGB” rather than “RGBA” so I presume I must also run tile.convert_alpha()
.