U3D / 3D PDF: LINE_SET appears offset from mesh in Acrobat

Hi everyone,

I export a Three.js/CAD scene to IDTF → U3D → 3D PDF.

Surfaces are exported as U3D MESH, CAD linework as U3D LINE_SET.
In Acrobat Reader the exported lines appear offset from the mesh/points, sometimes floating or not touching the expected vertices.

I attached two screenshots:

  1. how it should look
  2. how it currently looks after export

In our debug output some point-to-line endpoint distances are 0 before export and after the IDTF transform. We also normalize coordinates, use Float32-style rounding, and apply the same transform to meshes and lines.

Question:
Has anyone seen Acrobat/U3D render LINE_SET geometry offset from MESH geometry even when coordinates match? Is this a known Acrobat/U3D limitation, or is there a better way to export CAD linework as real lines instead of mesh tubes?

Thanks!

The issue could be literally anywhere in that pipeline.

Folks generate PDFs from threejs using a variety of tools like PDF.js / jsPDF, and PDFKit and I haven’t heard of any known coordinate offsetting issue.

If you are flattening the object hierarchy before you go to IDTF.. you may have an issue there…

i.e. special care must be taken in transforming geometries into world space by applying their meshes updated .worldMatrix .. and if geometries are shared, they will have to be cloned in order for them each to be transformed independently to worldspace.

Thanks, good point. In our current export, mesh vertices are read in world space using matrixWorld, while CAD lines are exported from already-world/project coordinates. The generated IDTF uses identity PARENT_TM for both MESH and LINE_SET nodes.

To narrow this down, I can create a minimal IDTF:

  • one triangle MESH
  • one LINE_SET segment whose endpoints exactly match two triangle vertices
  • same material setup
  • identity node transforms
  • after our normalization / Float32 rounding

I can also include debug distances:

  • raw line endpoint to mesh vertex
  • transformed/IDTF line endpoint to mesh vertex
  • PARENT_TM for mesh and line nodes
  • relevant MODEL_POSITION_LIST entries

If that minimal file still renders offset in Acrobat, would that suggest an Acrobat/U3D LINE_SET rendering issue rather than a hierarchy/worldMatrix problem?

Yeah or use jsPDF to generate the pdfs directly from threejs, and see if you get a different result, because each step in this pipeline may introduce little quirks:

THREEJS->IDTF → U3D → 3D PDF.