Keywords: main

Next: 1.9 Photon Up: 1. Base Shaders/A> Previous: 1.7 Data Conversion

# 1.8 Geometry

Cube

Generates an axis-aligned unit cube with volume 1 centered on the origin.

        geometry "mib_geo_cube" ()

There are no parameters.

Sphere

Generates a polygonal sphere with a given number of U and V subdivisions, centered on the origin. The sphere is subdivided with v_subdiv subdivisions in the Z axis (longitude) and u_subdiv subdivisions in the XY plane (latitude).

        geometry "mib_geo_sphere" (
            integer         "u_subdiv",
            integer         "v_subdiv")

*_subdiv specify the number of subdivisions in each parameter range. The shader uses default values for the subdivisions if u_subdiv is less than 3 or v_subdiv is less than 1.

Cone

Generates a polygonal cone centered on the Z axis with the apex at Z=0 and the base at Z=-1. The cone has a radius of 1 at the bottom and a height of 1. The cone bottom disc is subdivided into u_subdiv subdivisions, the cone side in v_subdiv subdivisions in the Z axis direction. A parameter controls whether the cone base is capped.

        geometry "mib_geo_cone" (
            integer         "u_subdiv",
            integer         "v_subdiv",
            boolean         "capped")

*_subdiv specify the number of subdivisions in each parameter range.

capped, if true, creates a cap that closes off the cone at the base.

The shader uses default values for the subdivisions if u_subdiv is less than 3 or v_subdiv is less than 0.

Cylinder

Generates a polygonal cylinder centered on the Z axis with the bottom at Z=-1 and the top at Z=0. The cylinder has a radius of 1 and a height of 1. The two cylinder discs are subdivided in u_subdiv subdivisions, the sides in v_subdiv subdivisions in the Z axis direction. A parameter controls whether the bottom or top is capped.

        geometry "mib_geo_cylinder" (
            integer         "u_subdiv",
            integer         "v_subdiv",
            boolean         "bottom_capped",
            boolean         "top_capped")

*_subdiv specify the number of subdivisions in each parameter range.

bottom_capped, if true, creates a cap that closes off the cylinder at the base.

top_capped, if true, creates a cap that closes off the cylinder at the top.

The shader uses default values for the subdivisions if u_subdiv is less than 3 or v_subdiv is less than 0.

Torus

Generates a polygonal torus lying in the XY plane, centered at the origin. The torus is defined by two circles: the smaller one revolves around the center of the larger circle. This shader was introduced with mental ray versions 3.0.1 and 2.1.47.38.

        geometry "mib_geo_torus" (
            scalar          "radius",
            scalar          "thickness",
            integer         "uSpans",
            integer         "vSpans")

radius is the radius of the large circle.

thickness is the radius of the small circle.

uSpans, vSpans specify the number of subdivisions in each parametric range.

If omitted (set to 0), parameters default to the following values: radius 2.0, thickness 1.0, uSpans 32, vSpans 32.

Square

Generates a square with area 1 centered on the origin, with the normal pointing up the positive Z axis.

        geometry "mib_geo_square" ()

There are no parameters.

Instance

Given one of the geometry shaders above, construct an instance that translates, scales, and rotates the geometry, and return a group with the instance of the source geometry as its only member. If the result was nonzero because the base shader is part of a list, do not create a new group but add the instance to the result group (this is normal geometry shader behavior).

        geometry "mib_geo_instance" (
            geometry        "object",
            miMatrix        "matrix",
            material        "material")

object is the object to be instanced.

matrix is the transformation matrix of the new instance. If it is a null matrix, use the identity matrix.

material is an inheritance material to store in the instance. It may be null.

Instance with Material List

This instance shader is the same as the previous but accepts a material array, which is converted into a material list in the new instance if the array has more than one member. Material lists are useful if the instanced object is tagged, meaning its polygons or surfaces carry integers that index into the material array.

        geometry "mib_geo_instance_mlist" (
            geometry        "object",
            miMatrix        "matrix",
            array material  "material")

object is the object to be instanced.

matrix is the transformation matrix of the new instance. If it is a null matrix, use the identity matrix.

material is an inherited material list to store in the instance. It may be null.

Add a Texture Surface

This shader returns a copy of the input object, which must be of freeform-surface type. It loops over all faces and adds a Bézier texture surface of degree 1 to each face as the last texture surface. The parameters and control points of the texture surfaces are chosen in such a way that there is an exact mapping of the parametric uv coordinates of the geometric approximation to the texture vertex coordinates, i.e. the texture coordinates of the triangle vertices are the uv coordinates of the triangle vertex positions. The Bézier basis is always added to the copy of the object.

        geometry "mib_geo_add_uv_texsurf" (
            geometry        "object")
    end declare

object is the freeform surface object that will be copied.

Next: 1.9 Photon Up: 1. Base Shaders/A> Previous: 1.7 Data Conversion