-
-
Notifications
You must be signed in to change notification settings - Fork 124
Description
An idea for a feature that allows one to replicate the Chrono Vortex visual effect.
Pixel Offest map defines coordinates of the pixel which colour should be used as a base colour to draw a pixel of the vortex animation. In theory, it can be warping, displacement, blast waves -- anything, but I'll stick to the name everyone recognizes with less explanation.
The Pixel Offest map should be stored as a regular SHP, so it can be animated.
As SHP is limited to 256-colour palette, there are two approaches possible.
Approach 1: definitely not the one you'll go with.
Two maps for two axes, horizontal and vertical offsets stored separately. Colour index in palette serves as the offset data. With 256-colour palette possible offset values are -128 to +127. For certain effects you can also use an offest scaling multiplier which, evidently, will multiply the offset from the map. Too expensive in terms of processing, but it should let you understand the reason for the stuff going further.
Approach 2: a bit faster one.
One map for two axes, just as in Normal maps in 3D modelling. 256-palette limits offset to -8 to +7 range for each of them (i.e. 4 bits per axis). Scaling is limited to 100%, 200% and 400% (might be larger, but this makes no sense). With 200% scaling applied we can use the fast calculation of the average colour value of 2x2 pixels square (4x4 for 400%) by adding together the colour values of those pixels by channels and then bit-shifting the results by 2 bits per channel (4 bits per channel for 400%).
What features should it also have?
It would be nice to just slap it on transparent animations with a flag in artmd.ini code of that animations.
Anything to start the investigation?
Ion Cannon ripple effect seems to have some sort of 'displacement' behaviour, @tomsons26 also noted "the ripple code is the closest to vortex".
Possible problems?
- What if renderer addresses the pixel out of map bounds?
- It might possibly need a separate 1-bit map to show the pixels in the animation affected, or a colour in the palette reserved for transparency so we don't end up having warping rectangles when scaling. (-8; -8) would fit nicely for this as the farthest offset (and less reachable position), but it's binary 1000 1000 in signed ints, isn't it?
- My crappy explanations :)