Suggested framework for generic 3D demo software - java

My company has decided that we need a "generic" demo infrastructure for our technology demos, given that I can write this using JOGL or OpenGL and create my own framework, I'd hate to reinvent the wheel. But there are so many 3D gfx engines out there and so many OpenGL wrappers!
Basically, we want to use 3D graphics to render some terrain and put simple models on it.
Their requirements are for it to look great and be cross-platform.
Basically, I am free to decide the scope and paradigm this would follow but I was thinking:
- Be able to load 3D models and render them in full-screen or windowed mode.
- Be able to control the camera(s) to "fly" through the resulting scene.
- Be able to show/hide billboard messages on top of everything, i.e. 2D text and images that are fixed on the screen and always face the camera.
- Be able to change simple things about parts of the scene, such as making object appear/disappear, change highlight color (like paint in red), and such.
- I am optionally looking to write or use an existing scripting language to inject event handling and pre-programmed animations.
Sample use case:
- Someone at our company prepares a 3D model of terrain with some buildings, essentially generating an XML-like file describing the scene and its objects.
- He then proceeds to use my program to fly through the terrain and record a few camera positions "of interest".
- Then, he binds some of those positions to keyboard keys and/or existing GUI buttons.
- He adds some pieces of floating text.
- He presents a demo using my program, loads his 3D model file and script file and can start "flying" with the audience from one of his selected camera poses to the next, the floating text fades in and out as he arrives and leaves the camera positions... some buildings on the terrain highlight in red when he clicks a button... etc.
I have some OpenGL and JOGL, as well as XNA Game Studio experience.
I'd rather use Java so it can be as platform-independent as possible.
What should I do?

I'd recommend you take a look at OpenSceneGraph or Ogre. Both are cross platform (C++), feature rich graphics engines. Furthermore, they are commercially friendly licenses and are very mature and actively maintained engines.
I know that out of the box, OpenSceneGraph supports the loading of several model formats with one or two lines of code and there are several OSG libraries that already do a great job at managing and rendering terrain.
Otherwise, you'll be spending 95% of your time writing a niche engine rather than developing your visualization capability.

It's not Java, but otherwise what you describe sounds extremely close to the Open Source Virtual Terrain Project. You may well be better using that add contributing additional facilities you develop than starting from a more basic scenegraph level.

I advise you to use Ardor3D or JMonkeyEngine 3. Ardor3D has an excellent support of JOGL, it supports the Collada format, terrains, heightmaps, it is used by the NASA and in GIS applications, it is not a niche engine. Ardor3D even works on Android, it is one of the most cross-platform 3D engine.
I advise you to look at this demo showing a procedural terrain in Ardor3D:
http://www.youtube.com/watch?v=bkXFkxrYtLY

Related

OpenGl antialiasing in lwjgl (Minecraft)

Is it possible to have an antialiasing shader (if so how) , or is it only possible with fbos based on information below.
.
I am trying to add anti aliasing to the gui in Minecraft which runs off lwjgl.
I first came upon this https://www.youtube.com/watch?v=Pdn13TRWEM0
In which he talks about how to make antialiasing in lwjgl, But since minecraft uses another framebuffer,
Display.create((new PixelFormat()).withDepthBits(24).withSamples(8));
GL11.glEnable(GL13.GL_MULTISAMPLE);
Dosen't work
From there in another video he describes doing it with fbos
https://www.youtube.com/watch?v=HCBoIvVmYgk
Would this be the only way for me to implement anti aliasing, or is it possible an easier way.
Optifine allows for antialiasing, but it only happens within minecraft games
With no antialiasing a circle looks like this
Which game version and modding framework are you using? There are a few ways of doing this, I happen to know one for fabricmc on everything up from 1.17.
(disclaimer: this library is made and maintained by me)
https://github.com/0x3C50/Renderer is a rendering library for modern fabric, that includes a MSAAFramebuffer you can use to render things anti aliased. Just wrap your rendering code in
MSAAFramebuffer.use(samples, () -> {
// render
});

Screen Arrangement Control in Java

