How do you use the GPU for 3D rendering in an Adobe Air app - actionscript-3

I'm playing with Air and trying to get the PaperVision3D engine to display some 3D models.
But its really slow since Air seemingly does not support GPU acceleration. Any way to enable GPU rendering in air apps? browser apps can use "wmode=gpu" in the HTML settings...

I think you'll need to wait for molehill, http://labs.adobe.com/technologies/flash/molehill/
the current hardware acceleration is pretty limited.
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3_Flex/WS2E9C7F3B-6A7C-4c5d-8ADD-5B23446FBEEB.html
there is some info at the bottom of the page there
Direct and GPU-compositing window
modes
Flash Player 10 introduces two window
modes, direct and GPU compositing,
which you can enable through the
publish settings in the Flash
authoring tool. These modes are not
supported in AIR. To take advantage of
these modes, you must enable hardware
acceleration for Flash Player.
Direct mode uses the fastest, most
direct path to push graphics to the
screen, which is advantageous for
video playback.
GPU Compositing uses the graphics
processing unit on the video card to
accelerate compositing. Video
compositing is the process of layering
multiple images to create a single
video image. When compositing is
accelerated with the GPU it can
improve the performance of YUV
conversion, color correction, rotation
or scaling, and blending. YUV
conversion refers to the color
conversion of composite analog
signals, which are used for
transmission, to the RGB (red, green,
blue) color model that video cameras
and displays use. Using the GPU to
accelerate compositing reduces the
memory and computational demands that
are otherwise placed on the CPU. It
also results in smoother playback for
standard-definition video.
Be cautious in implementing these
window modes. Using GPU compositing
can be expensive for memory and CPU
resources. If some operations (such as
blend modes, filtering, clipping or
masking) cannot be carried out in the
GPU, they are done by the software.
Adobe recommends limiting yourself to
one SWF file per HTML page when using
these modes and you should not enable
these modes for banners. The Flash
Test Movie facility does not use
hardware acceleration but you can use
it through the Publish Preview option.
Setting a frame rate in your SWF file
that is higher than 60, the maximum
screen refresh rate, is useless.
Setting the frame rate from 50 through
55 allows for dropped frames, which
can occur for various reasons from
time to time.
Using direct mode requires Microsoft
DirectX 9 with VRAM 128 MB on Windows
and OpenGL for Apple Macintosh, Mac OS
X v10.2 or higher. GPU compositing
requires Microsoft DirectX 9 and Pixel
Shader 2.0 support on Windows with 128
MB of VRAM. On Mac OS X and Linux, GPU
compositing requires OpenGL 1.5 and
several OpenGL extensions (framebuffer
object, multitexture, shader objects,
shading language, fragment shader).
You can activate direct and gpu
acceleration modes on a per-SWF basis
through the Flash Publish Settings
dialog box, using the Hardware
Acceleration menu on the Flash tab. If
you choose None, the window mode
reverts to default, transparent, or
opaque, as specified by the Window
Mode setting on the HTML tab.
Also Mike Chambers has some info somewhere about GPU acceleration (look for notes on pewpew), but I think this is all meant for mobile only.

Related

how to set AWS IVS Player to normal latency

According to Amazon IVS doucumentation,
Chrome for iOS, Safari for iOS:
Ultra-low latency playback is not supported. Normal latency playback
is supported.
So my streams' latency are around 2~5s,but Safari are always delay >15s.
I'm using pure web player to stream:
<script src="https://player.live-video.net/1.14.0/amazon-ivs-player.min.js">
In my scenario, although latency is important, but the simultaneousness is much more crucial than latency.Is there any way to force all the platforms to delay >15s?
When creating a channel, you can choose NORMAL latency mode instead of LOW (source). Most third-party broadcasting software also has an option to introduce intentional delay, if that's what you're looking to do. Example for OBS here.
Edit: You can also turn live low latency off in the player (except on iOS). Docs.

Canvas game heating up GPU but frame rate performance is smooth

