Page 1 of 1
Export In pdf3D
Posted: Tue 9. Mar 2010, 11:10
by Sebos2013
Hello all,
I'm trying to export a simple cube in pdf but I have a problem to export it in pdf3D.
The source I'm using is extract from the tutorial so I doubt there is a problem in it, but here is the code :
package de.jreality.tutorial.geom;
import de.jreality.geometry.PointSetFactory;
import de.jreality.plugin.JRViewer;
public class Cube01 {
public static void main(String[] args) {
PointSetFactory psf = new PointSetFactory();
double [][] vertices = new double[][] {
{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}
};
psf.setVertexCount( vertices.length );
psf.setVertexCoordinates( vertices );
psf.update();
JRViewer.display(psf.getPointSet());
}
}
and the error is :
U3D Export: prepare data...writing...done.
GRAVE [SoftViewer.renderImpl]: renderer.render() failed!
java.lang.NullPointerException
at de.jreality.backends.texture.SimpleTexture.<init>(SimpleTexture.java:75)
at de.jreality.backends.texture.SimpleTexture.<init>(SimpleTexture.java:72)
at de.jreality.backends.texture.SimpleTexture.create(SimpleTexture.java:327)
at de.jreality.softviewer.PrimitiveCache.renderSky(PrimitiveCache.java:206)
at de.jreality.softviewer.AbstractRenderer.render(AbstractRenderer.java:190)
at de.jreality.softviewer.Renderer.render(Renderer.java:78)
at de.jreality.softviewer.SoftViewer.renderImpl(SoftViewer.java:270)
at de.jreality.softviewer.SoftViewer.render(SoftViewer.java:166)
at de.jreality.ui.viewerapp.ViewerSwitch.render(ViewerSwitch.java:198)
at de.jreality.util.RenderTrigger$RenderTriggerSingleCaster.render(RenderTrigger.java:222)
at de.jreality.util.RenderTrigger.fireRender(RenderTrigger.java:138)
at de.jreality.util.RenderTrigger.finishCollect(RenderTrigger.java:260)
at de.jreality.toolsystem.ToolSystem.processToolEvent(ToolSystem.java:486)
at de.jreality.toolsystem.ToolEventQueue$1.run(ToolEventQueue.java:82)
at java.lang.Thread.run(Unknown Source)
What do tou think the problem comes from ?
PS : I'm under windows 7
Re: Export In pdf3D
Posted: Tue 9. Mar 2010, 14:13
by Andre
There are known problems with U3D.
Please look
here
We are working on it!
Re: Export In pdf3D
Posted: Tue 9. Mar 2010, 20:22
by Sebos2013
My problem is not exactly the same and even with adobe 8.2, the pdf is corrupted.
I tried ta add a skybox manualy like that :
JMenu menu = ((JMenu)app.getMenu().getMenu("File").getMenuComponent(5));
//((ViewerAppMenu)app.getMenu()).showMenuBar(false);
Appearance ap = app.getSceneRoot().getAppearance();
// basic class needed for both reflection maps and skyboxes is a CubeMap
CubeMap rm = null;
try {
rm = TextureUtility.createReflectionMap(ap,"polygonShader",
"ressources/reflectionMap/desert_",
new String[]{"rt","lf","up", "dn","bk","ft"},
".jpg");
} catch (IOException e) {
e.printStackTrace();
}
ImageData[] sides = TextureUtility.getCubeMapImages(rm);
TextureUtility.createSkyBox(ap, sides);
It worked and the error disappeared, the only messages I have, are :
Possibly no jogl in classpath!
scene root is root
U3D Export: prepare data...writing...done.
but when I try to open the pdf with adobe 8.2 I have the message "Une erreur d'analyse des données 3D est survenue".
I have the same message with adobe 9.3
Re: Export In pdf3D
Posted: Tue 9. Mar 2010, 20:55
by Andre
I've tried to convert the tutorial, too and everything seems to work fine!
You have worked with the tutorial for U3D?
export U3D files
I've forwarded your problem to sechel, which knows much more about the U3D export.
Re: Export In pdf3D
Posted: Wed 17. Mar 2010, 08:28
by sechel
Hi all,
this problem is fixed now. There was a issue with an empty skybox causing the
error you had.
sechel
Re: Export In pdf3D
Posted: Sun 21. Mar 2010, 04:35
by Sebos2013
Thank you, I tried and it's working fine
Re: Export In pdf3D
Posted: Tue 29. Jun 2010, 16:48
by argo2185
Hello,
i have also a problem with a NullPointerException on "getSkyBox". I'm trying to read in a stl-File and write out the 3d-object in a pdf3d.
my sourcecode is like this:
Code: Select all
Input input = new Input("object.stl");
ReaderSTL reader = new ReaderSTL();
SceneGraphComponent scene = reader.read(input);
WriterPDF pdfWriter = new WriterPDF();
File pdfFile = new File("test.pdf");
FileOutputStream fos = new FileOutputStream(pdfFile);
pdfWriter.write(scene, fos);
fos.close();
and i get the following exception:
Code: Select all
java.lang.NullPointerException
at de.jreality.writer.u3d.U3DSceneUtility.getSkyBox(U3DSceneUtility.java:734)
at de.jreality.writer.u3d.WriterU3D.prepareSceneData(WriterU3D.java:1578)
at de.jreality.writer.u3d.WriterU3D.writeScene(WriterU3D.java:1442)
at de.jreality.writer.u3d.WriterU3D.write(WriterU3D.java:1543)
at de.jreality.writer.pdf.WriterPDF.writeScene(WriterPDF.java:225)
at de.jreality.writer.pdf.WriterPDF.write(WriterPDF.java:194)
What do you think the problem comes from ?
Re: Export In pdf3D
Posted: Tue 6. Jul 2010, 19:04
by sechel
Do you work with the latest SVN version of jreality? The sky box bug should be resolved
there. If yes, please provide the stl geometry that produces the error.
Re: Export In pdf3D
Posted: Wed 7. Jul 2010, 08:23
by argo2185
ok, now it works.
Re: Export In pdf3D
Posted: Fri 26. Aug 2011, 08:17
by NormanGraf
Could this bug have crept back? I notice that U3DSceneUtility.java has been modified this month and the following program throws the same exception as reported previously when built against the SVN head.
Code: Select all
import de.jreality.reader.ReaderSTL;
import de.jreality.scene.SceneGraphComponent;
import de.jreality.util.Input;
import de.jreality.writer.pdf.WriterPDF;
import java.io.File;
import java.io.FileOutputStream;
public class Stl2Pdf
{
public static void main(String[] args) throws Exception
{
Input input = new Input(new File("Cube.stl"));
ReaderSTL reader = new ReaderSTL();
SceneGraphComponent scene = reader.read(input);
WriterPDF pdfWriter = new WriterPDF();
File pdfFile = new File("test.pdf");
FileOutputStream fos = new FileOutputStream(pdfFile);
pdfWriter.write(scene, fos);
fos.close();
}
}
throwing:
Code: Select all
solid end: 12 facets read.
Exception in thread "main" java.lang.NullPointerException
U3D Export: prepare data... at de.jreality.writer.u3d.U3DSceneUtility.getSkyBox(U3DSceneUtility.java:775)
at de.jreality.writer.u3d.WriterU3D.prepareSceneData(WriterU3D.java:1601)
at de.jreality.writer.u3d.WriterU3D.writeScene(WriterU3D.java:1465)
at de.jreality.writer.u3d.WriterU3D.write(WriterU3D.java:1566)
at de.jreality.writer.pdf.WriterPDF.writeScene(WriterPDF.java:228)
at de.jreality.writer.pdf.WriterPDF.write(WriterPDF.java:197)
at Stl2Pdf.main(Stl2Pdf.java:19)
when run on the following simple stl file:
Code: Select all
solid
facet normal 0.0 -1.0 0.0
outer loop
vertex -0.5 -0.5 -0.5
vertex 0.5 -0.5 0.5
vertex -0.5 -0.5 0.5
endloop
endfacet
facet normal 0.0 -1.0 0.0
outer loop
vertex 0.5 -0.5 0.5
vertex -0.5 -0.5 -0.5
vertex 0.5 -0.5 -0.5
endloop
endfacet
facet normal 0.0 1.0 0.0
outer loop
vertex 0.5 0.5 -0.5
vertex -0.5 0.5 0.5
vertex 0.5 0.5 0.5
endloop
endfacet
facet normal 0.0 1.0 0.0
outer loop
vertex -0.5 0.5 0.5
vertex 0.5 0.5 -0.5
vertex -0.5 0.5 -0.5
endloop
endfacet
facet normal 0.0 0.0 1.0
outer loop
vertex -0.5 0.5 0.5
vertex 0.5 -0.5 0.5
vertex 0.5 0.5 0.5
endloop
endfacet
facet normal 0.0 0.0 1.0
outer loop
vertex 0.5 -0.5 0.5
vertex -0.5 0.5 0.5
vertex -0.5 -0.5 0.5
endloop
endfacet
facet normal 0.0 0.0 -1.0
outer loop
vertex -0.5 -0.5 -0.5
vertex 0.5 0.5 -0.5
vertex 0.5 -0.5 -0.5
endloop
endfacet
facet normal 0.0 0.0 -1.0
outer loop
vertex 0.5 0.5 -0.5
vertex -0.5 -0.5 -0.5
vertex -0.5 0.5 -0.5
endloop
endfacet
facet normal -1.0 0.0 0.0
outer loop
vertex -0.5 -0.5 -0.5
vertex -0.5 0.5 0.5
vertex -0.5 0.5 -0.5
endloop
endfacet
facet normal -1.0 0.0 0.0
outer loop
vertex -0.5 0.5 0.5
vertex -0.5 -0.5 -0.5
vertex -0.5 -0.5 0.5
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.5 -0.5 0.5
vertex 0.5 0.5 -0.5
vertex 0.5 0.5 0.5
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.5 0.5 -0.5
vertex 0.5 -0.5 0.5
vertex 0.5 -0.5 -0.5
endloop
endfacet
endsolid
Any help would be appreciated.
Re: Export In pdf3D
Posted: Mon 29. Aug 2011, 16:23
by sechel
Seemed to be a bug at this line of code. Changed it.
Re: Export In pdf3D
Posted: Mon 29. Aug 2011, 20:27
by NormanGraf
That did it. The svn head version now compiles and runs correctly.
Thank you very much.
Re: Export In pdf3D
Posted: Mon 5. Sep 2011, 20:19
by Joe
Hi,
I also have a problem with U3D in PDF files, since the new Adobe Reader. The geometry is displayed as expected in JReality:

The export to PDF resultet in a totally black scene. After updating the Javascript, only the normals seems to be missing (or something with the lightning seems to be broken):

The airplane consists of multiple SceneGraphComponents. Only one is blue, all others are black. Even when I open another CAD file, only one SceneGraphComponents is blue, all others are black.
Some facts:
I have updated packages de.jreality.writer.pdf and de.jreality.writer.u3d from SVN. Do I have to update more packages? If so, which packages?
The export within Jreality works fine. My problem occurs, when I export a scene graph, which I have created in an external application.
All works with older Adobe Reader versions.
When I insert a U3D file, created by JReality, it works, so the problem has to be in my scene graph and not in the way I store the U3D in the PDF file.
Does anyone has any hint for me?
Bestr regards, Joe
Re: Export In pdf3D
Posted: Wed 7. Sep 2011, 16:16
by Joe
I have created a new topic with example code, so an answer to the above question isn't necessary (at this location).
http://www3.math.tu-berlin.de/jreality/ ... ?f=3&t=566