Error importing Mathematica graphics

Have jReality programming problems or questions? Post them here.
Post Reply
ndroock1
Posts: 5
Joined: Wed 10. Mar 2010, 22:31
Location: Rotterdam

Error importing Mathematica graphics

Post by ndroock1 » Mon 15. Mar 2010, 11:14

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?
Last edited by ndroock1 on Thu 18. Mar 2010, 23:03, edited 1 time in total.

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Import Mathematica graphics

Post by steffen » Mon 15. Mar 2010, 19:26


ndroock1
Posts: 5
Joined: Wed 10. Mar 2010, 22:31
Location: Rotterdam

Error when importing Mathematica graphics

Post by ndroock1 » Mon 15. Mar 2010, 20:46

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.

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Error importing Mathematica graphics

Post by gunn » Mon 22. Mar 2010, 20:39

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
jReality core developer

paul peters
Posts: 17
Joined: Thu 6. Mar 2008, 15:18
Location: TU Berlin, Germany
Contact:

Re: Error importing Mathematica graphics

Post by paul peters » Thu 25. Mar 2010, 16:12

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.
Paul Peters

ndroock1
Posts: 5
Joined: Wed 10. Mar 2010, 22:31
Location: Rotterdam

Re: Error importing Mathematica graphics

Post by ndroock1 » Sat 27. Mar 2010, 18:38

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.

paul peters
Posts: 17
Joined: Thu 6. Mar 2008, 15:18
Location: TU Berlin, Germany
Contact:

Re: Error importing Mathematica graphics

Post by paul peters » Thu 1. Apr 2010, 20:48

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.
Paul Peters

srossegg
Posts: 2
Joined: Wed 16. Feb 2011, 12:50

Re: Error importing Mathematica graphics

Post by srossegg » Wed 16. Feb 2011, 12:58

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?

sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

Re: Error importing Mathematica graphics

Post by sechel » Wed 16. Feb 2011, 19:44

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

srossegg
Posts: 2
Joined: Wed 16. Feb 2011, 12:50

Re: Error importing Mathematica graphics

Post by srossegg » Thu 17. Feb 2011, 10:41

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!
Attachments
examples.tar.gz
tar file content:
- nut.jvx
- TPC.jvx
(207.7 KiB) Downloaded 75 times

sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

Re: Error importing Mathematica graphics

Post by sechel » Sat 19. Feb 2011, 14:26

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

Post Reply