Page 1 of 1

Error importing Mathematica graphics

Posted: Mon 15. Mar 2010, 11:14
by ndroock1
I found no testcase in test-io.de.jreality.reader.mathematica. Is the import of Mathematica graphics ( still ) supported? If so, could you please provide a ( minimal ) testcase?

Re: Import Mathematica graphics

Posted: Mon 15. Mar 2010, 19:26
by steffen

Error when importing Mathematica graphics

Posted: Mon 15. Mar 2010, 20:46
by ndroock1
steffen wrote:A simple example can be found at
http://www3.math.tu-berlin.de/jreality/ ... a_graphics
I tried this earlier but didn't work.
Exactly as in the wiki I created the sinus.m file.
I tried to load the graphics using 'Load Content' menu option in the viewer.
Then in my Mathematica Workbench (=Eclipse) console i got the following message:

initing gl
graphics3D
line 1:12: unexpected token: Graphics3D

I have the last jReality version loaded from subversion. I have seen many files including grammar and parsers for a Mathematica Reader but unexpectedly no JUnit tests which explains my question.

I created the file with Mathematica 7, have tried Mathematica as well, same result.

Re: Error importing Mathematica graphics

Posted: Mon 22. Mar 2010, 20:39
by gunn
I think there may be an error on the page

http://www3.math.tu-berlin.de/jreality/ ... a_graphics

To write out the mathematica graphics object, use the following:

Code: Select all

g >> C:\sinus.m
instead of

Code: Select all

Graphics3D[g] >> C:\sinus.m

Re: Error importing Mathematica graphics

Posted: Thu 25. Mar 2010, 16:12
by paul peters
The Mathematica Graphics3D Format is quite complicated and changed completely in version 7 (or 6???). The Mathematica import might work for same input, but it does not work for all input.

Try to export from Mathematica to the JavaView format (.jvx) (see guide/3DGeometryAndModelingFormats in the Mathematica Help Browser) which you may then import into JReality. At least for me that worked.

If that works for you let me know. We should then add this to the Wiki page.

Re: Error importing Mathematica graphics

Posted: Sat 27. Mar 2010, 18:38
by ndroock1
paul peters wrote:If that works for you let me know. We should then add this to the Wiki page.
Yes, using Export to a ".jvx" file of a graphic in Mathematica I managed to load the content in the jReality viewer. Amazingly cool.

Thanks.

Re: Error importing Mathematica graphics

Posted: Thu 1. Apr 2010, 20:48
by paul peters
Thx for checking. I updated the tutorial:

http://www3.math.tu-berlin.de/jreality/ ... a_graphics

and also checked the export/import of Graphics3d (via test.m) with Mathematica 7. It worked.

Re: Error importing Mathematica graphics

Posted: Wed 16. Feb 2011, 12:58
by srossegg
Using the jvx format from Mathematica is great! I see colors and one can use multiple "graphics styles".
But, although I can see different colors in the jReality viewer, exporting it to the "u3d" or "pdf" format just results in "blue surfaces".

However, when I used the old parser with the '.m' format, the export of the color into 'u3d' format worked perfectly.

Any ideas?

Re: Error importing Mathematica graphics

Posted: Wed 16. Feb 2011, 19:44
by sechel
Hi srossegg,
can you provide us with a jvx file you exported and that produces the false colors when exporting? This would be helpfull.
Stefan

Re: Error importing Mathematica graphics

Posted: Thu 17. Feb 2011, 10:41
by srossegg
Hello,

I recreated the jvx file with Mathematica80, which didn't work (see TPC.jvx).
The import of the m-file (not attached) shows the colors when exported to pdf, but unfortunately one can't use "Polygon" structures when using this kind of wrapper.

Since I have your attentation, I could also ask for a more "complicated" shading e.g.

nut = SphericalPlot3D[1 + Sin[15 \[Phi]] Sin[10 \[Theta]]/10, {\[Theta], 0, Pi}, {\[Phi],
0, 2 Pi}, Mesh -> None, ColorFunction -> "PlumColors"]
nut >> nut.m
Export["nut.jvx", nut]

In this case (see nut.jvx), both exports to pdf do not include the color which is shown in your viewerApp. But I guess this one is more complicated ...

Thanks!

Re: Error importing Mathematica graphics

Posted: Sat 19. Feb 2011, 14:26
by sechel
Hi srossegg,
u3d merges the appearance of the material with that of the vertex colors. In jReality vertex color have the priority and overwrite the material behaviour. Please set the Appearance of the geometry to have a white diffuse color to see the vertex colors of your mesh. There still seems to be some bug in either in the export or in the adobe renderer regarding vertex colors. The diffuse and specular lighting is off when using vertex colors.
Hope that improves the sittuation.
Stefan