Marlin-Renderer and JavaFX

190 views
Skip to first unread message

mipa

unread,
Sep 27, 2016, 1:29:35 AM9/27/16
to marlin-renderer
Hi,
I would like to know whether the Marlin-Renderer can also be used for JavaFX. All paths in JavaFX are rendered in software and so I wonder whether this could also make use of the Marlin-Renderer. I tried Marlin with Oracle JDK 8 on a Mac from within Eclipse. It worked for a Java2D program (logging output) but I did not see any output for a JavaFX program.

Laurent Bourgès

unread,
Sep 27, 2016, 3:32:15 AM9/27/16
to marlin-...@googlegroups.com

Hi,

The Marlin renderer is for now only a java2d renderer: it implements the AATileGenerator interface to provide alpha coverages per tiles. Moreover, it performs path stroking based on a single stroke width.

As far as I know, JavaFX has its own interfaceS that gets the alpha coverage for the complete shape and uses 2 stroke widths: inner and outer widths.

It seems possible to port the Marlin renderer using JavaFX internal API but it will take time and I have not much spare time ! Maybe some fundings or sponsoring could convince me to dive into JavaFX.

Finally I will have a look at the JavaFX docs... to investigate how a custom renderer could be plugged in (like OpenPisces).

Cheers,
Laurent

Le 27 sept. 2016 07:29, "mipa" <m...@jugs.org> a écrit :
>
> Hi,
> I would like to know whether the Marlin-Renderer can also be used for JavaFX. All paths in JavaFX are rendered in software and so I wonder whether this could also make use of the Marlin-Renderer. I tried Marlin with Oracle JDK 8 on a Mac from within Eclipse. It worked for a Java2D program (logging output) but I did not see any output for a JavaFX program.
>

> --
> You received this message because you are subscribed to the Google Groups "marlin-renderer" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to marlin-render...@googlegroups.com.
> To post to this group, send email to marlin-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

mipa

unread,
Sep 28, 2016, 7:57:32 AM9/28/16
to marlin-renderer
I am a bit confused because my understanding so far was that Oracle is going to drop their proprietary renderer in favor of Marlin in Java9 and I doubt that they would keep it still in there just for JavaFX only. Have I misunderstood something here?
Michael

Laurent Bourgès

unread,
Sep 28, 2016, 3:15:54 PM9/28/16
to marlin-...@googlegroups.com

Hi,

Le 28 sept. 2016 1:57 PM, "mipa" <m...@jugs.org> a écrit :
>
> I am a bit confused because my understanding so far was that Oracle is going to drop their proprietary renderer in favor of Marlin in Java9 and I doubt that they would keep it still in there just for JavaFX only. Have I misunderstood something here?

Marlin / Pisces / Ductus are all java2d antialiasing renderers that plugs in the java2d pipeline (opengl / d3d / software backends only for texture / tile fills); non-AA use other renderers either accelerated or software.

JavaFX has its own Graphics stack based on prism to benefit from accelerated hardware (shaders...) as illustrated in:
http://docs.oracle.com/javafx/2/architecture/jfxpub-architecture.htm

2 things:
- ductus can be deprecated in java10 as you're right Marlin is in jdk9 the default java2d antialiasing render
- javafx is a new API (+native libs) that has its own renderers (es2 d3d java2d sw...) so it is a different thing,I would say, like java2d 2.0.

You could try setting prism in verbose mode or use the java2d backend:
-Dprism.verbose=true
-Dprism.order=j2d

Apparently the JavaFX j2d pipeline is more supported for on-screen rendering in javaFX 8... you could evaluate if j2d is faster than sw in your use case.

I agree JavaFX internals are quite complex and I am a newbie in that area.

Cheers,
Laurent

Laurent Bourgès

unread,
Oct 14, 2016, 3:58:01 AM10/14/16
to marlin-...@googlegroups.com

Hi,

I am pleased to announce the new MarlinFX project I released yesterday (GPL v2):
https://github.com/bourgesl/marlin-fx

MarlinFX is the JavaFX port of the Marlin renderer (scanline rasterizer only) aimed to be faster than Open/Native Pisces (notably for very complex paths).

I can not release binary builds as it needs patching JavaFX8:
"MarlinFX build produces a (big) JavaFX library patched with MarlinFX (com.sun.marlin + custom OpenPiscesRasterizer) to be placed in the boot classpath as JavaFX 8 lies in the extension classpath (and can not be patched easily). Of course, such (complete) JavaFX jar depends on your JDK version and your platform (win, mac, linux ...) so the MarlinFX jar can not be distributed (license issue) nor shared across platforms (incompatiblity)."
Tell me if you have any trouble with marlin-fx build.

I tested in on both linux & windows 64bits (server VM) and it is at least as fast as OpenPisces or faster (javafx shape rasterization is single threaded up to now).

For the DemoFX sierpinski test:
- native pisces = 130fps
- open pisces = 150fps
- marlin-fx = 325fps
This test renders a very complex path so marlin-fx rocks in hard rendering cases.
See https://github.com/chriswhocodes/DemoFX

Of course, there is lot of potential improvements in the JavaFX pipeline...

Enjoy and please give me your feedback if you try MarlinFX with your JavaFX applications,

Laurent

Michael Paus

unread,
Oct 14, 2016, 4:37:42 AM10/14/16
to marlin-...@googlegroups.com
That is great news. Do you already have some comparison figures between
MarlinFX
and the current standard Oracle JavaFX solution? You say that it is
currently still single-threaded
so I wonder whether it can be faster than the standard solution.
Michael

Laurent Bourgès

unread,
Oct 14, 2016, 5:07:47 AM10/14/16
to marlin-...@googlegroups.com

Hi,

> That is great news. Do you already have some comparison figures between MarlinFX
> and the current standard Oracle JavaFX solution? You say that it is currently still single-threaded
> so I wonder whether it can be faster than the standard solution.

Please try it and tell me MarlinFX is faster. I looked for JavaFX benchmark tools but only found DemoFX : marlinFX is 2x faster on the sierpinski test.

I contacted its developper and we will work together to improve DemoFX to become a benchmark.

If you are aware of other ones, please tell me.

Stay tuned,
Laurent

Laurent Bourgès

unread,
Oct 14, 2016, 5:19:05 AM10/14/16
to marlin-...@googlegroups.com
Another DemoFX test (stars):
- open pisces:
stars = 170 fps
- marlin-fx:
stars = 259 fps

=> 50% gain.

This test case is very simple: see https://www.youtube.com/watch?v=N1rihYA8c2M

Setup: laptop zbook-15 (i7 4800 + nvidia Quadro K610M) on ubuntu 16.4 + Oracle JDK 1.8.0_b102 (javafx) - VSYNC: OFF

PS: Later, I will see if I can enable multi-threading in JavaFX's shape rasterization ...

Laurent
Reply all
Reply to author
Forward
0 new messages