MetaSL specification 1.2.2
14 March 2011

MetaSL surface shader state variables

State variable Data type Description
animation_frame uniform int The current frame number
animation_time float The time of the current sample in seconds, including the time within the shutter interval
aperture uniform float The camera's aperture.
aspect_ratio uniform float The pixel aspect ratio (width divided by height).
backside bool Set to true when the ray hits the geometry from behind. In this case both the normal and geometry_normal are inverted.
camera_offset uniform float2 The camera plane offset in pixels.
direction float3 The ray direction. This vector is unit length and is dependent on origin and position.
dof_focus uniform float The distance from the camera position to the focal plane.
dof_radius uniform float The depth of field radius.
dot_nd float The dot product of the normal and the ray direction. This variable is dependent on normal and direction.
far_clip uniform float The distance to the far clipping plane.
focal_length uniform float The camera's focal length.
geometry_normal float3 The true surface normal for the current geometry. This vector is unit length.
image_x_resolution uniform int The width of the image in pixels.
image_y_resolution uniform int The height of the image in pixels.
importance float The effect of the current shader on the final pixel color (ranges from 0 to 1).
incident_ior float The index of refraction of the medium that contains the incident ray. The range of this value is ≥ 1.
inside bool Set to true when the current ray is intersecting the surface from inside the volume defined by the surface. The value of inside can be different from backside when the surface normals are oriented such that the front side of the surface faces the interior of the volume.
motion float3 Tangential motion vector
near_clip uniform float The distance to the near clipping plane.
normal float3 The surface normal for shading. This vector is unit length. (Read/write.)
origin float3 The ray origin
orthographic uniform bool Set to true if all eye rays are parallel.
parametric_uv float2 The parametric uv coordinate for the surface.
position float3 The intersection point on the surface (Read/write.)
raster float2 The raster coordinates for the fragment being rendered, in raster space.
ray_length float The length of the current ray. This value is dependent on origin and position.
ray_shader String The type of the current shader.
ray_type String The type of the current ray.
refracted_ior float The index of refraction of the medium which will contain the refracted ray. The range of this value is ≥ 1.
shutter_close float The time in seconds of the end of the shutter interval.
shutter_duration uniform float The length of the shutter interval in seconds. This variable is dependent on shutter_open and shutter_close.
shutter_open float The time in seconds of the beginning of the shutter interval.
shutter_position float The normalized position within the shutter interval. This variable will have the value 0.0 at the start of the interval and 1.0 at the end, and is dependent on shutter_open, shutter_close and animation_time.
shutter_time float The point in time within the shutter interval in seconds. The shutter_time will have the value 0.0 at the beginning of the shutter interval. This value is dependent on animation_time and shutter_open.
tangent_space float3x3[] The array of tangent space matrices for each texture space. These matrices are available as a convenience and are constructed from the texture_tangent_u, texture_tangent_v, and surface normal as the x, y, and z axis of the coordinate system, respectively.
texture_coordinate float4[] The array of texture spaces.
texture_du float3[] The array of surface derivatives with respect to the u direction of the specified texture space. This array contains derivatives for each texture space. It is similar to texture_tangent_u except that the vectors in texture_du are not normalized or necessarily orthogonal to texture_dv or normal.
texture_dv float3[] The array of surface derivatives with respect to the v direction of the specified texture space. This array contains derivatives for each texture space. It is similar to texture_tangent_v except that the vectors in texture_dv are not normalized or necessarily orthogonal to texture_du or normal.
texture_tangent_u float3[] The array of tangent vectors for each texture space. The tangent vector is a unit length vector in the plane defined by the surface normal, which points in the direction of the projection of the tangent to the positive u axis of the corresponding texture space onto the plane defined by the original surface normal. Note that tangent vectors are not dependent on the surface normal; they are not automatically updated if the surface normal changes.

Note: This state variable is also available under the name texture_tangent, as it was named in MetaSL 1.0.
texture_tangent_v float3[] The array of bitangent vectors for each texture space. The bitangent vector is a unit length vector in the plane defined by the surface normal, which points in the general direction of the positive v axis of the corresponding texture space, but is orthogonal to both the original surface normal and the tangent of the corresponding texture space. Note that tangent vectors are not dependent on the surface normal; they are not automatically updated if the surface normal changes.

Note: This state variable is also available under the name texture_binormal, as it was named in MetaSL 1.0.
unit_spectrum_sample Spectrum A sampled spectrum that has value one at all wavelengths given in wavelength_sample and zero elsewhere.
wavelength_base const float[] Array of wavelengths, in increasing order, that are recommended when constructing spectra to achieve best approximation results . Wavelengths are given in nanometers (nm). Each wavelength λ is between the shortest and longest wavelengths considered for spectra, i.e., WAVELENGTH_MIN ≤ λ ≤ WAVELENGTH_MAX.
wavelength_sample float[] Array of wavelengths, in increasing order, that are considered for sampled spectra . Wavelengths are given in nanometers (nm). Each wavelength λ is between the shortest and longest wavelengths considered for spectra, i.e., WAVELENGTH_MIN ≤ λ ≤ WAVELENGTH_MAX.
window_bottom uniform int When rendering a cropped region, this specifies the size of the bottom margin in pixels.
window_left uniform int When rendering a cropped region, this specifies the size of the left margin in pixels.
window_right uniform int When rendering a cropped region, this specifies the size of the right margin in pixels.
window_top uniform int When rendering a cropped region, this specifies the size of the top margin in pixels.
zero_spectrum_sample Spectrum A sampled spectrum that has value zero everywhere.


© 2011 NVIDIA ARC GmbH. All rights reserved.