aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java3D .OBJ loader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java3D .OBJ loader" Watch "Java3D .OBJ loader" New topic
Author

Java3D .OBJ loader

Dávid Kéri
Greenhorn

Joined: Oct 15, 2009
Posts: 12
Hey all!

I'm a newbie @ Java3D - just learning it. I need to load an OBJ file to view the model. After googleing it, I keep getting sent back to this code:

http://www.java2s.com/Code/Java/3D/ObjectFileLoader.htm

I managed to make it run on my comp, though I'd like to post a few questions...

1) is there an smaller, more basic code for this problem, that is easier for me to understand and learn from? I don't need applet and such..

2) I'm trying to load different OBJ files with this code, namely the following:
  • 2.a) GoogleSketchUp .dae -> converted to OBJ with MeshLab -> RESULT: OBJ file,where the basics are TRIANGLES
  • 2.b) 3D Studio Max -> converted to OBJ with 3ds -> RESULT: OBJ file, TRIANGLES
  • 2.c) 3D Studio Max -> converted to OBJ with 3ds -> RESULT: OBJ file, POLYGONS
  • 2.d) Blender -> converted to OBJ with blender -> RESULT: OBJ file, TRIANGLES
  • 2.e) Blender -> converted to OBJ with blender -> RESULT: OBJ file, POLYGONS


  • Overall result: the above linked code can load every OBJ, except the first type (2.a) ). Of course, that would be the one I'd like to work with...

    I was studying the code however, and got eyes on this piece of it:



    I think this is where the problem lyies, but not sure what is it..

    Any idea, observation is appreciated!
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 39576
        
      27
    Not sure where the problem is, but maybe you'll find some simpler examples somewhere around here.


    Ping & DNS - updated with new look and Ping home screen widget
    Dávid Kéri
    Greenhorn

    Joined: Oct 15, 2009
    Posts: 12
    Thanks, already had my eyes on this page.

    Anyone else with a possible solution?
    Dávid Kéri
    Greenhorn

    Joined: Oct 15, 2009
    Posts: 12
    Okay, I already managed to solve my original problem.

    The solution was to use Google SketchUp export to KMZ option, then extract the DAE from it, import it with Blender and export it to OBJ.


    Since my next question is still connected to JAVA3D + OBJ loader, I don't want to start a new thread, so I'm asking here;


    Does anyone have any idea if Sun's built-in Java3d Object Loader supports material colors and/or textures???

    The thing is that it works very differently every time I use it. Sometimes the obj loader just doesn't load up any textures or colors... Sometimes it loads up the textures fairly good, but messes up at a few faces...

    I checked the .OBJ file itself with several other programs ( like MeshLab), and its completely okay, working as intended. So the problem lies with the Java3d's object loader....

    Any idea please, anyone?
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Java3D .OBJ loader
     
    Similar Threads
    Best 3D option in an applet?
    Help load 3ds file for Java3D
    2D/3D Environments in Java: Where to start?
    Accessing resources in a JAR
    Graphics Software