I am planning to implement a screen arrangement view for a desktop Java application. By screen arrangement view, I mean a view that allows to arrange several rectangles around a central rectangle, so that no gaps are allowed, much like the screen arrangement interface in eg macOS or Windows works:
The user would be able to drag the rectangles (except the central one) around and place them somewhere adjacent to another rectangle (that is connected to another rectangle that is connected to another rectangle .... that is connected to the central rectangle). The rectangles would automatically move to a correct spot if dropped at an incorrect spot.
I have experience in Java (Android), but little knowledge of User Interface design on desktop Java. I am using Swing for all UI I have already in my application.
I have done some research but could not find any similar implementation or question on SO.
However, I do not want to reinvent the wheel, so before I start implementing from scratch, I have these questions:
What search terms could I use for further research?
Are there any built-in components I could use as a base?
Is there maybe an open-source component I could use?
Does anyone know an implementation of such a control in any language that I could use as a reference?
How would you implement such a control?
Any help is highly appreciated!
1.What search terms could I use for further research?
One of the search term you can use is drag and drop (and that is what you plan to do).
2.Are there any built-in components I could use as a base?
Java has built in classes for drag and drop. Take a look here: Drag and Drop Turotial
3.Is there maybe an open-source component I could use?
I am sure there are quite a few if you try Googling it. But, personally I don't think you need an open source component to perform your required task. Java Swing already has pretty good classes available which is easy to use and more than enough to handle what you want.
5.How would you implement such a control?
Other than using the DnD from Java, a similar feature can be implemented using custom painting + various listeners such as Mouse motion listener. This way, you set what ever rules you want over the components that is being dragged / clicked / mouse-over. For example.

JavaFX and antialias

I am in the process of porting some graphics rendering from java/Android to standard java.
The first thing that I am faced with is - which graphics api to use, Graphics2D or JavaFX.
It was proposed by assylias in my previous question "Porting graphics drawing from android to standard java", that I use JavaFX.
I have seen that this has the advantage of taking doubles and floats as parameters for drawing, as with Android.
However, I have not been able to find anything which confirms that the drawing is antialiased, or that antialiasing can be turned on.
My objective is to generate a high quality image which will be directly saved to disk and not displayed in the application. It will be displayed in another context and not printed.
I need to be drawing text, paths, beziers, lines, ellipses and rectangles.
Is it worth my while digging into JavaFX or do I have no choice but to go with Graphics2D ?
Many (if not all) of the objects that are drawn in JavaFX applications already have antialiasing effect. This is visible to the naked eye. Try to write two identical applications, one in JavaFX, and another in Swing (without antialiasing effect of Graphics and RenderingHints object). The difference is clear, especially when drawing geometric shapes and text. Here you can find some comparisons between Swing and JavaFX, and here you can get to know better the JavaFX 2.X (read the subject "Graphics System" and "Media and Images").
Personally, I would prefer to use JavaFX technology. I previously used a lot Swing. Each of my applications had to be made in Swing. However, after seeing the practicality of JavaFX, its maintainability, its elegance and productivity, I did not think twice. Even if you just want to draw simple things, JavaFX seems to have a much better performance. If I'm not mistaken, JavaFX was developed taking into account the use of video hardware on your platform, and was also inspired by the famous game engines available for Java users, which are made to work with high processing visual effect, screen updates, and among many other things.
For you marvel a bit with the technology and effort that was put, I beg you, visit this address. Look for the download of a JavaFX program named Ensemble. You will find where is written "JDK 7 and JavaFX Demos and Samples". click download and use the demo program Ensemble.
For information on drawing text, geometric shapes and stuff, see the following links:
http://java.dzone.com/articles/javafx-21-beta-improved-font
http://fxexperience.com/2012/01/lcd-text-support-in-javafx-2-1-developer-preview/ (An alternative from the previous link)
http://docs.oracle.com/javafx/2/text/jfxpub-text.htm (Look for "Setting LCD Text Support" and also, with the feature of applying effects to text and various things of JavaFX, you can still improve the visualization of what is shown to the user.)
http://docs.oracle.com/javafx/2/api/javafx/scene/shape/Shape.html#smoothProperty (The "shapes part")
Would you like an opinion of a colleague? Adopt JavaFX in its version 2.X or higher (do not use the JavaFX 1.X). Over time this type of technology will mature. Much still come ahead. The next update of JavaFX, we will have many nice features. And notice that JavaFX is still in its version 2.X. Probably in the near future Swing library will be left out, as happened with the AWT. You better start now studying JavaFX, rather than only in the future you go familiarizing yourself. The market is there.
If you still have some questions, please come back and ask. We'll be here. :)
Good luck.

How do I develop Java games for phones?

