aspose file tools*
The moose likes JavaFX and the fly likes Help skinning JavaFX 8 3D cube. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Help skinning JavaFX 8 3D cube." Watch "Help skinning JavaFX 8 3D cube." New topic
Author

Help skinning JavaFX 8 3D cube.

Jamie Coleshill
Greenhorn

Joined: Oct 18, 2013
Posts: 8

Hello I am new to this site and was wondering if someone could give me a hand with a short piece of code. I am using a triangle mesh in JavaFX 8 3D and trying to make a die, but for some reason the code below will not skin my cube. I have put a test cube beside it to see if it will go onto that one, which it does (but with the image repeated on each side, as is to be expected). However when I add the material to my custom shape, it will not work. My code is as follows.



If I leave my material off of my custom cube, it will show up. Any help would be greatly appreciated.

ADDED

I should also not that if I used the following material for my custom shape it will work, it is only when I try to add my custom skin to it that it will not work.

John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
Read through a thread on 3D in JavaFX and try out some of the concepts in the thread.

Then post back here with information on your results or further questions.


John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
Cross posted to:
http://stackoverflow.com/questions/19458444/skinning-custom-3d-cube-in-javafx-8

http://www.coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites
Jamie Coleshill
Greenhorn

Joined: Oct 18, 2013
Posts: 8

@John. Thank you for the links, I had already seen some of them. They helped a little bit, but did not solve the problem that I am having. I also did not know about the cross posting thing, so thank you for bring that to my attention. Its unfortunate that the JavaFX 3D aspects are so new because there are so few resources out there for them, and with it still being only beta, it is still subject to possible change.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
> but did not solve the problem that I am having

Yeah, hopefully somebody else can post a solution for you or provide further assistance.

> with it still being only beta, it is still subject to possible change.

See - FX 8 ramp down:
http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-October/010870.html

Basically JavaFX 8 is done and only major bugs will be fixed in it.
The underlying feature set will not change.

For future Java releases after the initial Java 8 release in March, further new 3D features and API could (and probably will) be added.

