Getting UV Data

Within Softimage, users can associate UV data with an object. This data can be computed by a projection and explicitly stored in a UV property on the object or can be computed implicitly by the shader at the location where the ray hits the surface.

If a shader requires UV data, the shader must have an input parameter of type texturespace in the SPDL. Usually, this parameter is inspected using the TextureSpaceItem widget. This widget allows the user to select the name of the UV property to use, or to specify a wildcard string to match against UV property names. Softimage will ensure that when raytracing begins, all UV properties required by the shaders in the render tree are available for use.

Although the user enters the string name of the UV property to use, the shader is given an integer index. In other words, a parameter of type texturespace in the SPDL file is of type miInteger in the C implementation.

• If the index is greater than or equal to zero, the integer is an index into the array state->tex_list[], provided in the miState passed to the shader when called. This array contains the interpolated UV coordinates at the location where the ray hit the object. The index provided to the shader indicates which element of the array contains the data the user chose in the shader property page.

• If the index is less than zero, the UV coordinate must be computed implicitly by the shader.

In addition, the user can specify a variety of transformations to be performed on the UV coordinate.

To get the correct UV coordinates on an object, the shader using the coordinate should be encapsulated into a Phenomena with the basic mental ray shader mib_remap_parameter and Softimage shader sib_uvwgen to compute the UV coordinates. The resulting UV coordinates from the basic shaders can then be supplied to the shader requiring the coordinates.

An advantage of this approach is that you’re guaranteed to have the correct UV computations performed.

The base shader sib_texproj_lookup.spdl can be used to extract coordinates, or used as a basis for creating your own Phenomena. The most important thing to note from this file is that many of the parameters are not actually visible to the user. The values are set by Softimage, depending on the texture projection the user chooses in the interface. Softimage recognizes the following flag and places the correct parameter in the correct location.

   ui "mapping" = "{ Guid }";


Autodesk Softimage v7.5