Skip to main content

vJSONFromOBJ

Read Wavefront OBJ text from a file, a URL or pasted text and output points, faces, UVs and UV indices as arrays.

IntermediateMograph / JSONJSONArrayScriptVal
vJSONFromOBJ node

vJSONFromOBJ has no input socket and outputs four arrays read from OBJ text: Points, Edges, UVs and UV Edges. Input Source picks a file, a URL or text typed into the node.

Parameters​

ParameterTypeDefaultDescription
Input SourceDropdownFileWhere the OBJ text comes from, File, URL or Text. Default File.
FilenameText—Path of the OBJ file. Shown when Input Source is File.
URLText—Address of an OBJ text file. Shown when Input Source is URL.
InputText—OBJ text typed or pasted into the node. Shown when Input Source is Text.
Scale File Units ByFloat1Multiplier applied to X, Y and Z of every point. Default 1.
Read the full description

The node reads the source line by line. Lines that start with v give the Points array, with the first three values of each line multiplied by Scale File Units By. Lines that start with vt give the UVs array with two values each. UV values are not scaled.

Each line that starts with f gives one entry in the Edges array, holding the vertex indices of the face, and one entry in the UV Edges array, holding the texture coordinate indices. The indices are copied as they are in the file, which means 1-based values for a standard OBJ. Other lines, such as vn, g and usemtl, are ignored.

The face parser expects vertex references with two slashes, such as 1/2/3 or 1//3. A face written as f 1 2 3 or as 1/2 gives an empty entry, and an index written as 1//3 gives no UV index. The code does not skip a v line that has fewer than three values. Normals are not read.

Filename goes through Fusion path mapping before it is opened. URL is downloaded as text. Input is used as it is. Only the control for the selected source is shown.

Example Connections​

vJSONFromOBJ.Points -> vJSONCameraProjection.ArrayA
vJSONCameraProjection.Output -> vJSONShapeRender.ArrayPoint
Background.Output -> vJSONShapeRender.Input