Hello Haxe community,
I have to bid a project in a couple days and I am trying to figure out an approach and how much effort I will have to spend on image processing performance. I’m not sure how to target the GPU or even if I should.
I have tried to figure out where Haxe and OpenFL or additional libraries use hardware acceleration, but it is taking me too long. I’ve found a few image libraries, but again haven’t figured out if they use the GPU.
Thanks in advance for advice and pointing me towards articles/documentation.
The shortish version:
What is a good approach using Haxe and probably OpenFl to have very fast bitmap scaling for viewing and zooming in and out on individual very large (2GB) HDR images? This is for a kiosk application and I can specify the GPU, CPU, SSD, and amount of RAM as well as the monitor resolution—probably 4K maybe 8K.
Should I target the GPU or a CPU with many cores/threads (initiate multiple transform threads at once knowing that I will likely need one or more of them to zoom smoothly)? Would a game engine be overkill—that’s okay if it is fastest development path.
I’m quite new to Haxe and I haven’t yet figured out when the GPU is or isn’t targeted with Haxe and OpenFl. So far I have never directly used OpenGL or DirectX, so I am guessing that bindings such as OpenFl’s OpenGLRenderer might involve a greater learning curve than I have time for.
The touchscreen interface will need to be as minimal as possible, so I don’t need a lot of controls/components—at least not visible components.
The longer version—in case someone is curious and has plenty of excess time:
I need to figure out an approach for a potential touch screen kiosk application. I have done several kiosk projects using AS3/AIR to generate 64-bit Windows captive runtime applications. As a potential replacement for AS3/AIR/FlashDevelop, I started dabbling with Haxe, HaxeDevelop, and OpenFl back in March and then dropped it as other things took priority. Before dropping it I converted a small piece of an AS3/AIR kiosk application to Haxe/OpenFL and after much frustration was able to create a working EXE that utilized most of the common elements I tend use in kiosk applications.
The key aspect of this kiosk application will be to view large gorgeous HDR images on a 4K monitor (potentially 8K monitor down the road). A sample image I have is close to 2GB in size and has a pixel resolution of 12,752 x 19,136 (monitor will be in portrait orientation).
The kiosk needs to allow visitors to zoom from a scaled version of the entire image, down to having one image pixel to one monitor pixel, and any level in between. Visitors will also need to able to pan at any resolution. This needs to be done as elegantly as possible.
I have done something similar with aerial images of a city using AIR. I started with a few hundred large GIS aerial images shot at 0.5 ft per pixel and created around 20,000 images (2,000 x 2,000 pixels each) at 9 different levels of resolution (ft per pixel that is, ending with 128 feet per pixel), for zooming in and panning around the city. However, that zoom isn’t particularly elegant. From whatever resolution (feet per pixel) the viewer is on, I merely scale the current view of the bitmap(s), not the bitmap data, according to the amount of zoom, and then cut to bitmaps most closely matching the final resolution (ft per pixel) of the zoom. Zooming from the entire city view, down to street level view gives you a very ugly scaled up image while you are zooming in (spreading two fingers) until you let go and the new bitmaps appear. Zooming out leaves you with a lot of blank space as the area you are zooming out of gets smaller and smaller. Pulling images in for continual panning was plenty fast.
Note that in that project I did compress the aerial images, finding a tradeoff between speed of execution and image quality. This time I want to maximize image quality.
Also, this time I’m trying to avoid the pre-production of generating images at varying resolutions.
I can specify the computer hardware for the kiosk. It will be a Windows machine in part because I don’t have time to learn something else.
Repeating from above: I have never worked directly with DirectX or OpenGL and at this point I am hoping not to have to. I have tried to figure out where Haxe and OpenFL or additional libraries use hardware acceleration, but it is taking me too long. I’ve found a few image libraries, but again haven’t figured out if they use GPU. Also, as scaling will likely be my only transformation, I’m not sure if the libraries provide any benefit.
A few things I’ve glanced at along the way:
- Core Architecture
- bitmapData.draw() (this would be the multiple thread approach)
- Haxe “image” library with GraphicsMagick installed
- Haxe “bitmap” library
- Haxe “magic” library with ImageMagick installed
- Haxe “heaps.io” game engine
- Feathers UI
Again, thanks in advance for advice and pointing me towards articles and documentation.