1

An old-school graphics effect is palette animation, where for an image of (say) 256 colours, the palette that each color index of 0-255 refers to is shifted. As it shifts, the colours of each pixel change.

You can read more about the technique here and see a fantastic HTML5 reproduction of old-style effects here. Here is a plasma example from Wikipedia:

Color cycling from Wikipedia

I would like to achieve the same effect in FireMonkey, using FMX TBitmaps or another inbuilt class. (I currently have TBitmaps - with static colours - built once-off from a table of values.) FMX is quite abstracted from the underlying OS, and also using underlying OS techniques will stop the app being cross-platform-compatible. On the other hand, since it uses DirectX or OpenGL under the hood, fast animation effects should be very possible. What's the best approach?

I am using Delphi XE2 (original FireMonkey) but a technique for anything up to XE4 (FMX 3) is fine too.

David
  • 13,360
  • 7
  • 66
  • 130
  • I believe that all modern graphics hardware uses a native RGBA (32 bit) representation inside the video card, there is no longer any palette left for you to "shift". You could generate a "particle effect" that looks like your example, but I doubt that you could directly emulate the exact palette-shift. You could however probably create an animation and put that in as a texture. – Warren P Dec 28 '13 at 18:27
  • A particle effect? Could you expand on that please? Possible ideas I had for how to do this include trying to create a 256-colour bitmap, and have a filter or shader every time it was drawn to the screen. Or, if I keep my table data and rebuild the bitmap image every animation tick step (that seems a *lot* of processing though.) Or... – David Dec 29 '13 at 14:41
  • Well your sample animation shows something that looks like a wave of particles, spreading, colliding, and gathering. By particle effect I mean you would simulate each dot in the image you wish to create, and these dots would interact (be entangled, attracted, repelled) by some set of rules you developed. – Warren P Dec 29 '13 at 18:49
  • A wide variety of shader examples here but I believe these are OpenGL not Firemonkey: https://code.google.com/p/delphi-shader/ – Warren P Dec 30 '13 at 00:00
  • Ok - thanks, but that example is just an example. The link includes examples of many other images made using the same technique. As for shaders, I remembered FMX can also use the GDI+ canvas, which has no shader support... – David Dec 30 '13 at 10:50

0 Answers0