u3d conversion issue for spheres

Found a bug? Post here.
Post Reply
rhizod
Posts: 2
Joined: Sat 20. Sep 2008, 00:57
Contact:

u3d conversion issue for spheres

Post by rhizod » Sun 21. Sep 2008, 20:34

Hi,

Conversion to u3d from an imported simple vrml1 file with two spheres failed for me with jReality viewer SVN build from 2008-10-20. If I view the u3d in acroread (via pdflatex with move15; the only way I know for viewing u3d) I only see one of the two spheres.

I think I "solved" the problem by more or less trying random things in the code; in U3DSceneUtility.java, prepareGeometry(Collection<Geometry> geometry) I changed:
-----------------
else if (g instanceof Sphere) {
r.put(g, SPHERE);
}
------------------

To:
-----------------
else if (g instanceof Sphere) {
IndexedFaceSet p = SphereUtility.tessellatedIcosahedronSphere(2, false);
r.put(g, p);
}
------------------

I have however not enough insight into jReality code to know if the above change is "sane" or will lead to other problems, memory leaks or similar. Just view the observation that this fixes the issue as a help towards finding the "right" fix.

Below follows my vrml1 file:
==================
#VRML V1.0 ascii
Separator {
DirectionalLight {
direction 0 0 -1
}
PerspectiveCamera {
position -8.6 2.1 5.6
orientation -0.1352 -0.9831 -0.1233 1.1417
focalDistance 10.84
}
Separator {
Material {
diffuseColor 1 0 0
}
Translation { translation 3 0 1 }
Sphere { radius 2.3 }
}
Separator {
Material {
diffuseColor 0 0 1
}
Transform {
translation -2.4 .2 1
rotation 0 1 1 .9
}
Sphere { radius 1.2 }
}
}
==================

The otherwise great u3d conversion makes jReality extremly useful, thank you for making it available! Just FYI: my number 1 wishlist item for jReality is vrml2 import. (a lot of science software exports only in vrml2, and I have found no good vrml2->vrml1 converters...)

Best regards,
Rickard

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

Resolved

Post by sechel » Mon 22. Sep 2008, 11:42

Hi rhizod,
this should be resolved in the current svn build. It was a naming issue. The two spheres referred to the same geometry to keep the file size low.

sechel

rhizod
Posts: 2
Joined: Sat 20. Sep 2008, 00:57
Contact:

Post by rhizod » Mon 22. Sep 2008, 12:19

Great, thank you!

I figured the setup with reusing the sphere geometry likely was intentional, since it was done so explicitly in the code. Your fix vs. mine just saved a factor of 10 in filesize for my molecule u3d :)

But just so you know (if it isn't intentional) you have left a number of debugging statements on in the u3d export now.

//Rickard

Post Reply