Research > Software > ShapeToObj

ShapeToObj

ShapeToObj converts an arbitrary ShapeTools-compatible surface file to a Minc Obj surface file.

Features

  • <p>The program supports any surface format that ShapeTools can read.</p>
  • <p>The program can write the output Obj in either the binary or ascii format.</p>
  • <p>The existing colors of a shape may be preserved, or existing attribute data may be converted to a color attribute in the Obj. The user may also specify a particular attribute or color to use.</p>
  • <p>If a shape has non-triangular faces, the program will triangulate them to be compatible with the obj format.</p>
  • <p>If no normal attribute exists, they will be computed.</p>

Description

ShapeToObj converts an arbitrary ShapeTools-compatible surface file to a Minc Obj surface file. Since not all shapes have an equivalent Obj representation, there will sometimes be data loss given an input shape attribute that cannot be represented in the Obj format. The number of vertices will not be changed, and the order of those vertices will be consistent. The number of faces and edges, however, will sometimes change, as the Obj format requires triangular faces.

Usage

System Requirements

  • OS: any
  • Processor: any
  • Memory: Data-dependent
  • Other: Java 1.5 (or higher) runtime environment

Installation

Compliation

Portable java executable make compilation unnecessary.

Installation InstructionsCopy java executable 'jar' file to local disk.

Purpose

The ShapeToObj program reads any ShapeTools-compatible shape and converts it to an Obj file, which can be either the binary or ascii format.

The input shape must represent a surface, and contour formats are not supported. However, some Ucf files may be interpreted as a surface, and these may be converted to an Obj. The Minc Obj polygon format requires triangular faces. Accordingly, all faces are triangulated. Vertex normals are also required by the format. These are computed if they are not present in the input shape. The user has the option to ensure proper orientation of the surface's faces. This will change the order of the indices that specify the face.

This tool only supports color attributes of the Obj format. The data used to color the shape can be specified several ways. If the user provides no color-related specifications, the shape's existing color attribute is used to color the Obj. If no color attribute is present, then the first per-vertex scalar attribute is interpreted as a grayscale color. The attribute will be normalized in a linear way, such that the smallest attribute value maps to black and the largest maps to white. Alternatively, the user can specify the color to use. If the user provides an attribute ID, the appropriate attribute is used as a color. If the shape has no such attribute, an error is printed to the console, and the program exits. The user can also specify a single color to use when coloring the shape. This is specifed by three floating point numbers from the interval [0,1]. These will be interpreted as the red, green and blue channels of the color.