Java3D Loader Help: Getting Started

  • Context: Java 
  • Thread starter Thread starter the other guy
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on the challenges faced by a seasoned 3D modeler attempting to utilize the MS3DLoader in Java3D. The user has installed Java3D and the necessary JDK but is unclear about the steps required to integrate the MS3DLoader into their project. A suggestion was made to refer to the Viewer.java file linked on the loader's website, which contains a main method for initializing the modeler. Additionally, the user was directed to Sun's Java3D tutorials for further guidance.

PREREQUISITES
  • Java3D 1.5 or later
  • JDK 8 or compatible version
  • Understanding of Java programming fundamentals
  • Familiarity with 3D modeling concepts
NEXT STEPS
  • Review the Viewer.java file for implementation details of the MS3DLoader
  • Study Sun's Java3D tutorials, particularly the section on loading models
  • Experiment with the ObjectFile class for loading different 3D model formats
  • Explore error handling in Java3D to troubleshoot loading issues
USEFUL FOR

3D modelers, Java developers, and anyone interested in integrating 3D models into Java applications using Java3D.

the other guy
Messages
19
Reaction score
0
May I begin with the fact that this entire situation is suffering from a serious "where's the 'readme' file" complex

Ok, so I'm a seasoned 3d modeler trying to learn Java3d. I have java3d, the complimentary JDK, and this loader
http://www.duling.us/kevin/Java3D/Milkshape/index.html

Problem is, I don't know what to do with the loader. Everywhere I look on the internet just says to type in the appropriate code, and I do, but the thing is I can't find where I'm supposed to put the Loader.

I'm missing a step, and I can't find it via online search. The step between downloading the Loader, and inserting the appropriate code. Here is the sample code. It doesn't do anything, but it should work as far as the use of the Loader. What do I do wiht this MS3DLoader?

sorry for asking, but I totally seem to have either described my problem so poorly the internet can't help me- or ...i dunno, maybe I am depressed. the days are longer, ...i dunno.

import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.BranchGroup;
import com.sun.j3d.loaders.*;
import com.glyphein.j3d.loaders.milkshape.MS3DLoader;
public class core {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}

}
 
Last edited by a moderator:
Technology news on Phys.org
Maybe I misunderstand what your problem is, but on the page you refer to there is a link to a file Viewer.java containing a main method that takes the model filename as parameter and then seems to initialize the modeler. Have you tried that?
 
I'm also learning Java3D; however I haven't learned enough to implement a loader quite yet either. I assume you have looked at Sun's tutorials online but if not, I hope this helps: http://java.sun.com/developer/onlineTraining/java3d/j3d_tutorial_ch3.pdf. I believe your answer may be on p. 3-3 within example code line 21.

Code:
1. import com.sun.j3d.loaders.objectfile.ObjectFile; 
2. import com.sun.j3d.loaders.ParsingErrorException; 
3. import com.sun.j3d.loaders.IncorrectFormatException; 
4. import com.sun.j3d.loaders.Scene; 
5. import java.applet.Applet;
6. import javax.media.j3d.*;
7. import javax.vecmath.*;
8. import java.io.*; 
9.
10. public class ObjLoad extends Applet {
11.
12. private String filename = null;
13.
14. public BranchGroup createSceneGraph() {
15. // Create the root of the branch graph
16. BranchGroup objRoot = new BranchGroup();
17.
18. ObjectFile f = new ObjectFile();
19.  Scene s = null;
20.  try {
21. s = f.load(filename);
22. }
23. catch (FileNotFoundException e) {
24. System.err.println(e);
25. System.exit(1);
26. }
27. catch (ParsingErrorException e) {
28. System.err.println(e);
29. System.exit(1);
30. }
31. catch (IncorrectFormatException e) {
32. System.err.println(e);
33. System.exit(1);
34. }
35.
36. objRoot.addChild(s.getSceneGroup());
37. }
 

Similar threads

Replies
5
Views
16K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K