Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java3D .OBJ loader

 
Dávid Kéri
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Rancher
    Pie
    Posts: 42967
    73
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Not sure where the problem is, but maybe you'll find some simpler examples somewhere around here.
     
    Dávid Kéri
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks, already had my eyes on this page.

    Anyone else with a possible solution?
     
    Dávid Kéri
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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?
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic