OBJ format to X3D conversion
The OBJ file format supports 3D geometry expressed as triangular meshes with optional normal, color, and texture coordinates on a per-vertex basis, and also allows referencing a .mtl file that can be rendered as a image texture on the rendered 3D geometry. A conversion of an OBJ file to X3D entails constructing equivalent X3D nodes for the geometry and appearance and writing this to a file; an X3D file in XML encoding is informally referred to as an X3D file and commonly has a .x3d extension. The OBJ format does not include navigation or lighting definition so these must be supplied by X3D authoring if the default lighting or viewpoint is not optimal for the OBJ content.
The X3D Resources page contains many software packages that can be used to convert OBJ files to X3D. The most common conversion needs can be met with one or more of the following options:
Meshlab is an open source cross-platform application that supports a comprehensive set of 3D mesh and point cloud manipulations. It allows for importing and exporting data over many file formats, so conversion may be achieved by importing an OBJ file and then exporting the same data as an X3D file.
- OBJ to X3D conversion using Meshlab is demonstrated in a tutorial video Build and Publish in X3D ; starting at the 58:00 time mark.
- At Meshlab 2022, when an X3D export is requested, the following export options window is shown
\
For a successful export from Meshlab, the user must uncheck at least one of the "Normal" checkboxes. A remaining checked box will specify whether mesh normal will be exported as per-vertex or per-face.
Castle Game Engine is an open source cross platform game engine and development system that supports importing OBJ files and exporting X3D. Among the applications in this code suite are the view3dscene X3D browser which can be used to perform this conversion both as interactive GUI application and through a command line interface.
CADExchanger is commercial software that provides conversion within a wide range of 3D file formats, including OBJ and X3D. Conversion with this code is also available as a cloud based web service , and the software is also available in an SDK for incorporation into end-use software.