Author |
Message |
mubeen
|
Posted: Mon Jun 06, 2005 8:46 pm Post subject: Blender and Java 3D |
|
|
I want to load a 3D image from blender to java and to do so i used the export feature in blender to convert the image to a format java recognizes. The image has a ".obj" extension. When i load an image from pre-done examples in java 3D tutorials it loads perfectly however when i try and load an image i made in blender to java after converting to obj i get this:
com.sun.j3d.loaders.ParsingErrorException: Unrecognized token, line 4
Java Result: 1
the parsing error
i thought that when u convert to an object file thats in a sense parsing but apprently not or i'm doing it wrong.
Any help is greatly appreciated. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Hikaru79
|
Posted: Mon Jun 06, 2005 9:37 pm Post subject: (No subject) |
|
|
I'm not familiar with either Blender or Java's 3D functionality, but I think I may be able to help you somewhat.
Quote: i thought that when u convert to an object file thats in a sense parsing but apprently not or i'm doing it wrong.
Not exactly. "Parsing" refers to taking input and breaking it down to extract all the useful data from it. In this case, you are "parsing" this object file to get all the information java needs to render it. When you look at it in that way, the error is pretty self explanatory. When Java parses something, it looks for predefined tokens in order to know where the information it needs can be found. The object file clearly was not in a format that Java was expecting, because four lines into it, it found something it couldn't understand.
In short, in order for us to further understand this problem, we'll need at least the first few lines of your .obj file. Like I said, I don't know anything about Blender so I'm assuming it's a plaintext file... if it's not, my apologies |
|
|
|
|
|
mubeen
|
Posted: Mon Jun 06, 2005 9:50 pm Post subject: (No subject) |
|
|
k well here is the fourth line where the error seems to be
import com.sun.j3d.loaders.Scene;
and for the first few lines of the object file, i dont know what you mean because its an image how do i get lines out of that???
i dont think the problem lies in the code but where i export the "whatever.blend" image into a "whatever.obj" image because it works for any other image just not the ones in blender so its not exporting right or something. |
|
|
|
|
|
Hikaru79
|
Posted: Mon Jun 06, 2005 10:34 pm Post subject: (No subject) |
|
|
mubeen wrote: k well here is the fourth line where the error seems to be
import com.sun.j3d.loaders.Scene;
and for the first few lines of the object file, i dont know what you mean because its an image how do i get lines out of that???
i dont think the problem lies in the code but where i export the "whatever.blend" image into a "whatever.obj" image because it works for any other image just not the ones in blender so its not exporting right or something.
With the fourth line being an import line, I'm pretty sure that's a clear sign that this library isn't added to your classpath. This is a VERY common problem as Java's handling of 3rd party libraries is anything but intuitive. Basically, it can't find the com.sun.j3d.loaders.Scene class, and although you may have it somewhere on your hard drive, you're not pointing to it correctly.
First of all, answer the following questions: What operating system are you using, and where did you save the .jar containing the Java 3d library? |
|
|
|
|
|
mubeen
|
Posted: Tue Jun 07, 2005 9:45 am Post subject: (No subject) |
|
|
dont think thats the problem because the image from the sun website works just gives problems when using blender images. |
|
|
|
|
|
rizzix
|
Posted: Tue Jun 07, 2005 2:12 pm Post subject: (No subject) |
|
|
yes its rather simple. either blender supports an older version of the .obj format or its implementation is incorrect. |
|
|
|
|
|
mubeen
|
Posted: Tue Jun 07, 2005 10:13 pm Post subject: (No subject) |
|
|
that can possibly be the case but what do i do about it?
Any one know how i can get around the problem or if someone knows Blender maybe they can help me out. |
|
|
|
|
|
Mazer
|
Posted: Wed Jun 08, 2005 9:56 pm Post subject: (No subject) |
|
|
Well, I really don't know what to say here... I remember exporting a model in the .obj format to use in another program for UV mapping around a year ago. I don't use Java, so I can't begin to try and find a way to make this work for you.
Why don't you see if there are other formats that can be imported to Java3D, and see if there's an export script available with Blender? I'm sorry I can't be more help to you.
If you're willing to write your own import code in Java to load a mesh as a list of xyz coords (and UV coords if you want), I can get you my Python script to export from Blender in the same way. It's nothing incredible, just easy to use. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rizzix
|
Posted: Thu Jun 09, 2005 2:15 pm Post subject: (No subject) |
|
|
ehm... .obj is the java3d object format.. so if there's anything wrong here. its with blender's export script. ya and coutsos that will do no good. he wants to import the file into java3d directly.
i would suggest you get a conversion program.. and export the object into a more common 3d format from blender.. then use the conversion program to convert it into a .obj format. |
|
|
|
|
|
mubeen
|
Posted: Fri Jun 10, 2005 8:17 pm Post subject: (No subject) |
|
|
thanx for the help guys but i think i'm gonna use the geometry class in java 3D to make my objects now. My "person" will now be made out of triangles, rectangles and spheres...lol
there isnt much time left for me to learn anything new as the project is due in three days i'll just use what i know of java 3D and get something working. |
|
|
|
|
|
Mazer
|
Posted: Fri Jun 10, 2005 8:43 pm Post subject: (No subject) |
|
|
Sorry I couldn't help at all, I just don't have any experience with the format (and Java3D). But for one last, hopeless, blind stab in the dark, why not try taking out the fourth line of the exported .obj file? ("o Bureau_Plane.001")
And also the line right before that. |
|
|
|
|
|
mubeen
|
Posted: Sat Jun 11, 2005 10:53 am Post subject: (No subject) |
|
|
yeah still gives me a parsing error, blender definately isnt doing something right or maybe i'm not doing something right.
thanx anyways |
|
|
|
|
|
|