u3d conversion issue for spheres
Posted: 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
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