Is there a 3D polygon in JavaFX (similar to QuadArray in Java3D)?
If there isn't what is the simplest way to create one? Creating two triangles?
If there is no simple way than should I use 3rd party 3D library? But that would beat the idea of using JavaFX in the first place.
I would like the abbility to switch between faces, wire-mode and verts-only-mode.
3D in JavaFX 2.x is pretty limited.
You can create a 3D polygon by creating a 2D polygon and performing a transform on it.
There are some 3D samples in the Ensemble application which demonstrate how to do this (with source code). There is a simple cube sample here.
With JavaFX 2.x, you could implement switches between face view, wireframe view and vertex only view with little difficulty. Other things like complex lighting, effects, mesh loading, realistic shading etc, would be more difficult and would be better implemented in JavaFX 8.
JavaFX 8 will have a much more robust and useful 3D implementation. You should evaluate the capabilities of the current JavaFX 3D demos in Ensemble as well as the proposed JavaFX 8 3D feature set against your requirements and other 3D libraries such as lwjgl to determine what will best fit your needs. Note, JavaFX 8 is not scheduled for final release until September 2013. Over time the proposed JavaFX 8 3D features will be added to the Java 8 pre-release.
I did create a simple 3D software renderer for a JavaFX ImageView which I might open source if interested - it renders bitmaps onto an ImageView though - not directly to the JavaFX scene graph primitives. A similar thing, but using a hardware renderer via the Java3D API was created by Interactive Mesh. Unlike JavaFX 8, it has the advantage of being available today.
Interoperability between JavaFX 2 and the main sets of Java bindings for low level 3D APIs (JogAmp and its main competitor quoted by jewelsea) is already partially implemented. When it is ready, you will be able to use the very latest version of Java3D (1.6.0, the instructions to install it are here) or any scenegraph supporting JOGL 2.0 including Ardor3D, JMonkeyEngine 3, Xith3D, ... There are already some applications mixing JOGL 2 and JavaFX in the same window but not in the same panel, for example Energy3D.
Experimental 3D shapes in JavaFX 2 are available in the jfx3D project at google code, also see my blog at designjk.
Jim Kay [jimbo8]
https://wikis.oracle.com/display/OpenJDK/3D+Features
JavaFX 8 includes a full 3D library. I currently am working with it, but it can be buggy + it's not even fully ready for dev's yet, or even close for the general release.
Related
I have an application written in in Java 3D. As Java 3D is now virtually dead I am thinking about converting the code to JavaFX (JavaFX 8 supports 3D objects).
The question is whether it is relatively simple to convert Java 3D code to Java FX code?
Are there straightforward counterparts of Java 3D methods in JavaFX or would it be more like a total redesign of the code?
Here is a little list of packages used in the Java 3D code:
javax.media.j3d.Alpha;
javax.media.j3d.Appearance;
javax.media.j3d.Behavior;
javax.media.j3d.BoundingSphere;
javax.media.j3d.BranchGroup;
javax.media.j3d.Canvas3D;
javax.media.j3d.GeometryArray;
javax.media.j3d.LineArray;
javax.media.j3d.PointLight;
javax.media.j3d.Shape3D;
javax.media.j3d.Switch;
javax.media.j3d.Transform3D;
javax.media.j3d.TransformGroup;
javax.media.j3d.WakeupOnElapsedFrames;
javax.media.j3d.WakeupOnElapsedTime;
javax.vecmath.Matrix4f;
javax.vecmath.Vector3d;
javax.vecmath.Vector3f;
Java 3D isn't dead, you're completely wrong as you can see here. There is a wide choice of scenegraph APIs more capable than JavaFX 3D API which is particularly poor in my humble opinion.
I don't know what gouessej is saying about Java 3D not being dead, there will not be feature development for Java3D going forward.
However he/she is correct that the base JavaFX 3D API is very lacking in features.
If you want to port your application to JavaFX 3D, you will have to rewrite the rendering portions to match the new JavaFX API. From the list that you provided only PointLight and Shape3D have DIRECT counterparts. Alpha transparency is an undocumented unsupported feature as of 8u40 that will get compiled into the official build for Java 9. The F(X)yz team has a demo of it working just fine but we had to recompile the platform from sources ;-).
You are not alone though, there is now free open source third party support via F(X)yz: (shameless plug....)
http://www.fxyz3d.org
I need to load a 3D model (.3ds file) in my QGLWidget (Qt OpenGL widget).
I am looking for a cross-platform solution working under Linux, Windows and Mac.
I have found some solutions on the web, but still have not been able to integrate any of them work in my Qt application:
Assimp: it is not cross-platform and does not support .3ds models
(http://assimp.sourceforge.net/)
Qt3D: it is cross-platform and seeems to be the right choice for OpenGL widgets. Unfortunatelly, I still have not find the way to use it.
(https://github.com/qtproject/qt3d)
Qt Quick: it uses QML files instead of QT widgets.
3ds Loader: http://www.spacesimulator.net/wiki/index.php?title=Tutorials:3ds_Loader
Any suggestion?
You can use Qt3D. It adds 3D content to Qt Quick's cross-platform ability. Apps can be 2D QML applications with a small amount of simple 3D content; through to complex 3D scenes, containing 3D assets - such as complex 3D models, and shader effects.
Qt3D supports 2D and 3D rendering in both Qt/C++ and Qt Quick applications.
You can also load a model object in 3D Studio Max (3DS) format or other standard formats like obj with a perspective camera view using Qt3D.
There are some good tutorials and examples here.
Assimp is written in C++ and used cross-platform in several projects including the Qt Project itself.
The .3ds format seems to be supported eventually unless you use a very old version where it was not added. See the documentation for further details about it:
Common interchange formats
Note the following entry at the top:
3ds Max 3DS ( .3ds )
Im interested in working on JavaFX for the first time. I have a project i am working on, in which i dont have a lot of time to complete. I was wondering if javaFX would be a great platform to animate and make a 3x3 rubik's cube game? With all the mouse movements and rotations, Without having to work out alot of linear Algebra.
Jelinek provides public domain sample algorithms and source code for creating a Rubik's cube in Swing/AWT. You could start with that and try converting it to JavaFX, possibly using a Canvas as the drawing surface.
The 3D capabilities in JavaFX 2.2 are quite limited. There are some samples you could look at in the Ensemble application to give you an idea of what it is capable of. There is a tutorial on the Ensemble 3D xylophone which should help provide much of the basic knowledge required to build your application.
Java 8 will have a much more comprehensive 3D feature set. Such an application would likely be much easier to implement in Java 8 than the current JavaFX 2.2 release. Java 8 is not due for final release until September 2013, but you can download a preview version of Java 8. The preview version does not currently fully implement all of the planned 3D features for Java 8, but does implement significantly more than the JavaFX 2.2 release, especially around concepts like 3D transformations, normal calculations, vector logic, etc which would be required for the implementation.
I'm seeking a dynamically updatable, "real-time" map visualization toolkit that would support the following concept:
A user-controlled pilot's eye view flying above a landscape where the topography is
dynamically changing (hills rising and falling, slip/sliding around, valleys opening and
filling) in real-time. (Currently just a color-coded landscape surface would be acceptable, although the eventual goal is to overlay terrain/map imagery.)
Another process is dynamically updating the landscape topography data
as our fearless flyer passes over it.
There's lots of 3D visualization "explorers" out there, but they all seem to either be limited to a static data set, or require that the dynamic evolution of the data visualizations all be calculated in advance and then strung together as an animation. And flight simulators of course all pretty much assume that the topography doesn't change while in flight.
Technical wishlist:
Linux
C API preferred, but open to C++ or Java (or Ada :-)
Free/Open source preferred, but will consider proprietary
Performance: Well, I'll try to work with whatever it's got
If C++ is ok, and you don't require something too high level, I'd HIGHLY recommend OpenSceneGraph for a project like this. I used it on a project several years ago to display various forms of geospatial data on a globe (vector coastline data, sat imagery, etc).
Do keep in mind you're not limited to writing your entire solution in C++ :)
Our 3D visualization app combined our C++/OSG 3D library for graphics, a Java front-end for the GUI, and some old fortran code for the serious number crunching :O
Currently I'm trying to develop some simple plot prototype and I'm struggling with some kind of white/empty sheet syndrome.
I'm back to Qt after 2 years, so I feel quite retarded.
My application should:
plot and manage custom layers of data
plot on custom canvas background
manage markers on plot
My plan is to use following design:
QGraphicsScene /View/Item as a sprite like management widgets for background, markers, pointers and other "bitmap" objects etc.
QPainter/ Qpixmap or QPicture for actual data layers - and if possible set them as QGraphicItem to simplify management of dynamic graphics
I don't want to use Qwt or similar library, unless I can plot with it on custom background (I don't like the look of the qwt's graphic style).
Is my plan proper in scope of qt class usage and composition?
I'd like to have at least clear overview of the classes which should be involved for this kind of prototype.
Thanks in advance.
P.
I think you have the basic idea with QGraphicsView. Here are a few resources which might help:
Graphics View
Diagram Scene
If you want to use the new animation and state set classes:
Stickman
Also, take a look at gunnar's labs blog. He recently did a series on graphics performance.
All of these are strictly Qt (animation and state set are in 4.6). They are in C++ but hopefully you can translate what you need to python.
You don't say much about your project for me to propose a more helpful answer, but have a look at the Qt demos involving the graphics view, especially diagram scene and 40000 chips. I think you will find them inspiring for what you want to do.
May be MathGL is appropriate for you. It have Qt widget or you can use RGBA image directly to combine it with any background in your widget.
I recommend you to use QCustomPlot which is a Qt C++ library. It focuses on making good looking, publication quality 2D plots, graphs and charts and also has high performance for realtime visualization applications. You get it here: http://www.qcustomplot.com/
You may want to take a look at the Core Plot framework. Core Plot is OS X specific, but it is built on the the OS X Core Animation system which has a lot of conceptual similarity to the Qt Graphics View Framework. You'll have to learn to visually parse the Objective-C (a less-than-two day process for any competent C++ developer), but you should be able to see the general architecture relatively easily. The Core Plot wiki has some nice high-level documentation that might set you on your way without even needing to look at the code.