I am using libgdx for some time now, and I have been asking myself for weeks now, if there is any suitable scenegraph implementation for libgdx. I do not mean the scene2d classes. I mean some graph function for 3d games. I searched a bit and did not find any...
Do you know any?
Currently there is no 3D scene. It might be added in the near future. However the new 3D api provides everything to load a 3D scene (see my loading a scene with libgdx tutorial). It is also possible to load scene physics if your like (see the bullet ImportTest). So practically for the actual rendering a Scene3D would only have to take care about frustum culling and multiple render passes (like shadow mapping). This can be as simple as an array of model instances or an entity system if you like.
Probably not, but it depends on what exactly you're looking for. See https://code.google.com/p/libgdx-users/wiki/scene3d
If you just want to optimize loading and share model resources when rendering, it looks like the new Libgdx 3D API (will be part of the 0.9.9 release, part of the current nightly builds) has some support for that: http://blog.xoppa.com/loading-a-scene-with-libgdx/#more-71
If you're just looking for something to organize your objects, there may be a generic Java scene graph library that you can adapt to Libgdx. Try 3D scene-graph library for Java?
Related
I am a semi-new OpenGL programmer, and am in the process of learning of how VBO's and Shaders interact with each other. I have a basic demo set up, and it imports the model and places a light in the scene. Now, in the future I would like to have physics, but my knowledge of JBullet is at a minimum. Should I implement the physics into it from the ground up, while learning more about rendering, or is it something I can add later, assuming my engine's framework is somewhat flexible to new API's?
Note: I am using LWJGL, and plan on using JBullet along with GLSL
Short Answer
Yes
Long Answer
Your Graphics code should be separated from any Physics code. In most engines, from Unity to UDK the Physics has little to do with your Graphics code. The only place where they connect is your game code when you do something like
Position = PhysicsObject.GetPosition();
DrawableModel.Draw(Position);
Some engines put higher levels of abstraction on top of this, like UDK with UnrealScript. Others like Unity behave exactly like this.
You might also want to have a look at a pattern or architecture called Entity Component System
I'm experimenting with JavaFX Scene Builder 1.1.
I've just placed a CubicCurve onto the canvas, resulting in this:
I'm able to drag the nodes and handles around, but I'm unable to find any documentation on how to add/remove nodes, create additional handles, etc. I've experimented with right-clicking and clicking on various parts of the shape while holding down Shift, Ctrl, or Alt, but this seems to have no effect.
Is it possible to visually manipulate CubicCurves in Scene Builder, and if so, how?
Also, is there any documentation for Scene Builder? I can seem to find only a few miscellaneous videos and guides, but nothing comprehensive.
Update
The final release of SceneBuilder 2.0 dropped the cubic curve manipulation capabilities which were available (but somewhat broken) in the SceneBuilder 2.0 preview and discussed in this answer.
The related issue tracker request for this facility is:
DTL-6598 Content panel should provide editing gestures for CubicCurve, QuadCurve, Polygon...
I'm unable to find any documentation on how to add/remove nodes, create additional handles
I think what you are actually trying to do is create a Path with multiple cubic curves between points on the path. To do that you would add CubicCurveTo path elements to a path. You could create such fxml by hand and SceneBuilder would display it, but SceneBuilder 1.1 does not have the ability to visually create paths. I just tried SceneBuilder 2.0 early release and it did allow you to visually create paths, but it didn't seem to work quite right, so I think that particular functionality is still a work in progress.
The rest of this answer relates to plain CubicCurves in SceneBuilder 1.1 (as opposed to CubicCurveTos).
Is it possible to visually manipulate CubicCurves in Scene Builder? I'm able to drag the nodes and handles around.
That's how you edit the curve. You click on the little square handles and drag them around to modify the curve start/end and control points. You click on the curve itself and drag it around to move the whole curve. The Layout section of the inspector panel also has StartX, StartY, ControlX1, ControlY1, etc. text fields that you can manually edit data in.
If you want to add more control points, you add a new curve (by dragging it from the shape library into the scene), then (here is the yucky bit) manually line up the curve endpoints and control points to smoothly join the two curve end points.
Here is a sample with the control points of two different curves highlighted.
Advice on Using SceneBuilder
SceneBuilder isn't really a drawing tool, its more a component assembly and layout tool. It is a tool that is designed to work with other tools rather than a comprehensive design and development tool in it's own right. It doesn't try to be an IDE to write code in, as there are many good Java IDEs for that. Nor does it try to be a vector drawing tool as there are many good tools for that.
If you have a lot of drawing to do, IMO, you are best off using a specialized tool such as Inkscape to create the raw vector graphic data and then use another tool to convert that to FXML (which you can load directly into either SceneBuilder or a JavaFX application).
JavaFX 1.x used to provided with a tool where you could directly export SVG data from Inkscape and it would output a JavaFX 1.x FXD based scene definition. But JavaFX 2.x unfortunately doesn't yet have such tools.
A similar drawing conversion tool for JavaFX would be an FXG to FXML converter which takes an Adobe Illustrator file and produces an FXML file usable in SceneBuilder.
If your input data is 3D models, then InteractiveMesh supplies 3D model to FXML converters you can use to import your models into FXML (which can then be utilized in SceneBuilder 2.0).
is there any documentation for Scene Builder?
There is a User Guide.
There is some more information on Scene Builder in the Oracle JavaFX Tutorials.
And some videos on Scene Builder at javafx.com.
The Scene Builder team occasionally blog about SceneBuilder.
If you find any more feedback on SceneBuilder documentation, email the JavaFX documentation team at:
jfx-docs-feedback_ww#oracle.com
I want to write a very simple Java 3D editor(for experiment). I know the basic JavaFX usage, and I know enough OpenGL knowledge. But all my OpenGL experience is from working with C/C++.
Could I make a 'canvas' in JavaFx application and map OpenGL viewport on it?
Internally, JavaFX can use OpenGL as a rendering pipeline, so some care on integration between the two is required to avoid conflicts.
OpenGLNode in JavaFX
Richard Bair, JavaFX team lead posted on the openjfx development mailing list:
One thing I want to see done (for example) for the 8 update is to have an OpenGLNode or NativeSurfaceNode or something along those lines so that if you are doing your own D3D / OpenGL you can have a way to send those raw commands down to the graphics card but still have your node composited in the scene graph.
So a future JavaFX release update might include an OpenGLNode.
Such a feature would probably not see inclusion in a JavaFX general availability release until the next JavaFX feature release after the initial Java 8 release (my guess is that would put it at about September 2014).
3rd Party OpenGL/JavaFX integration
You don't need to wait so long to start integrating JavaFX and OpenGL. All of the required source code to start an implementation is open in the OpenJFX repository, so you could try building a custom integration of that code with a library such as lwjgl or jogl.
This answer will get dated as developers start performing integrations of JavaFX with existing Java wrappers for OpenGL apis. Some developers have started such work already - run a google search of lwjgl javafx or jogl javafx to find out about current integration projects and their status.
The simplest integration is probably to have a 3rd party library render to an off screen buffer then transfer the pixels from the buffer to a JavaFX WritableImage or Canvas as required to get the OpenGL rendered graphics composited into the JavaFX scene graph.
JavaFX 3D API Alternative
JavaFX has its own lightweight 3D api that provides the ability to composite phong shaded 3d models into the JavaFX scene graph. The JavaFX 3D api is not going to provide all the power of a full OpenGL api integration, however using the JavaFX 3D api is relatively simple. A description, with code examples of the 3D features in Java 8 is on the open-jfx wiki.
Interactive Mesh provides a free 3D model importer for JavaFX, that allows you to very simply bring complex shaded and textured 3D models into a JavaFX scene graph.
There is a 3D Viewer project in the openjfx repository that you could fork to create a basis for your proposed JavaFX based 3D editor.
The nashorn JavaScript engine has a switch that allows you to use JavaFX and its 3D features from JavaScript, so you can use alternative jvm languages to access JavaFX 3D features if you prefer.
Yes, by all means, you can use JOGL to achieve effectively everything you could in Java with OpenGL as you can in C/C++.
You can use the OpenGLFX library, which mixes the previously mentioned JOGL/LWJGL and JavaFX. The code has the best performance available without changing the source code of JavaFX itself.
What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java?
I'd like to be able to do some prototyping of creating new types of interfaces for navigating within data and representing object graphs/relationships.
Low and no cost options are better. Open Source is also a plus.
UPDATE:
The higher level the api the better. Ideally I could set some properties (color, shape, etc) on my virtual object, register it with the visualization environment/engine, hook in callback functions...for example when a user hovers, clicks or double clicks on an object my code would get kicked off, and the visualization environment would handle the rest. So the rendering of the objects, navigation, zoom, user interaction would all be handled by the engine. Tall order probably, but this seems like it could exist as a reusable/generic tool.
Java3D is a pretty good 3d visualization in library. OpenGL is a standard 3d graphics library and JOGL is a port to Java.
Haven't done more than play with it, but you may want to look into processing. You could build some virtual objects, then pan around it with the mouse.
You might try JMonkeyEngine. It's higher level than Java3D and JOGL.
I'm getting started with OpenGL ES on Android and I'd looking to learn some techniques to have a game map larger than the visible area.
I'm assuming I've somehow got to ensure that the system isn't rendering the entire scene, including what's outside of the visible area. I'm just not sure how I'd go about designing this!
This is for simple 2D top-down tile based rendering. No real 3D except what's inherent in OpenGL ES itself.
Would anyone be able to get me started on the right path? Are there options that might scale nicely when I decide to start tilting my perspective and doing 3D?
There are many, MANY techniques for accomplishing this goal, but the base idea of what you are looking for is called Frustum Culling, that is not drawing anything the user isn't going to see anyway. Here and here are a couple of tutorials on how this works.