Java 3D™ meets JavaFX™
Java 3D meets JavaFX 2
In work.
Java 3D meets JavaFX
FXCanvas3D API : Java 3D Scene in JavaFX Scene ↓
FXCanvas3DMV API : Multiple 3D Scene Views ↓
FXCanvas3DImage API : 3D Scene as BufferedImage ↓
FXCanvas3DAnaglyph API : Stereoscopic 3D Scene ↓
Sample Programs
The samples on this page require: Java Plug-in JRE™ 5 (6 Update 18+ recommended) and Java 3D 1.5. If Java 3D isn't installed on your system yet, please use the 'incl. Java 3D' launch and applet links. See Java 3D home page on java.net for more information and downloads [Java 3D].
Mac™ user: please, check if the out-dated Java 3D version 1.3 is installed in System/Library/Java/Extensions/. It is advisable to remove all Java 3D related files (jar, jnilib).
Almost all programs provide 3D mouse navigation. The left button rotates, the middle button zooms, and the right button drags the scene.
Controls show tooltips with further details. The context menu (PopupMenu) allows to exit the application.
Current JavaFX Runtime: 1.3.1
Notes :
The PopupMenu may not be placed correctly on top of SwingComponents (Java 3D scene) or on Applets. Also the Tooltip may not be positioned accurately on Applets. Zooming the webpage once might help.
All 3D-models based on the external 3D file format VRML™ (*.wrl) were replaced with the successor format Extensible 3D (X3D™, *.x3d). The downloads include the new X3D-models and the corresponding importer API XModelImporter J3D. For more details see [here].
FXCanvas3D API
FXCanvas3D enables JavaFX to draw the Virtual Universe.
The FXCanvas3D API provides Java 3D rendering into lightweight components which can be added via a JavaFX SwingComponent to a JavaFX Scene. The synchronized access to the common 3D pixel data from within the parallel running rendering loops of the multi-threaded Java 3D and the single-threaded JavaFX engines is implemented differently.
Release 3.0 includes two implementations for lightweight 3D rendering in JavaFX:
- FXCanvas3DDB accomplishes synchronized writing and drawing of pixel data with the help of a double offscreen buffer. (This is the former class FXCanvas3D of release 2.0)
- FXCanvas3DSB only requires a single offscreen buffer for synchronizing the access to the pixel data. This saves the time it takes to copy the buffer data and results in a faster running 3D rendering and drawing cycle.
The basic sample program FXHelloCube is the ideal starting point for getting familiar with the integration of Java 3D rendering in JavaFX applications and applets.
Redistribution and use are permitted according to the standard Java 3D core utility copyright notice (BSD).
FXCanvas3D3.0.zip includes binaries, apidoc, sources, and license. [download]
Sample FXCharacterCube 5.1
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXCharacterCube5.1.zip [download]
Apply the JavaFX effects Bloom, GaussianBlur, or SepiaTone to the Java 3D scene. Pick a character or the cube by a double click of the left mouse button to center the 3D shape. Zoom in or out to change the size. Select one of the viewpoints to reset the scene.
Sample programs require font 'Lucida Sans'.
Sample FXDistortString 6.1
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXDistortString6.1.zip [download]
Dynamic positioning of the 3D characters' vertices creates the animated distortion. The JavaFX effect Reflection draws the reflected image. Play with its attributes to discover all facets of this effect.
The transparent control panel can be moved out and in again by exiting and entering the scene at the bottom or via the context menu.
The image-based gold texture is mapped onto the characters in two versions of conventional texture mapping.
The procedural wood texture is created and mapped by a vertex and fragment shader. The vertex shader also calculates the distorted vertex coordinates under the control of a Java 3D Behavior object.
The Java 3D programmable shading capability supports OpenGL vertex and fragment shaders. Running the wood texture in the program requires OpenGL 2.0/GLSL 1.10 or higher.
Sample FXScreenFlight 3.0 (self-signed certificate)
JavaFX Web Start 'size = screen' [launch] | [launch incl. Java 3D]
JavaFX Web Start 'size < screen' [launch] | [launch incl. Java 3D]
FXScreenFlight3.0.zip [download]
Fly across your screen!
A transparent stage (StageStyle.TRANSPARENT) and a transparent 3D scene background (-Dj3d.transparentOffScreen=true) allow to render 3D models on the desktop or in front of a window. Start and stop the propeller by a double click of the left mouse button or from the context menu.
Because a full-screen transparent stage requires high performance a second version of smaller size is provided. While dragging the aircraft the stage is moved instead of the model.
Sample FXHelloCube 2.0
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXHelloCube2.0.zip [download]
Entry point for integrating 3D rendering in JavaFX applications and applets. The implementation of a single and double buffer version of the 3D canvas is described within the source code.
FXCanvas3DMV API
FXCanvas3DMV supports multiple simultaneous views into Java 3D scenes.
As soon as Java 3D has rendered all attached and active views for a single frame JavaFX will repaint all corresponding SwingComponents in a single loop.
Redistribution and use are permitted according to the standard Java 3D core utility copyright notice (BSD).
FXCanvas3DMV1.1.zip includes binaries, apidoc, sources, and license. [download]
Sample FXTuxInTheBox 4.0
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXTuxInTheBox4.0.zip [download]
Six simultaneous views into a Java 3D box are assigned to six JavaFX Rectangles which build the faces of a box by applying the JavaFX effect PerspectiveTransform. Determine the direction and the speed of the continuous rotation by dragging the box. This application is using source code of the JavaFX sample 'VideoCube'.
FXCanvas3DImage API
FXCanvas3DImage provides the Java 3D scene by a BufferedImage object.
Redistribution and use are permitted according to the standard Java 3D core utility copyright notice (BSD).
FXCanvas3DImage2.0.zip includes binaries, apidoc, sources, and license. [download]
Sample FXPropellerPuzzle 5.0
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXPropellerPuzzle5.0.zip [download]
The Java 3D scene of an animated propeller engine is splitted into several puzzle pieces. The puzzle board is resizeable from 1x1 up to 11x11 pieces on a screen of 1200 pixels height. This application is using source code of the JavaFX sample 'PuzzlePieces'.
The engine animation, the viewpoint setting, and the 3D mouse navigation (on the puzzle board) are enabled even if the puzzle pieces are shuffled.
FXCanvas3DAnaglyph API
FXCanvas3DAnaglyph renders arbitrary Java 3D scenes stereoscopicly in JavaFX scenes.
Redistribution and use are permitted according to the standard Java 3D core utility copyright notice (BSD).
FXCanvas3DAnaglyp1.0.zip includes binaries, apidoc, sources, and license. [download]
Sample FXTuxInStereo 3.0
Anaglyphic glasses with red-cyan filters (left-right) are needed to see the stereoscopic 3D effect.
JavaFX Web Start [launch] | [launch incl. Java 3D]
JavaFX Applet [applet] | [applet incl. Java 3D]
FXTuxInStereo3.0.zip [download]
This sample allows to pick a part of the Tux body by a double click of the left mouse button to center the 3D shape. While picking, the left/red eye has to be closed to correctly target the desired part.
Reduce the standard interpupillary distance to ease and train your stereoscopic viewing. A short distance is also advised in case of moving Tux in front of your screen as shown in the image.
This stereoscopic 3D effect is a Java based implementation and isn't hardware accelerated. In consequence, the rendering performance may be less than the half of the monoscopic version. When rendering is switched to monoscopic mode the single buffer class FXCanvas3DSB is used (see FXCanvas3D API 3.0 above).