How to make efficient dynamic mask in starling - actionscript-3

I'm trying to make an interactive book for tablets with animations and page flip.
I'm using starling framework.
My idea of page flip is to mask 2 instances of next page with 2 static quads which are moving and rotating (it works great on pc/mac, but slow on tablets).
Using PixelMask is slow/very slow(10-20fps). Using clippedsprite is fast(40-50fps) but cant rotate the mask.
Are there any other options?
EDIT:
During my search I've found the idea of shaders (AGAL in ActionScript3), but I'm not familiar with this. Is it possible to simulate masking by the use of GPU shader?
EDIT2:
This problem was experienced on iPad1, on iPad3 its 60fps :) Dont know how its going to work on iPad2 and iPad4

I'm pretty sure AGAL is the ultimate answer!
But easiest, and still very good, solution is the smart use of ClippedSprites
(Sprites with clipRect since Starling 1.3+)
I've managed to achieve almost static 60 fps on iPad1.
Just needed to remove filters and stop/flatten animations inside Objects!
Filters are massive performance killers!

You can find here a mask class based on FragmentFilter. i got better results with it. But if you want to implement a PageFlip, you can use this class. And here is an improved version of the pageflip with interactive corners. Hope it helps you :D

Related

How can Cocos2dx particle system achieve a burst effect?

I am new to Cocos2dx, and I am playing with the awesome particle system in my game. However, I couldnt able to design the best effect in my mind.
What I would like to see is something like in this video.
I think the main difference is that I cannot configure to let all the particles appear at once and disappear at the same time afterward. The particle generation time seems to be random.
So my questions will be: Is there any workarounds that I can configure the effect like that link in Cocos2dx? Or is there any other suggested ways for me to stick with?
I have another solution in my mind which is use sprite animation instead. But then it will lose the flexibility. I love a configuration approach similar as particle system that can easily create different visual effect by only changing parameters.
Any help will be appreciated!
Thanks!
You can download Particle Editor for Cocos2dx and V-play from below link:-
http://games.v-play.net/particleeditor/
also you can show a demo here for various particle effects:-
https://www.youtube.com/watch?v=6wUrf_veEvU

Add glow to Image (Actor) in LibGDX

Is it possible to add a glow to the outline of an Image? I know I can do this by adding an additional "glowed" version of the image and switching to it when desired, but since there are many different shapes in my game, I would prefer the glow to be done programmatically. How can I do this?
As #Metaphore mentioned, shaders are indeed the best option I found. I've succeeded in adding an outline to any desired image in my game by following this article and by getting crucial information from asking a follow up question.
The only way to do this is to use your own pixel shader when drawing this particular image.
You can find a lot of glow effect shaders on the net and there are may tutorials how to use them as well. You may check official LibGDX article on this topic https://github.com/libgdx/libgdx/wiki/Shaders
However, I'd not recommend you follow that way, because using different shaders for drawing single images will make you render cycle code much more complicated and less optimal. So either you will compromise on it, or just find easier way to achieve such behavior without shaders (I mean draw it statically somehow).

animate images without using spritesheet in cocos2d-x

1.) I want to animate images in Cocos2d-x V2.2.3 without using spritesheet.
I
2.) Or please provide me the url of tool which can make spritesheet free of cost. I have used texturepacker and its trial has expired now :(
Spritesheets are really the way to go. TexturePacker is well worth the investment. Seriously.
If you dont want to use one, then your addFrameWithFileName() is incorrect now.
Just make normal Sprite out of each of those calls. There are other ways too.
Edit: Here is documentation: http://www.cocos2d-x.org/wiki/Sprite_Sheet_Animation

Is AS 3 capable of supporting a game with 600 + rotating images?

I made a simple game where squares collect crystals and bring them to a base and replicate. They are just .png images that rotate and move and yet when their number becomes greater than 500, the game starts to lag out. In Java I'm able to do a similar thing with 30,000 units. Could I be doing something wrong or is Flash just not that capable?
I'm using Flash Builder.
I get the image like this:
[Embed(source="../lib/red.png")]
public var redImgClass:Class;
public var redImg = new redImgClass();
Then I pass redImg to a "unit" class which takes an instance of "Bitmap"
I change its "rotation" and x,y members every frame.
Am I doing something wrong here?
you're not using Stage3D. If you use Starling, ND2D or write your own Stage3D wrapper you'll be able to get better performance.
You can also take a look at Jackson Dunstan's blog, this post is especially helpful: http://jacksondunstan.com/articles/2279
Another possible answer is to use blitting, that is, use a single Bitmap object to draw everything on via copyPixels(). This requires that your rotating crystal PNG be replicated into a sequence of rotated images, which you then use instead of directly changing rotation property. This approach is more performance-friendly, and does not depend on video card performance like Stage3D does.
Adobe's manual on blitting
Some discussion on blitting done by game devs
Daniel's answer is correct in that you should use the Stage3D APIs for greater performance. He didn't however mention that you should seriously consider using Starling, which wraps the Stage3D API with much easier to use classes:
Learn more about Starling here.
Example of the level of performance you could expect from Stage3D.
Starling is what you`re looking for (http://gamua.com/starling/)

As3 3D - Ink drop spreading in water

I'm researching the following problem:
Let's say I have a glass of some fluid (water for example). The fluid is completely transparent and I don't have to render it at all.
However a ink drop is dropped in the glass and it's spreading in the water.
The whole thing should be 3D and user should be able to rotate the camera and see the spreading in real time.
I have researched a couple of way to approach this problem, but it turned out that most of them are dead end.
Тhe only approach that has some success was to use enormous amount of particles which form the skeleton of the "inc spread". The physics simulation of the process of spreading is far form perfect, but let's say it's not a problem.
The problem is the rendering part.
As far as I know I'll not be able to speed up the z-sort process greatly by using the flash GPU acceleration, because the upload of those particles to the GPU memory every frame is quite slow?
Can somebody confirm that please?
The other thing that I'm struggling with is the final render. I tried a whole bunch of filters in combination with "post process" techniques to create smooth lines and gradients between the dots, but the result it terrible. If somebody know some article that could help me with that I'll be very grateful.
Overall if there is another viable approach tho the problem please let me know.
Thanks in advance.
Cheers.
You should probably look at Computational Fluid Dynamics in general to get a basic understanding. This should make it easy to play with actionscript implementations like Eugene's Fluid Solver, either in 2D or 3D, tweaking fluid properties to get the look and feel you're after