• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java3D .OBJ loader

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
     
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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?
     
    reply
      Bookmark Topic Watch Topic
    • New Topic