How do I begin developing J2ME games for mobile phones?
Are any libraries available that can render pixel fonts for text? - for text games
Are 2D graphic libraries available that can draw animated bitmaps? - for isometric and tiled games
Any are 3D engines available with texture mapping & lighting? -- for racing and flying simulators
And regarding screen sizes:
What screen size to choose initially for good market penetration?
How to manage game source code, in different screen sizes? Make separate branches?
I'm new to J2ME programming, so any links you can give me to start off would be great.
Game Programming Crash Course to begin developing simple bitmap games.
Screen size of 240x320 pixels is where most j2me-enabled phones are these days.
Obviously, touchscreen phones usually have bigger screens than this. A VGA size of 480x640 is just around the corner for high-end phones.
Different screen sizes are usually handled by having generic code that can handle any screen size and can modify layout depending on in-Jar configuration files. You then simply make several jar files, all containing the same compiled code but different values in the configuration files.
For 3D graphics, a lot of phones these days support http://www.jcp.org/en/jsr/detail?id=184.
Recent Sony-Ericsson phones also have http://www.jcp.org/en/jsr/detail?id=239 which should be easier to use if you already know OpenGL. 3D performances vary widly between phones that contain a hardware accelerator chip and those that don't.
Animated bitmaps on J2ME usually means making you're own redrawing thread to refresh the screen. The only image format officially supported by the MIDP specification is PNG.
Because of this last fact, if you want to create your own pixel font, you are pretty much going to need to have each character in a PNG image.
You might want to look at LWUIT, an open source library published by Sun.
I know this isn't a direct answer to your question, but I think J2ME is slowly on the decline, and Android is taking its place. You may want to take a look at the iPhone as well, even though it's not Java. For the iPhone, you're looking at 480x320 screen size and you can use Cocos2D for the 2D games.
Also check out Kevin Glass's website, which has a lot of notes about 3-way instantaneous deployment to Applet, Android, and iPhone. More details are here.
There's this incredible list of open source J2ME libraries that do all sorts of things, like UI, Graphics, Games, 3D, Bluetooth, SMS, IM, Math, Security, Databases, XML .. even Dev Tools.
Java ME Open Source Software - ngPhone

Best way to get started on simple 3D user interfaces using Java?

I'm writing a time management application and I have an idea for presenting timelines and todo items in 3D. Visually, I imagine this as looking down a corridor or highway in 3D, with upcoming deadlines and tasks represented as signposts - more important items are larger and upcoming deadlines are nearer.
I want to do this in Java, however I have no idea how to begin. For example, I would like to be able to render text and 2D graphics (dates, calendars etc) on the floor/walls of the corridoor, as well as on task items. The tasks themselves could be simple blocks. However examples of 3D code I have seen all look to operate on a very low level, and what I can't figure out are the appropriate co-ordinates to be using, or how the user would be able to interact with the view by selecting items with the mouse (for example clicking an expand or info button to get/edit task properties with the usual swing components).
Is there any higher level API I could be using, or example code that does this sort of thing? Any other ideas for how best to approach this problem?
edit: removed Java3D requirement - I just need to do this in Java.
To be perfectly honest, most "clever" user interfaces are ineffective for a number of reasons:
They favor complexity (for the sake of coolness) over simplicity and usability.
They are likely to be totally unfamiliar to the user.
You have to implement them yourself without some library having done the hard work for you.
I think the interface you describe runs the risk of falling into this trap. What's wrong with the current interface? Won't it be really hard to get an overview due to foreground stuff getting in the way? Now of course you could take it a step further and zoom out/rotate to get an overview but that complicates things.
Having said all that, if you can make it easy to use and really slick, then it can make an application. Users will have a lower tolerance for failure in "fancy" UIs, so perhaps this isn't the best first 3D project.
I do think there is a need for more examples geared towards visualisation rather than games.
To be honest, having tried both, if you use JOGL instead you'll find there's tonnes of OpenGL examples to copy that sort of thing from, and you won't have to code around the limits of the scene graph Java3D gives you. I tried Java3D a couple of years ago in a simple wireframe viewer, and it was such a pain to get the camera control right and the rendering anywhere near OK that I gave up on it.
I've found Pro Java 6 3D Game Development to contain very good code examples.
Here's a code example of 3D text, from NeHe Productions!, check the "DOWNLOAD Java Code" and "DOWNLOAD JoGL Code" at the end of the example.
On a side-note, I was very impressed with LWJGL which makes you write in a very similar way to straight-forward OpenGL.

Categories