I have whipped up a quick and dirty PlayStation 2 ghosting/motion blur/frame blending effect!
## Creates a PlayStation 2-like frame blending effect.
##
## Add to _process(). The frame blending effect is applied to the area
## within the boundaries of the texture_rect node.
## It is recommended to only set the alpha to less than 1.
func frame_blend(texture_rect: TextureRect, alpha: float = 0.5, use_frame_post_draw: bool = true, viewport: Viewport = get_viewport()) -> void:
alpha = clamp(alpha, 0.0, 1.0) # Alpha values are 0 through 1
var image: Image = Image.new()
var texture: ImageTexture = ImageTexture.new()
image = viewport.get_texture().get_data() # FORMAT_RGBAH
image.flip_y() # Images start out upside-down. This turns it rightside-up.
if use_frame_post_draw:
yield(VisualServer, "frame_post_draw") # Changes the vibe.
texture.create_from_image(image) # Turn Image to ImageTexture
texture_rect.modulate.a = alpha # Changes the opacity of the frame blending
texture_rect.texture = texture # Applies the image of the last frame to the texture_rect
I've been very preoccupied lately. I apologize about the lack of game dev updates, but I've got a lot on my plate right now and those important things takes priority.
#gamedev #godot #lambgamedev #playstation2 #playstation1 #ps2 #ps1 #psx #indiedev