JavaFX graphics performance and suitability for advanced animations

Hervé Girod herve.girod at gmail.com
Fri May 31 15:10:25 PDT 2013


I don't know if there is the same behavior in JavaFX as in Swing, but using Swing for complex animated rendering of texts, we discovered that if we used the standard way of daring the strings in a Graphics2D, there was a kind of Jitter on each String when moving or rotating the texts, the letters seemed to move relatively to each other.

To avoid this effect, we used a TextLayout and cached the Strings Layouts when they changed and draw their outline Shapes. With this method, there was no Jitter at all. Perhaps this is the same case with the two methods you mention with these Microsoft links.

Herve

Sent from my iPad

On 31 mai 2013, at 22:57, Richard Bair <richard.bair at oracle.com> wrote:

> Felipe found these links:
> 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ee663563(v=vs.85).aspx
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd756767%28v=vs.85%29.aspx
> 
> I followed the 2nd link to run in Parallels. I'm not sure to what extent it is the same as what you'd see on dedicated hardware, but I thought it would be good for you to see what kind of options DirectWrite provides (and to know that Felipe is working on the DirectWrite backend for text rendering on Windows).
> 
> Running the "Default" rendering method gives predictably crappy looking animated text. Predictable in that MS is doing the same thing we are by default -- focusing on producing crisp text. Their crappy might be better or worse than our crappy, but in both cases it is crappy when animated :-). The "Outlines" method is very nice (and much slower). I couldn't run the A8 method on Parallels (it just didn't draw anything).
> 
> Give a play and see what the native system is doing. We need some kind of API (as linked in your JIRA issue) to allow you to easily pick which method you want.
> 
>> Perhaps it is a windows issue. Does seem like a few of the people reporting problems in this thread are on windows, and without those lovely high-res Mac displays that make everything look so pretty. On my machine there is no way you could say the jfx one is on par with the jscript one. I'd have a hard time convincing anyone to use jfx over even lowly jscript using that incredibly basic showdown I put together.   
> 
> We have a mix of systems but I personally have only a Mac + parallels (and when it comes to performance you really can't draw any accurate conclusions when running in a VM).
> 
>> How often do you personally run something like ensemble on windows? It could be that we're seeing big issues and you're seeing minor ones, hence out angst at how casually these issues are treated (two bugs I spent hours narrowing down and reproducing got closed in around 10 minutes - was the code run on the environment it was reported to be found on in this time?). Might be worth you having an eyeball just to see.
> 
> I know Kevin and Jonathan have Windows machines. But this is a good point we need to make sure we run on a similar environment.
> 
>> Regarding the Text vs Label thing, I'm not sure I get what that's about. My primary use with animations is to do ipad like transitions of rich widgets containing labels, buttons, tables, etc. So a panel of buttons might slide in left, a document might get folded up and put in a rubbish bin, or a dialog might grow out of a button that was clicked. Are you saying smooth animations are not intended to be used on complex node graphs like this?
> 
> Usually when animating a page of stuff, the best way to get good performance (on desktop and mobile) is to first set cache=true on the panel being animated, animate the thing, and then turn cache=false on the panel. In that case, you won't see any of these issues. But I think you are right that Labeled things should have a setting to indicate the way they render their text just like the Text node should.
> 
>>> JS is driving tis animation and not CSS?
>> 
>> Is this a question about the HTML I put up? If so then the answer is jquery is used to animate between a start css style and an end css style (just view source on the HTML, it's about 10 lines of code). How it does this you would have to look at jquery's animate method. I know as much about it's internals as I do about JFX's.
> 
> Right, my thought was whether the difference between what I see on Mac vs. what you see on Windows is based on the browser engine (but I tried chrome, so maybe not). When JS is driving the animation you often get different performance / behavior than when CSS is driving it.
> 
> Richard


More information about the openjfx-dev mailing list