However, the 3D api and feature set of that is being shipped in the initial Java 8 release is finalized and will not be change pretty much forever (as this is Oracle's policy for Java runtime library compatibility).

> Its unfortunate that the JavaFX 3D aspects are so new because there are so few resources out there for them

Yep.

The only online tutorial I know is Getting Started with 3D graphics, which at the moment is just a slightly broken and incomplete app and accompanying sketchy documentation that does not cover the full feature set or stuff you want to know (like text mapping).

There 3D documentation on the JavaFX wiki I think was just used for helping provide information on very early development builds of the API to developers and is a bit outdated now.

That's the pain and joy of being an early adopter - it's kind of like and explorer, you get to find stuff out before everybody else, but you have to endure some hardships to do that.

You may want to try out the InteractiveMesh model importers:
http://www.interactivemesh.org/models/jfx3dimporter.html
There are numerous extensive sources of 3D models available on the internet which these importers can import into JavaFX scenes for some pretty awesome looking graphics that have high poly counts and nice texturing.
Jamie Coleshill
Greenhorn

Joined: Oct 18, 2013
Posts: 8

Got the answer to my question from PavelSafrata on Oracles OTN, the tex coords have to be proportional...
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
Please add a link to the solution Pavel provided on OTN so that others may find it.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
James Weaver provides a nice presentation treatment of skinning a 3D cube in JavaFX 8.
Ajem Jehi
Greenhorn

Joined: Sep 06, 2013
Posts: 10
John Damien Smith wrote:> but did not solve the problem that I am having

You may want to try out the InteractiveMesh model importers:
http://www.interactivemesh.org/models/jfx3dimporter.html
There are numerous extensive sources of 3D models available on the internet which these importers can import into JavaFX scenes for some pretty awesome looking graphics that have high poly counts and nice texturing.


The model importers do not work. I have no idea at what point they worked and at what point they became broken, but if you were to download and install the latest JDK 8 early access, which is build 114 as of last night, and if you were to download Oct 31st version of model importers or Tux Cube from Interactive mesh, you would get an exception and nothing would work.

World would be a better place if everyone stopped referring to the model importers as to something of value until August actually sat down and fixed them.

As to Jamie Weaver's presentation, it provides a few sketchy pointers. His PhongMaterial examples are workable. But where he talks about SubScene, he leaves lots of important details out.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 157
    
    9
> The model importers do not work.

The InteractiveMesh model importers and the FXTuxCube work fine for me (OS X 10.8, Java8b115, FXTuxCube 0.7.1, JFX3DModelImporters_EA_2013-10-31).

> As to Jamie Weaver's presentation, it provides a few sketchy pointers. His PhongMaterial examples are workable. But where he talks about SubScene, he leaves lots of important details out.

It's just a powerpoint from a conference presentation, not a reference doc. I found it to have some cute ideas and though and enjoyed perusing it.
Ajem Jehi
Greenhorn

Joined: Sep 06, 2013
Posts: 10
John Damien Smith wrote:> The model importers do not work.

The InteractiveMesh model importers and the FXTuxCube work fine for me (OS X 10.8, Java8b115, FXTuxCube 0.7.1, JFX3DModelImporters_EA_2013-10-31).


In build 115... Perhaps - I did not try the last build. I lost interest after continuously upgrading from b111 to 114 trying to get them to work (as I observed how the System requirements have been changing on the IM web site ever time reflecting the last available build without any changes to the linked file name FXTuxCube0.7.1.zip), but they kept throwing the same exception. This is happening on 3 different systems: Win 7 32bit, Win XP 64 bit, Linux 64 bit.



If August never changed the file since Oct 31, why did the system requirements keep changing from b111 (the earliest since I learned of IM web site) to b113 at present?

What command line are you using in fxTuxCube.bat? But then, I ran it from Netbeans as well after importing as project and recompiling so command line should not matter. Same exception regardless.
August Lammersdorf
Greenhorn

Joined: Dec 15, 2010
Posts: 7
Had already a longer discussion per mail with Ajem Jehi. For all other readers:

Due to incompatible API changes in the builds b112 and b113 (October 24, 2013) the model importers and the 3D applications had to be adjusted or at least to be compiled again, e.g.

<= build b112 : TriangleMesh.getFaces() returns a ObservableIntegerArray
>= build b113 : TriangleMesh.getFaces() returns a ObservableFaceArray

The following line is an indication that a b113-compatible importer is used on an older JDK 8 installation (<= b112):

Caused by: java.lang.NoSuchMethodError: javafx.scene.shape.TriangleMesh.getFaces()Ljavafx/scene/shape/ObservableFaceArray;


FXTuxCube 0.7.1, ModelBrowserJFX 0.2.2, and JFX3DModelImporters_EA_2013-10-31 require at least b113 (as stated on the web pages) and run also on b114 and b115 on all platforms, definitely.

Do the batch-files and NetBeans really run the application on b113+ and access the b113-compatible importer?

My JDK 8 is installed in P:\Java\jdk1.8.0\. jimObjModelImporterJFX.jar and fxTuxCube.jar are in the same folder as the downloaded and adjusted batch file:

P:\Java\jdk1.8.0\jre\bin\java -Xmx1024m -Djavafx.animation.fullspeed=true -Dprism.dirtyopts=false -cp .;jimObjModelImporterJFX.jar;fxTuxCube.jar org.interactivemesh.jfx.sample3d.tuxcube.FXTuxCube

Please, could someone else give some feedback.

August
Ajem Jehi
Greenhorn

Joined: Sep 06, 2013
Posts: 10
August Lammersdorf wrote:FXTuxCube 0.7.1, ModelBrowserJFX 0.2.2, and JFX3DModelImporters_EA_2013-10-31 require at least b113 (as stated on the web pages) and run also on b114 and b115 on all platforms, definitely.

August


I've emailed you the exception from recompiling on a b114 machine (WinXP 64bit), remember? This is not a version problem - this is code problem.



run:
August Lammersdorf
Greenhorn

Joined: Dec 15, 2010
Posts: 7
This case is the opposite of the first one. The exception

Caused by: java.lang.NoSuchMethodError: javafx.scene.shape.TriangleMesh.getFaces()Ljavafx/collections/ObservableIntegerArray;


indicates that the application is running on a JDK build >= b113 and is accessing a not b113-compatible importer.

The return type 'ObservableIntegerArray' is replaced since build b113 with 'ObservableFaceArray' (see former post).

On this particular system NetBeans still seems to refer to an old release of the importer when running the application.

Of cource, I still assume that my current downloads are b133-compatible. Otherwise John Damien Smith couldn't run these downloads on his b115 system successfully.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help skinning JavaFX 8 3D cube.