I've been developing a game using HTML5 canvas for several months, and I've recently begun doing some of my development work on a macbook. In spite of a smooth frame rate of ~60fps, after a few seconds the game is pushing the macbook GPU up past 80 degrees C. I've also noticed on my desktop machine (which has a radeon 7870 video card) that after a while the GPU temperature rises and the fans kick in.
Considering it's a 2D game without any particularly fancy effects or too much going on, running at a reasonable resolution, this seems to indicate a major performance issue as it seems the GPU is being taxed a great deal. I'm already implementing many of the performance optimisations I've seen recommended (rendering at integer coordinates, no shadows, offscreen prerendering). Profiling the game reveals by far the most time is being consumed by the drawImage calls, but I'd expect a frame rate drop and/or other indications of lagging performance if this was the cause of the heat issue - but the framerate is beautiful on the macbook, there is no lag whatsoever.
To try and address this I've recently split the game into multiple layers and used pre-rendering to avoid unnecessary redrawing of layers, but this has actually made the frame rate significantly worse, and has not solved the heat issue at all. At this point I'm wondering whether any other optimisations I make will have any effect (eg. avoiding unnecessary fillStyle changes), or if I will be wasting my time?
I'll be grateful if anyone can provide advice or shed light on the source of this problem. A relatively basic 2D game should not cause this degree of GPU heat, and I ideally need it to be playable on laptops and lower-end devices, preferably without setting fire to them :)
Try a minimal project, like the project templates provided with most engines. Or just draw a sprite and nothing else. If this shows the same behavior, you can't do anything about it. It might also be an engine, driver or browser bug.
You have to consider that in Windows desktop the GPU typically is on idle and does minimal work to draw stuff. Even in a 2D game however all shader units etc run at full speed to provide the best possible performance. Only the latest models & drivers (hey, try a driver update!) allow the GPU to throttle in games when it determines that the game doesn't require the full performance to run at 60 fps. So even if it's a simple 2D game the GPU might still fire up because it enters "reroute all power to the shaders" mode.
Also note that 2D games are all essentially 3D games but with a fixed or orthographic projection. From the perspective of the GPU a 2D game is just another 3D game, it just so happens that the world is only translated along two axis at most.

AS3 slow webcam with 1080p on i3 laptop

I made an AIR application that uses the logitech c920 webcam for image capturing. The camera can display and record 720p and 1080p perfectly when I'm using the Logitech software. But when I use 720p in my AIR app there is obvious lag. Still useable, but annoying. 1080p is unacceptable in terms of lag. All this is on an i3 laptop. On my i7 desktop there is much less lag and I can do 1080p, but it's still not nearly as good as when I'm using the Logitech software.
The other odd thing is my older camera, the Logitech 9000 doesn't seem to work properly anymore in Flash or Air. The lag times are several seconds.
My questions are: (1) Do the logitech drivers use GPU acceleration to make the webcams work lightning fast even on a slow i3 computer while Flash cannot?
(2) Why does the older camera give such crumby performance now whether on the i3 or i7? Did Flash change how it handles cameras or something?
(3) Will the Flash Player be updated to allow GPU acceleration for webcams?
The simple truth is that Flash's performance is not good enough for realtime video applications.
Maybe lag would be better if you could attach your webcam to StageVideo (GPU decoding) instead of using the old Video class. Or you could simply lower the resolution...
If you want to develop realtime video applications you should take a look at Cinder, or OpenFrameworks instead. Both use C++ and performance is amazing. I have personally done projects involving 4k video on multiple monitors with Cinder.
Another option would be using Max MSP, much more powerful than Flash in terms of video performance, and you program visually using nodes and boxes.

Flash AIR app's (Desktop) performance considerably worse than same code compiled as Flash Projector

I've created a Flash application (AS3) in CS6 (Mac) that performs as expected when published as a Flash Projector. But when I publish as an AIR app (v3.4.0.2540) the app's performance is about 50% worse than the Projector. I set it to use GPU Hardware Acceleration, render mode is Auto. Are there other settings I should be using? The performance hits come at expected times (when using MOUSE_MOVE and ENTER_FRAME listeners), but it works fine in the stand alone player.
Setting render mode to auto will cause AIR to fall back to the CPU (see "renderMode"). If you are relying on the GPU (you didn't state whether you are or not but it is implied) this would likely cause significant performance degradation.
You need to set render mode to direct or gpu to take advantage of the GPU in AIR. I'm not entirely certain what the difference is but I've always used direct when working with Starling.
Another thing to consider with AIR: are you publishing a release build or a debug build? Debug builds perform considerably worse than release builds.

How much interacting can i get with the GPU with Flash CS4?

as many of you most likly know Flash CS4 intergrates with the GPU. My question to you is, is there a way that you can make all of your rendering execute on the GPU or can i not get that much access.
The reason i ask is with regards to Flash 3D nearly all existing engines are software renderers. However, i would like to work on top of one of theses existing engines and convert it to be as much of a Hardware renderer as possible.
Thanks for your input
Regards
Mark
First off, it's not Flash CS4 that is hardware accelerated, it is Flash Player 10 that does it.
Apparently "The player offloads all raster content rendering (graphics effects, filters, 3D objects, video etc) to the video card". It does this automatically. I don't think you get much choice.
The new GPU accelerated abilities of Flash Player 10 is not something that is accessible to you as a developer, it's simply accelerated blitting that's done "over your head".
The closest you can get to the hardware is Pixel Bender filters. They are basically Flash' equivalent to pixel shaders. However, due to (afaik) cross platform consistency issues these do not actually run on the GPU when run in the Flash player (they're available in other adobe products, and some do run them on the gpu).
So, as far as real hardware acceleration goes the pickings are pretty slim.
If you need all the performance you can get Alchemy can be something worth checking out, this is a project that allows for cross compiling c/c++ code to the AVM2 (the virtual machine that runs actionscript3). This does some nifty tricks to allow for better performance (due to the non dynamic nature of these languages).
Wait for Flash Player 11 to release as a beta in the first half of next year. It would be an awesome.