03-09-2020, 10:54 PM
Hi Jaume!
I am glad to help you with your project to which you are dedicating effort.
A raster effect consists of any visual effect achieved by modifying the rendering parameters of any element (layer or sprite) in the middle of a screen refresh. In the current graphic systems, the entire scene is first painted in an off-screen buffer (framebuffer), and then the result is presented at once. But in 2D consoles / arcades it is not like that. There is no framebuffer, the image is built line by line in real time, synchronized with the monitor retrace. There is a precise synchronization between the CPU and the retrace, with which it is possible to make adjustments in the image generation at the scanline level. This feature is what emulates tilengine. It not only allows you to change the position, but any setting: palette, scaling, etc. For example, Super Nintendo simulated 3D projection by altering the scaling factor in each scanline in mode 7. Mode 7 alone only allowed to rotate and scale a single layer, the famous 3D effect was achieved with raster effects. The "Mode 7" example of tilengine does exactly that. Another very common effect was to simulate the color of water in scenarios that were partially submerged (such as the Sonic). There are many creative applications.
You can achieve glitch effects, horizontal distortion or vertical synchronization errors playing with the x,y values of the element to be distorted, within a horizontal retrace callback. You have the flexibility to apply it only to the elements you want.
If what you want is to distort the entire screen equally, then that would better be a post-processing effect such as CRT, which is outside the scope of what tilengine pursues. In that case it would be better to implement it as a shader in the GPU at the end of everything.
The "wobble" effect as such can only be done with a tile layer, since it uses a feature called "column offset" that allows you to shift the vertical position of each column of tiles. Only tilemaps have column notion, bitmap layers and sprites do not. But the horizontal distortion part of the effect can be applied to any element.
When I have time I will prepare a small example
I am glad to help you with your project to which you are dedicating effort.
A raster effect consists of any visual effect achieved by modifying the rendering parameters of any element (layer or sprite) in the middle of a screen refresh. In the current graphic systems, the entire scene is first painted in an off-screen buffer (framebuffer), and then the result is presented at once. But in 2D consoles / arcades it is not like that. There is no framebuffer, the image is built line by line in real time, synchronized with the monitor retrace. There is a precise synchronization between the CPU and the retrace, with which it is possible to make adjustments in the image generation at the scanline level. This feature is what emulates tilengine. It not only allows you to change the position, but any setting: palette, scaling, etc. For example, Super Nintendo simulated 3D projection by altering the scaling factor in each scanline in mode 7. Mode 7 alone only allowed to rotate and scale a single layer, the famous 3D effect was achieved with raster effects. The "Mode 7" example of tilengine does exactly that. Another very common effect was to simulate the color of water in scenarios that were partially submerged (such as the Sonic). There are many creative applications.
You can achieve glitch effects, horizontal distortion or vertical synchronization errors playing with the x,y values of the element to be distorted, within a horizontal retrace callback. You have the flexibility to apply it only to the elements you want.
If what you want is to distort the entire screen equally, then that would better be a post-processing effect such as CRT, which is outside the scope of what tilengine pursues. In that case it would be better to implement it as a shader in the GPU at the end of everything.
The "wobble" effect as such can only be done with a tile layer, since it uses a feature called "column offset" that allows you to shift the vertical position of each column of tiles. Only tilemaps have column notion, bitmap layers and sprites do not. But the horizontal distortion part of the effect can be applied to any element.
When I have time I will prepare a small example