A newer version of Max is available. Click here to access the latest version of this document.

jit.gl.model

Read and draw Wavefront .obj models

Description

The jit.gl.model object requires one argument: the name of a drawing context. A named drawing context is a named instance of a jit.window, jit.pwindow, or jit.matrix object that has an instance of the jit.gl.render object associated with it. This value may also be set via the OB3D drawto attribute. The jit.gl.model object reads and draws Alias/Wavefront .obj files. Currently, only tessellated polygons are supported, and not advanced features of the .obj format such as NURBS or parametric surfaces.

Information for Jitter 3D Object (OB3D) messages and attributes to this object

Messages

make_normals 0/1 [int]
Toggles automatically calculating vertex normals for the model, overwriting any existing ones. (default = 0) This is done automatically if the model has no vertex normals.
read filename [symbol]
Loads an .obj model file. The read message will attempt to find the model file in the Max search path and load it. If no model name is specified, a file dialog box is presented.
texgroup group-number [int]
texture-name [symbol]
The texgroup message is used to apply a named texture to a numbered group of polygons within the model. The groups for a model are specified in its .obj file. The texture applied to a group will override any textures which have been applied to the object using the texture message. If 0 is used in place of a texture name, the texture for that group is removed and the texture of the OB3D is restored (or lack of texture).

Attributes

Name Type g/s Description
drawgroup int If non-zero, draw only one group of polygons. It zero, draw all polygon groups in the model.
facet int The facet drawing mode (default = 0 (use built-in normals))
0 = built-in normals or automatically generated normals are used when rendering the model
1 = draw each triangle in the model with its own normal.
material_mode int Mode for applying built-in material properties of a model.
0 = material properties are ignored.
1 = the diffuse color component of the material is used to generate a vertex color.
2 = all components of the material are used.
mode symbol Determines the method used to draw the model. Possible modes are:

displaylist (not the fastest, but will work on any card)
var
vbo
normalize int Normalize model coordinates flag (default = 1) When enabled, the jit.gl.model object will scale the model's coordinates to the range (-1.,1.) for the x, y, and z axes. When disabled, the original model's coordinates are preserved. this is useful for importing several models together in the same world, preserving relative position and size.
smoothing_angle float Specificies the edge angle above which to smooth vertex normals.
verbose int Verbose mode flag (default = 0) In verbose mode, the jit.gl.model object will print out messages useful for debugging patches or models.

Information for box attributes common to all objects

Examples

See Also

Name Description
jit.gl.graph Open GL floating-point data visualization
jit.gl.gridshape Generate simple geometric shapes as a connected grid
jit.gl.handle Use mouse movement to control position/rotation
jit.gl.isosurf Generates a GL based surface extraction
jit.gl.mesh Generates GL geometry from existing data
jit.gl.nurbs Generate NURBS surface
jit.gl.plato Generate platonic solids
jit.gl.render Render Open GL
jit.gl.shader Manages a GL shader
jit.gl.sketch GL parallel to lcd
jit.gl.slab Performs a GL accelerated grid-based evaluation
jit.gl.text2d Write bitmap text
jit.gl.text3d Write vector text
jit.gl.texture Manages a GL texture
jit.gl.videoplane GL accelerated video plane
jit.gl.volume Creates a GL accelerated volume vizualization
Tutorial 36: 3D Models Tutorial 36: 3D Models