Objects
The object scene element is used to encapsulate geometric details
of various types of shapes, like freeform surfaces or curves, polygons,
triangle or subdivision base meshes, and even hair primitives. All these
object types share a set of common properties, referred to as object
flags. The object description merely provides the template for the
construction of the shape, but only an
instance of the object will actually
generate a renderable copy that is placed in the virtual world giving it a
designated size and orientation.
All geometric information is typically specified
relative to its own internal origin, in other words, in
object space.
In this mode, which is the default, the camera location is determined by its
instance, all objects are defined in
local object coordinates and positioned in the
scene with their object instances. Every
object, camera, or light requires an instance to be established in the scene
for rendering.
Deprecated
In camera space mode, enabled in the scene
options, the camera is fixed and
assumed to sit at the coordinate origin and point down the negative Z axis,
and all objects are defined using camera space coordinates. Camera space mode
is supported only for backwards compatibility, and is not recommended.
The appearance of the object, such as color and
transparency, is determined by referencing materials in the object
definition. Before a material can be used
in an object, it must be defined. Assigning a material determines all aspects
of the object's appearance. No further parameters, textures, or lights need
to be specified; they are all part of the material definition.
The most common approaches to materials and objects are: to define all
materials upfront followed by all objects, or material and object definitions
may be interspersed. The first approach is preferable when materials are
authored separately, and should be included as a single .mi file.
Either way, each material definition precedes its first use.
All polygonal and free-form surface objects have the same common format
in the .mi file:
object "object_name"
[ visible [on|off] ]
[ shadow [on|off|mode] ]
[ shadowmap [on|off] ]
[ trace [on|off] ]
[ reflection mode ]
[ refraction mode ]
[ transparency mode ]
[ caustic on|off ]
[ caustic [mode] ]
[ globillum on|off ]
[ globillum [mode] ]
[ photonmap file ["file_name"|off] ]
[ finalgather on|off ]
[ finalgather mode ]
[ finalgather file ["file_name"|[file_list]|off] ]
[ finalgather force on|off ]
[ select [on|off] ]
[ tagged [on|off] ]
[ face front|back|both ]
[ box [xmin ymin zmin xmax ymax zmax] ]
[ motion box [xmin ymin zmin xmax ymax zmax] ]
[ max displace value ]
[ ray offset value ]
[ samples min max ]
[ shading samples samplesscalar ]
[ data "data_name"|null ]
[ tag labelint ]
[ file "file_name" ]
[ basis_list ]
group
vector_list
vertex_list
geometry_list
approximation_list
end group
end object
The individual parameters are:
-
object "object_name"
- The object_name character string is used to uniquely identify the
object.
- The name is not used by mental ray in any form except for progress
reports and error messages. Object names should be enclosed in double quotes
to disambiguate them from reserved words, even though this is not mandatory.
-
visible [ on|off ]
- Determines the primary visibility of the object.
- Most objects will have this flag set. Not setting it, or setting it to
off
will make the object invisible to
primary rays, which are rays originating
from the camera. This means that the object
will disappear from the rendered image.
- The default is off, for not visible.
Given without a boolean argument sets it to on.
- Note
Transparency rays will
also hit objects marked visible, if the
transparency
mode is not touched. In this case, transparency is not considered a
special case of refraction, but as a scanline rendering feature. This
apparent inconsistency permits usingtransparency effects even if
ray tracing is turned off altogether.
More importantly, it also keeps objects that have the visible flag
but not the trace flag out of the BSP tree that is used to accelerate
ray tracing, which has a significant performance impact. This tradeoff can
become very significant for large scenes.
-
shadow [ on|off|modeint ]
- Controls contribution of the object to shadows.
- When using the form with the boolean argument on or off
it enables or disables just shadow casting - shadows thrown from this object
onto other objects, but the object will always receive - or show - shadows
from other objects. The mode allows to control shadowing
details of the object explicitly. It specifies whether the object casts shadows
(1), receives shadows (2), does both (3), or has
no impact on any shadows (
0
). The shadow flags are ignored if
shadows are globally disabled, like in the
scene options.
-
The default is off, for not casting but only receiving
shadows.
Given without any argument sets it to on.
- Note
If an object is very complex, it may be desirable to set only
the visible flag but not the shadow flag, and create a
second object that resembles the first one but is much simpler, and set its
shadow but not the visible flag. The effect is that the
object appears unchanged, but shadow calculations see a much simpler shadow
object that casts approximately the same shadow as the primary visible object
would.
-
shadowmap [ on|off ]
- Determines if the object contributes to a shadowmap.
- For an object to cast shadows from a shadowmap, the shadow mode
must have casting enabled as well. This flag may be useful to control shadows
from shadowmaps differently than ray tracing shadows. For example, for volume
bounding geometry called hull objects, such as light cones,
disable to cast any shadows from a shadowmap but keep shadow tracing enabled.
-
The default is on.
Given without any argument sets it to on.
-
Note This flag is rarely used because the regular shadow
flag impacts shadowmap shadows as well.
-
trace [ on|off ]
- Deprecated
This flag is supported for backwards compatibility. It is superseded by
reflection
,
refraction
, and
finalgather flags.
-
Controls contribution of the object to secondary
ray tracing effects.
-
Determines whether the object is visible to secondary rays for reflection,
refraction and finalgather. When using the form with the boolean argument
on or off it enables or disables casting of reflections,
refractions, and finalgather onto other objects, but the object will always
receive - or show - these effects from other objects. If given without any
argument it defaults to on (cast and receive) for the respective
effects. This flag has no effect if ray tracing is globally disabled in the
scene options with trace off.
-
The default is off, for not casting but only receiving
reflections, refractions, and final gathering.
Given without any argument sets it to on.
- Note
If the reflecting or refracting objects are fuzzy or only slightly
reflective or refractive, it may result in a considerable speedup to let the
reflection and
refraction rays see a much simpler object
than primary rays would. Like with the shadow flag, this is achieved
by not setting the trace flag in the primary, high-definition object,
and create a second one that roughly resembles the primary object that has the
trace flag (and perhaps the shadow flag) but not the
visible flag set.
-
reflection modeint
- Controls if an object is visible in reflections on other objects, and if it
shows reflections of other objects.
- A value of
1
enables reflection casting, in other words, the
object becomes visible in reflections on other objects. A value of
2
enables reflection receiving, thus will show reflections of
other objects on this object. A value of 3
enables both, and
0
disables both.
- Default is
2
, for not casting but receiving
reflections.
- Note
The phrase casting reflections has an opposite meaning
to casting reflection rays: in order to cast reflections or
become visible in reflections on other objects an object must
receive reflection rays, and to receive reflections or
show reflections of other objects an object has to cast reflection
rays. The mode controls casting and receiving of the
shading effect rather than rays, similar to the meaning of
casting shadows.
-
refraction modeint
- Controls if the object is visible in refractions on other objects, and
if it shows other objects in refractions.
- A value of
1
enables refraction casting, in other words, the
object becomes visible in refractions on other objects. A value of
2
enables refraction receiving, thus will show other objects in
refractions. A value of 3
enables both, and 0
disables both.
- Default is
2
, for not casting but receiving
refractions.
- Note
The phrase casting means casting a refraction,
which has an opposite meaning to casting a refraction ray. See the
note about reflection mode for an explanation.
-
transparency modeint
- Controls if an object is visible through transparent parts of other
objects, and if it shows other objects in transparent parts.
- A value of
1
enables transparency casting, in other words,
the object becomes visible through transparent regions of other objects. A
value of 2
enables transparency receiving, thus will show other
objects in transparent parts. A value of 3
enables both, and
0
disables both.
- Default is
3
, for both cast and receive transparency.
-
caustic on|off
- Determines if the object participates in generation of
caustics at all.
- Setting this flag to off means that the object is completely
hidden from caustics effects. In other words, the object is considered as not
existing for caustic photons, and they will pass the space covered by the
object perfectly unaffected. Setting the flag to on generally enables
contribution of this object to caustics, and further details of how caustics
are treated can be controlled with the caustic mode flag
below.
- The default is
on
, for enabled for caustics.
-
caustic [ modeint ]
- Controls details of the interaction of
caustics with the object.
- A value of
1
enables caustic casting, 2
enables
caustic receiving, 3
enables both, and 0
disables
both. This mode has an effect only if caustic interaction for this
object has not been disabled, like with caustic off
.
- The default is
0
, for not casting nor receiving
caustics.
Given without a mode argument sets it to 3
, for
both cast and receive caustics.
- Note
This setting can be used to optimize performance by focusing
the effect on the desired scene elements. The
cast
flag impacts
the emission of caustic photons into the scene; they will be shot towards
casting objects only and, hence, avoid to waste shooting photons in other
directions. The receive
flag marks objects for photon storage,
hence has influence on the size of the photon map.
- Example
To focus caustic effects on specific objects, the global options should
disable caustic interaction by default, but the involved objects should have
the respective caustic flags set. To render caustics in a water pool,
the flags may be set like this:
options "options"
caustic 0
end options
object "water"
caustic on
caustic 1
end object
object "ground"
caustic on
caustic 2
end object
-
globillum on|off
- Determines if the object participates in generation of
global illumination from photons at all.
- Setting this flag to off means that the object is completely
hidden from global illumination photon effects. In other words, the object is
considered as not existing for such photons, and they will pass the space
covered by the object perfectly unaffected. Setting the flag to on
generally enables contribution of this object to global illumination, and
further details can be controlled with the globillum mode
flag below.
- The default is
on
, for enabled for global illumination
photons.
- Note
The globillum on flag marks specific objects to participate in
optimized generation of global illumination. Global illumination is a lighting
effect caused by diffuse interreflection, such as a red table
bleeding red color onto an adjacent white wall. To
simulate this effect, the material of
both the table and the wall must provide
photon shaders, the light source must emit
globillum photons and contain appropriate photon energy settings, and
the material shader of the wall must pick
up global illumination light information.
- Note
If an object is very complex it may be desirable to set only the visible
flag but not the globillum flag, and create a second object with
simplified geometry that resembles the first one with the globillum
but not the visible flag set. The effect is that the rendered object
appears in full detail but simulation of global illumination is faster since a
simpler object representation is used.
-
globillum [ modeint ]
- Controls details of the interaction of
global illumination photons with the object.
- A value of
1
enables global illumination casting, 2
enables receiving, 3
enables both, and 0
disables
both. This mode has an effect only if global illumination interaction
for this object has not been disabled, like with globillum off
.
- The default is
0
, for not casting nor receiving
global illumination photons.
Given without a mode argument sets it to 3
, for
both cast and receive global illumination photons.
- Note
This setting can be used to optimize performance by focusing the effect on
the desired scene elements. The
cast
flag impacts the emission
of global illumination photons into the scene; they will be shot towards
casting objects only and, hence, avoid to waste shooting photons in other
directions. The receive
flag marks objects for photon storage,
hence has influence on the size of the photon map.
- Example
To enable global illumination effects only on specific objects, the global
options should disable global illumination interaction by default, but the
involved objects should have the respective globillum flags set. To
render global illumination in a white room with a red table, the flags may
be set like this:
options "options"
globillum 0
end options
object "room"
globillum on
globillum 3
end object
object "table"
globillum on
globillum 3
end object
- finalgather on|off
- Determines if the object participates in
final gathering at all.
- Setting this flag to off means that the object is completely
hidden from final gathering. In other words, the object is considered as not
existing for finalgather rays, and they will pass the space covered by the
object perfectly unaffected. Setting the flag to on generally enables
contribution of this object to final gathering, and further details of how
finalgather rays are treated can be controlled with the finalgather
mode flag below.
- The default is
on
, for enabled for final gathering.
-
finalgather modeint
- Controls details of final gathering
interaction with the object.
- A value of
1
enables finalgather casting, 2
enables receiving, 3
enables both, and 0
disables
both. This mode has an effect only if final gathering interaction
for this object has not been disabled, like with finalgather off
.
- The default is
2
, for not casting but receiving
final gathering effects.
- Note
If the final gathering cast bit is not set, like with
finalgather 1
or finalgather 3
, but finalgather
on
is given, then finalgather rays would be terminated by the object and
return a black color.
-
finalgather file [ "file_name" | [file_list] |off ]
- Controls final gathering cache per
object.
- The finalgather points computed for this object are stored in the given
disk file(s). This helps to reduce the memory requirements compared to using
a single global map.
If multiple files are given as file_list, a comma-separated list
of file names within square brackets, then all finalgather maps are merged
upon reading but the first file in the list is used to write the final map,
similar to the behavior of the global
finalgather file option. If
identical file names or file name lists are used for several objects, only
one copy of those finalgather maps will be kept in memory. The values
off
or ""
can be used to explicitly disable this
feature, for example in the next frame of an animation.
- The default is
off
.
-
finalgather force on|off
- Controls final gathering mode
for this object.
- When the value of the flag is
on
, then final gathering for
this object will be computed in force
mode instead of using interpolation from nearby finalgather points. This can
be used to tune for higher final gathering rendering quality just on selected
areas of the scene without impacting the overall performance too much. The
mode may also be explicitly switched to off
on this object but
enabled just for a particular instance
of the object.
- The default is
off
.
- select
- Deprecated
This flag is kept for backwards compatibility. It has no effect.
- tagged [ on|off ]
- Controls how materials are referenced, directly or by index.
- Every polygon, surface, and triangle can get a material assigned directly.
If an object does not specify any material, it will be inherited from the instance
automatically. In contrast, objects marked tagged do not store
any material directly at all but always rely on the inherited instance
material, or list of materials. In this case, a mandatory label integer value
is provided in place of the material, in polygon and surface definitions. If
the instance specifies a list of materials
then the integer value is used as an index into that list to find the related
material. The label can also be accessed by shaders during rendering using the
miQ_GEO_LABEL query.
Thus, if a shader is shared on multiple objects it can distinguish tagged
parts of the object by label.
-
The default is off, for not tagged.
Given without any argument sets it to on.
-
face front|back|both
- Controls face culling for the object.
- Determines if either the front or the
back side of the object faces are rendered, or both sides.
This flag overrides the global default given in the
scene options for this object only. Shaders
may overrule the behavior during rendering.
- The default is unspecified, for determined by the global option.
-
box [ xmin ymin zmin xmax ymax zmax ]
- Specifies the bounding box of the static object.
- The bounds are given as two 3D vectors in object space providing the
minimum and maximum coordinates in x,y,z of all
surface points. For polygons, this is easy to compute: the box components are
simply the smallest (min) and largest (max) components of all
points contained in the vectors. For free-form
surfaces, the box can in principle be derived in the same way from the control
points; however, such a box would often be much too large, especially for NURBS.
Boxes that are too large are legal but may be inefficient. If the box statement
is omitted, mental ray will compute one from all vertices, which may not be
very efficient as well. The object bounds are needed for demand loading using
placeholder geometry.
- The default is unspecified, for automatically computed.
Given without any argument sets it to unspecified, for
no box.
- NoteThis box should not include enlargement
caused by displacement or motion.
-
motion box [ xmin ymin zmin xmax ymax zmax ]
- Specifies the motion deformation bounds of the object.
- This bounding box contains the minimum and maximum components of all
motion vectors for this object. Note,
that this is not the same as providing the smallest and largest distance
vector; but these vectors are put together from the individual smallest
and largest x,y,z components of all motion vectors.
A
motion box
must be specified if the object has both a
bounding box and motion vectors, otherwise loading
on demand may fail for deforming objects.
- The default is unspecified.
Given without any argument sets it to unspecified, for
no motion box.
-
max displace value
- Specifies maximum displacement bounds of the object.
- This setting should provide the maximum displacement applied to object
control points in local object space in normal direction. If a displacement
shader returns values grater than value, the rendered geometry may
appear clipped and a warning is printed. Displaced objects should always
specify this value to accelerate displacement calculation.
- The default is
0.0
, for truncate to zero or
disable displacement.
- Note
A max displace value that is too large generates correct images
but puts more pressure on memory and performance, since larger areas of an
object may be displaced, thus creating much more triangles in longer time.
In particular, mental ray may suffer serious performance losses, even by an
order of magnitude, if the displaced object uses
fine approximations.
If the max displace value is too small, mental ray will limit the
absolute displacement to this value.
-
ray offset value
- Offset the ray origin when tracing rays from this object.
- This setting allows to enforce an offset for the origin of secondary rays
cast from the geometry, in world space units. When a ray is traced, any
intersections that are closer to the emanating surface than the given offset
value are ignored. This can be useful to avoid self-intersections,
especially in situations where multiple, slightly different, tessellations of
the same geometry are used, like rasterized triangles for primary visible
rendering and approximate tessellations for ray tracing.
-
samples minint maxint
- Controls primary sampling for this object.
- This statement allows to tune adaptive oversampling
per object. For all pixels that touch this object, the global samples range
specified in the scene options is
constrained to the min max range, such that at least
2min and at most
2max samples are taken. Constraints
that exceed the min and max global limits are ignored, so that
the options can be used to force quick preview rendering without having to
change all object sampling specifiers. If the pixel touches multiple objects,
perhaps due to reflection or refraction, the highest min and the
highest max are used. If the pixel touches no objects at all, the
default global limits defmin and defmax defined in the
scene options are used.
- The defaults are
-128 127
, for disable per-object sampling
limits.
- This setting is not used by the
rasterizer.
-
shading samples value
- Controls rasterizer sampling for this
object.
- This will override the global shading
samples setting for this object. It is also possible to specify this
setting per-instance, if needed, where the instance setting will override the
object setting, when both are present. Typically, this is used to keep the
global default value low for overall performance, but boost the setting for
selected objects or instances only, to achieve the desired quality in the
final rendering.
- The default is
0.0
, disable per-object shading samples.
- This setting is only used by the
rasterizer.
-
tag numberint
- Assigns a label number to identify this object.
- The number is an arbitrary 32-bit integer value. The term
label is normally used in mental ray for this identifier, the keyword
tag is retained for backwards compatibility (a tag is used in
shaders to identify entries in the scene database). Using an appropriate
framebuffer or output statement in the render
cameras it is possible to let mental ray
write a label file that, for each pixel, contains the label code of the object
that the camera ray hits first. Which label exactly is stored is under control
of the material shader. Using the label of the foremost object regardless of
reflections and refractions is merely the default behavior.
- The default is
0
, for no label.
-
data "data_name"|null
- Attach user data to this object.
- The argument must be the name of a previously defined
data element in the scene. If the keyword
null
is specified instead of a data element name, a previously
assigned data reference is removed. Several user data blocks may be chained
together using multiple data
statements.
- The default is
null
.
-
file "file_name"
- Specifies a file for demand loading geometry for this
placeholder object.
- This statement is used to enable lazy loading of the final object from
another file at render time, when mental ray hits the bounding box of the
object, also known as a placeholder object. Such an object needs
to specify valid bounds for the static, moving, and displaced geometry
using
box
, motion box
and max displace
settings. The actual geometry normally given inside the
object group can be omitted. The specified file
must contain an exact copy of the object, with the file statement
there is replaced with the complete object group
block containing the actual geometry. The incremental keyword needs
to be specified for that object. Such an object may have only a
single object group.
Demand loading objects are useful
to avoid parsing and permanently storing large objects that may or may not
be required for rendering.
- The default is unspecified, for no placeholder.
- NoteThe standalone mental ray supports the
-echo explode
command line option to automatically create
demand-loaded object files. On the other hand, the -reload
command line option allows to utilize demand
loading without generating extra files.
- NoteThe
assembly mechanism allows to load larger parts of a scene on demand, like
a full character or a complete building.
- Example
The object definitions in the master scene and the placeholder file look
like this:
placeholder object:
object "my_object"
# flags ...
box ...
motion box ...
max displace ...
file "my_object.mi"
end object
object file my_object.mi
:
incremental
object "my_object"
# flags ...
group
# geometry ...
end group
end object
- basis_list
- Specifies the bases for free-form surface
geometry.
- Only free-form surfaces and curves use bases.
The defined bases can be used in all groups that follow, until the end of the
object.
group
- This starts a section that contains the actual geometric representation.
Multiple object groups are deprecated but supported for backwards compatibility;
mental ray will automatically convert a multi-group object to an instance
group containing multiple sub-objects. See object group
for details.
Note
The visible, shadow, trace, reflection,
refraction, transparency, caustic, globillum,
finalgather and face flags can be overridden by the instance
using the standard inheritance mechanism.
Instances can specify that a flag in the instanced object is turned on or off,
or that it is left unchanged. The object flags are used only if all instances
from the root of the scene graph down to the object
all leave the flag unchanged.
Object Group
Object groups contain the actual geometry. Common to all geometry
are vector lists and vertex lists.
Vector List
The vector list contains 3D vectors
which describe points in space, normals, texture vertices, basis vectors,
motion vectors, and others. Vectors are anonymous, they are triples of
floating-point numbers separated by whitespace
without inherent meaning. They are numbered beginning with 0. Numbering restarts
at 0 whenever a new object group starts.
mental ray also accepts a compressed binary format
for vectors. Instead of three floating-point numbers, a sequence of 12 bytes
enclosed in backquotes is accepted. These 12 bytes are the memory image of
three floats in IEEE 854 format, using big-endian byte order. This format is
intended to increase translation and parsing speed when ray is connected to
a native translator; it should not be used in files to be modified with text
editors or filters, since they may refuse to accept files containing binary
data, or corrupt them.
Vertex List
Vertices build on vectors.
In the .mi format, there is no syntactical difference between polygon
vertices and control points vertices for free-form surfaces; both are
collectively referred to as vertices in this discussion. All
vertices define a point in space and optional vertex normals, motion vectors,
derivatives, zero or more textures and basis vectors, and optional
user vectors:
v indexint
[ n indexint ]
[ d indexint indexint [ indexint [ indexint indexint ] ] ]
[ t indexint [ indexint indexint ] ]
[ m indexint ]
[ u indexint
...
Polygon vertices may use all of these. Free-form surface control
points may use v and m only; the others are
either computed analytically or are specified in other ways as part
of the surface definition.
-
v
- specifies the point in space,
-
n
- specifies the vertex
normal vector (ignored when the vertex is used
as a curve or surface control point).
A normal vector defines the orientation (vertical) of the surface at this
vertex.
-
m
- specifies the motion vector.
mental ray permits up to 15 m statements per v statement
for nonlinear motion paths. If multiple motion
vectors are specified, the shutter time interval
0...1 is equally subdivided, and each motion
vector specifies the motion from the origin specified by the v
vector to the corresponding point on the path. In other words, multiple
motion vectors do not form a connected chain but a bundle of "rays"
originating at the same point v.
-
t
- specifies a texture vertex
with an optional X/Y basis
vector pair for bump map calculation.
There can be up to 64 t lines for any given v vertex.
The texture and basis vectors are ignored when the vertex is used as a curve
or surface control point. Texture and basis information for surfaces is defined
using a "texture surface", described below.
-
d
- specifies a first and/or second surface
derivative. First derivatives describe the UV parametric gradient of a
surface; second derivatives describe the curvature. mental ray can compute
surface derivatives analytically for free-form surfaces but not for polygons
because polygons have no inherent UV coordinate space. Therefore, the
d keyword must be used to define explicit surface derivatives for
polygons. If d is followed by two indices they are taken to reference
the first derivative dP du and
dP dv (with P being the
point in space); if three indices follow they are taken to reference the second
derivative d²P du²,
d²P dv², and
d²P du dv; and if five indices follow the first
two describe the first derivatives and the next three the second derivatives.
Derivatives are not used by mental ray, they are made available to shaders only.
-
u
- specifies a user vector. No constraints are
imposed on user vectors. mental ray does not operate on them in any way,
they are passed through with the vertex and can be picked up by the shader.
Every vertex begins with a v statement and ends with
the next v statement or with the start of the geometry
description. All occurrences of index above reference the
vector list; 0 is the first vector in this group. References of
different types (for example, v and n) may not
reference the same vector. As stated before, all vectors are 3D. If
the third coordinate is not used (as is the case for 2D texture
vertices, for 2D curve control points, and for 2D surface special
points) it should be set to 0.0 by convention. If both the second
and third coordinates are unused (as is the case for 1D curve
special points), they should both be set to 0.0.
Vertices themselves are numbered independently of vectors. The
first vertex in every group is numbered 0. The geometry description
is referencing vertices by vertex index,
just like vertices are referencing vectors by vector
index. This results in a three-stage definition of geometry:
- List of vectors
- List of vertices
- List of geometry
The reason for this three-stage process is that it allows both sharing
vectors and sharing vertices. This is best illustrated with the following
examples.
Example
The examples will use the simplest form of polygon
syntax that will be described later in this section.
Consider two triangles ABC and ABD sharing an edge AB.
The simplest definition of this two-triangle
object is:
object "twotri"
visible
group
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
v 0
v 1
v 2
v 3
v 4
v 5
p "material_name" 0 1 2
p 3 4 5
end group
end object
The first three vectors are used to build the first three
vertices, which are used in the first triangle. The remaining three
vectors build the next three vertices, which are used for the
second triangle. Two vectors are listed twice and can be shared:
object "twotri"
visible
group
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
v 0
v 1
v 2
v 1
v 3
v 2
p "material_name" 0 1 2
p 3 4 5
end group
end object
The order of vector references is noncontiguous to ensure that
the second triangle is in counter-clockwise order. Two vertices are
redundant and can also be removed by sharing:
object "twotri"
visible
group
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
v 0
v 1
v 2
v 3
p "material_name" 0 1 2
p 1 3 2
end group
end object
The need for sharing both vectors and vertices can be shown by
specifying vertex normals:
object "twotri"
visible
group
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
0.0 0.0 1.0
v 0 n 4
v 1 n 4
v 2 n 4
v 3 n 4
p "material_name" 0 1 2
p 1 3 2
end group
end object
In this last example, both vector sharing and vertex sharing takes place.
The normal in this example is actually redundant: if no normal is specified,
mental ray uses the polygon normal. Defaulting to the
polygon normal is slightly more efficient than interpolating vertex normals,
if vertex normals are explicitly specified.
Geometry List
Various types of geometry can be contained in the geometry_list,
like polygonal geometry, triangle lists, free-from and subdivision surfaces.
In the next sections the syntax of these definitions is described in detail.
Approximation List
At the end of each object group
several
approximation statements may be
given which control the tessellation of the geometry. In polygonal object
groups, the approximation is used only for polygons whose material contains a
displacement shader. Free-form and subdivision surfaces are always controlled
by their approximations. See
approximations for details.
An object group permits only one type of
geometry, either polygons or surfaces
but not both. It is recommended that objects contain only a single object
group, so normally objects are either polygonal or surface objects but not
both at the same time. Also, vector sharing is supported only for vectors
of similar types (point in space, normal, motion, texture, basis vector,
derivative, or user vector. A vector may not be referenced by vertices
once as a point in space and once as a normal, for example.
Copyright © 1986, 2015
NVIDIA ARC GmbH. All rights reserved.