Scalar State
 
 
 

| Render Tree Usage

Category: Data > Shading State

Shader Family: Texture

Output: Scalar

Makes scalar-type parameters available in the raytracing state structure. This node is intended for Shader developers who require low-level information during the raytracing process.

You should have some shader-writing knowledge in either mental ray 1.9, 2.0, or 2.1 in order to use this tool properly.

Name

The shader's name. Enter any name you like, or leave the default.

State

Lets you choose one of the following scalar-type parameters:

Ray Length -- Returns the length of the last ray to intersect the surface being evaluated.

Screen Position: Raster X -- Returns the X coordinate in raster space of the pixel being evaluated, ranging from [0..RESX-1].

Screen Position: Raster Y -- Returns the Y coordinate in raster space of the pixel being evaluated, ranging from [0..RESY-1].

Motion Blur Time -- Returns the shutter time of the evaluated pixel. This is useful for making a texture appear or disappear as motion blur is applied to an object. Express as [0..shutter_speed].

Index of Refraction of Outgoing Ray -- Returns the IOR of the ray leaving the surface being evaluated.

Index of Refraction of Incoming Ray -- Returns the IOR of the ray entering/hitting the surface being evaluated.

Dot of Surface Normal -- Returns the dot product of the surface normal and eye camera ray (incidence).

Barycentric A / Crosswise Hair returns values from 0 to 1 along the width of the hair (from one edge to the other: 0 > 1 > 0).

Barycentric B / Lengthwise Hair returns values from 0 to 1 along the length of the hair, with 0 being the root and 1 being the tip.

Barycentric C / Spline Hair Interpolant assigns a number to each hair created from curves. This number is based on where it originates within the collection of guide hairs (curves). If you have three curves, a hair that is generated between curve 1 and 2 gets assigned a number between 0 and 0.5 depending on its proximity to either curve.

Barycentric hair parameters let you define more accurate specular color along a hair strand, as well as map custom values over hair or create a surface for curve hairs upon which you can apply textures.

Barycentric coordinates give the coordinates of a point relative to the triangle it is on as a weight of the three corner vertices, normalized so that the sum is 1. That means that from the barycentric coordinates of a point, you can get the "real" coordinates of the point.

Render Tree Usage

This shader is usually used at the left end of a render tree effect to define a scalar's input value for a shader. In a simple example, you could use this shader to define the Factor of the Intensity shader. You can also use the Barycentric B and C states to extract the surface interpolation value of the hair between curves to create a surface for mapping.