MetaSL specification 1.2.2
14 March 2011

MetaSL light 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.
light_area uniform float The area in m2 of the light source in case of proper area lights. For light sources with no area at all, e.g. point lights, this is DIRAC_DELTA. For infinite light sources, this is undefined.
light_direction uniform float3 The direction of the light. This vector is unit length and points away from light_position. It is not defined for point lights.
light_distance float The distance between the surface point and the light point. It is not defined for infinite lights.
light_distance_limit uniform float Specifies the distance from light_position beyond which no light is received.
light_dot_nl float The dot product of the surface normal and the negated light_to_surface unit vector.
light_normal float3 The normal at the sample point on the surface of an area light. This vector is unit length.
light_position float3 The position of the sample point on the light. It is not defined for infinite lights. For planar lights, the light position lies on the line defined by light_direction and the surface position.
light_spread uniform float Defines a cone centered around light_direction. Light is not cast outside the cone. The value of light_spread is given in radians and measures the angle between light_direction and the side of the cone.
light_spread_cos uniform float The cosine of light_spread. This value is provided so that the light_spread can be directly compared to the dot product of light_to_surface and light_direction. If the result of this dot product is less than light_spread_cos then the surface point is outside the cone and is not illuminated.
light_texture_coordinate float4[] Additional texture spaces for the surfaces of area lights.
light_texture_tangent_u float3[] The array of tangent vectors for each light texture space. The tangent vector is a unit length vector in the plane defined by the light 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 light surface normal.

Note: This state variable is also available under the name light_texture_tangent, as it was named in MetaSL 1.0.
light_texture_tangent_v float3[] The array of bitangent vectors for each light texture space. The bitangent vector is a unit length vector in the plane defined by the light surface normal, which points in the general direction of the positive v axis of the corresponding texture space, but is orthogonal to both the surface normal and the tangent of the corresponding light texture space.

Note: This state variable is also available under the name light_texture_binormal, as it was named in MetaSL 1.0.
light_to_surface float3 A unit vector that points from the light position to the surface position, except for infinite lights where it is defined as light_direction. Note that for planar lights, by the definition of light_position, this value coincides with light_direction as well.
light_type uniform String The type of the light object for which the light shader has been invoked. The value can be one of the following, unless it is an area light, in which case light_area is greater than zero:

"light_point" – A point light. Light is cast in all directions from the position of the light, light_position.

"light_spot" – A spot light. Light is cast only within a cone originating in light_position and pointing in the light_direction direction with the light_spread opening angle.

"light_infinite" – An infinite light. Light rays are parallel and are emitted in the light_direction direction from a point infinitely far away.

"light_planar" – A planar light. Light rays are parallel as they are for an infinite light except light is only cast on the side of the plane defined by light_direction and light_position.
light_uv float2 The surface parameter of the sample point on an area light.
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.
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
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.