


Hello everyone,
The above screenshots show my FantastiqUI project, which is a control aimed at using .swf movies in hardware accelerated environments like Irrlicht. This way you can use Adobe Flash to quickly build complicated user interfaces and load them into your game with just a few lines of code.
In the above screenshots you see 3 flash movies presented on a 3D billboard model and a simple interface made in flash. Full interaction (mouse/keyboard input) is possible with these billboards and the flash movies displayed on them.
This is my second post here about this project, over the past few months I completely rewrote this control, making it more optimized and fixing bugs that remained in the old control. Besides that I removed redundant code, to make the control easier to use. I will sum up some of the new and old features together with some technical details.
The idea of FantastiqUI is to use the Adobe Flash Player control through COM and render this control onto a texture so it can be used in a 3d environment. I started making this control for a 3D project I was working on that required an easy to edit GUI, since the only option for this was using scaleform, which was far too expensive to consider for that project, I started experimenting with using the Adobe Flash Player control on textures. The major advantage of this approach is that my control is much cheaper than Scaleform, yet the performance of my control is only a little bit slower than Scaleform in most situations. Besides that, full ActionScript support is retained.
Since performance is an important issue for 3D environments, I have implemented various features to increase performance. Only regions of the Flash Movie that require to be updated are redrawn to texture. For example, in a large flash movie, only the regions that actually change will be redrawn and uploaded to the videocard. Other regions will not be touched at all.
As a second measure to increase performance, flash updates are directly written from the internals of the Flash Player to the texture surface specified by the user. Therefore an intermediate windows memory surface is skipped. The code to do this copy is written in MMX/SSE2 dependant on which instruction set is available on the users processor.
Another problem I encountered when using Adobe's flash player control is that the transparency/translucency data is not 100% correct. In most cases, the alpha channel is fine, but with some movies, problems occur. These transparency glitches are also corrected by my control, in the SSE2 loop that moves the pixel data from the Flash Player Control to a texture.
When loading the flash control in a standard COM container, mouse and keyboard input will only work when the actual control is on screen. My control works around this limitation, which is very important, since when using Flash on a texture, you do not want to have the actual Flash control on screen.
The actual Flash Player runs in a secondary thread, for full communication with the flash player I implemented my own call funnel similar to the CoInterfaceStream() functions, only my implementation has different calling modes. It can either call asynchronously, returning immediately, with a return value that can be retrieved when the function call is complete. Or it can block untill the call has been made and return a value immeadiately. This is useful, since it means you can pass values (for example player position) to ActionScript without slowing done your rendering loop.
Besides that, it contains most of the usual features you see in Flash projector controls. It can load the Flash Player control from any path specified, or load the default flash control available on the system. Flash movies can be loaded from memory and from disk locations.
FantastiqUI is available for both .NET and C++ and any COM supporting language. I have made a special sample for Irrlicht, you can download it here. I fixed the bugs that were in the sample I posted earlier, and FantastiqUI should work correctly in Irrlicht now :
Irrlicht sample
For more information about this project, please take a look at http://www.fantastiqui.com
Regards,
Mathijs