|DMS Consulting | sitemap | log in|
I have been writing Java3D programs for many years but recently interest in J3D has waned. This is a great shame as it is very powerful software. Then I got an Android smart phone. This ran Java and OpenGL.
The Raspberry PI
Wanting to run my J3D programs on the PI, I wrote an API for OpenGL. Next I ported my Android J3d API to the PI and started debugging. A lot of the programs run but I ran into an OpenGL problem with the depth buffer.
The Story So Far
I have ported most of my J3D API and written some new code. I can now run most of my 3D library and have ported a lot of test programs. The 3D shapes, Cylinder, Cuboid, Cone, Sphere, Torus etc. work but some have strange artifacts on their surfaces. My animation routines run and Olympic Robot works. Textures look very strange, lighting is difficult, the curved shapes are not smooth and transparency (now called Opacity) does not work.
JavaFX 3D is an early release so bits are missing and others don't work. The main object drawing class is TriangleMesh. It was easy to implement the J3D routines TriangleStripArray, TriangleFanArray and TriangleArray except it does not support Normals. Instead it has FaceSmoothingGroups. I have been unable to find good documentation of this option but have copied code from the Sphere.java class. The following images compare JavaFX3D with Java3D. The first is JavaFX low res. The second is JavaFX medium res. The third is Java3D low res.
AmbientLight just does not work.
I tried to create ambient light using a cube of spot lights. This was the result. Only the first three of the eight lights work and you can't turn any of them off or on.
I need to read more about this class. At the moment, it seems you can only set Diffuse and Specular colors in the JavaFX Material. Java3D and OpenGL allow Ambient, Emission, Diffuse and Specular as well as Shininess. This may explain some of the strange texture colors I am seeing. Then again it might not.
My parabola test program has a display problem. There are white artifacts on the surface. Most curves surfaces have this problem. I am not sure what causes them (they are not from the inside surface as just displaying the outside still has them).
Transparency (or Opacity as it is now called) does not work if transforms are used. This feature is well implemented in J3D and OpenGL and is needed for water textures, disapearing objects etc.
Textures do not seem to display as expected. I am not sure what is causing this. It could be that only PointLight works. It could be the Material. The color definition in Material seems to have more affect on the texture than with J3D or OpenGL.
Backgrounds seem to be defined using CSS styles. So a background might be defined as pane.setStyle("-fx-background-color: white;");. This is fine for a fixed colour but how about a computed color. The colour can be defined #1f2f3f; but the class Color does not produce a hex String. Color.hashCode() produces an integer and the colours can then be extracted
My animation routines seem to work but there are so many problems with the lighting and textures that it is not easy to see what is happening. It is not worth trying to display them yet.
JavaFX 3D has a long way to go. Porting programs that are known to work is difficult because of so many problems. Writing new programs would be almost impossible.