The State nodes allow access to ray and geometric properties such as the surface normal, the UV surface parameters, ray depth etc. The nodes are separated into float, int and vector data types.

## An example scene file can be downloaded here. |
---|

#### Float

Name | Variable | Description |
---|---|---|

Screen XY | `sx, sy` | XY image-space coordinate, in range [-1,1). |

Shutter Time | `time` | For motion blur, the absolute time at which the current sample is being shaded. A value between shutter-open and shutter-close times. |

Ray Length | `Rl` | For surface shaders, the ray length from the camera or previous bounce to the shading point. For volume shaders, the length of the volume segment being shaded. |

Barycentric UV | `bu, bv` | For triangles, barycentric coordinate within the triangle. For curves, parametric coordinate along the curve length and width respectively. |

Surface UV | `u, v` | UV coordinates typically used as texture coordinates. Same as bu and bv in case no uvlist or uvs parameter was provided. |

Shaded Area | `area` | The differential area covered by the current shading point, typically used for texture filtering. For surface shaders this the area spanned by ray differentials, for displacement shaders it is the average area of triangles surrounding the vertex. |

UV Derivatives | `dudx, dudy, dvdx, dvdy` | UV derivative with respect to the XY pixel coordinates. This contains the rate of change of the UV from the current pixel to the neighboring pixels to the right and top, typically used for texture filtering. |

Shutter start and end | Absolute start and end time of the motion blur range. |

#### Int

Name | Variable | Description |
---|---|---|

Raster X / Y | `x, y` | Raster-space pixel coordinate the camera ray started from. |

Subpixel Sample Index | `si` | AA sample index, in range [0, AA_samples]. |

Ray Type | `Rt` | Ray type of the incoming ray. |

Transparency Index | `transp_index` | The number of transparent surfaces shaded before the current shading point. |

Thread ID | `tid` | Unique thread ID. |

Bounces | `bounces` | The number of bounces up to the current shading point. |

Diffuse Bounces | `bounces_diffuse` | The number of diffuse bounces. |

Specular Bounces | `bounces_specular` | The number of specular bounces. |

Reflection Bounces | `bounces_reflect` | Number reflection bounces. |

Transmission Bounces | `bounces_transmit` | The number of transmission bounces. |

Volume Bounces | `bounces_volume` | The number of volume bounces. |

Force Hemispherical Lighting | fhemi | Force hemispherical lighting. |

Primitive ID | `fi` | Primitive ID (triangle, curve segment, etc) . |

Number of Active Lights | `nlights` | The number of active lights affecting shading point. |

Inclusive Traceset | `inclusive_traceset` | If a traceset is used, is it inclusive or exclusive? |

Skip Shadow Rays | `skip_shadow` | If true, don't trace shadow rays for lighting. |

Shading Context | `sc` | Type of shading context (surface, displacement, volume, background, importance). |

#### Vector

Name | Variable | Description |
---|---|---|

Ray Origin | `Ro` | For surfaces, ray origin (camera or previous bounce position). For volumes, the start of the volume segment being shaded. |

Ray Direction | `Rd` | Ray direction from ray origin to shading point. For volumes, the direction of the volume segment being shaded. |

Shading Point in Object-Space | `Po` | Shading position in object-space. |

Shading Point in World-Space | `P` | Shading position in world-space. |

Surface Derivative wrt Screen XY | `dPdx, dPdy` | Surface derivative with respect to XY pixel coordinates. |

Shading Normal | `N` | Shading normal, including smooth normals and bump mapping. |

Face-Forward Shading Normal | `Nf` | Face-forward shading normal. |

Geometric Normal | `Ng` | Normal of the actual geometry, without smoothing or bump. |

Face-Forward Geometric Normal | `Ngf` | Face-forward geometric normal. |

Smoothed Normal without Bump | `Ns` | Smoothed normal (same as N but without bump). |

Surface Derivative wrt UV | `dPdu, dPdv` | Surface derivative with respect to UV coordinates (not normalized). May be used as tangent for anisotropic shading or vector displacement. |

Ray Direction Derivative wrt Screen XY | `dDdx, dDdy` | Ray direction derivative wrt XY pixel coordinates. |

Surface Normal Derivative wrt Screen XY | `dNdx, dNdy` | The derivative of the surface normal with respect to XY pixel coordinates. |