Shading State shaders

 

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.

 

Float

NameVariableDescription
Screen XYsx, syXY image-space coordinate, in range [-1,1).
Shutter TimetimeFor motion blur, the absolute time at which the current sample is being shaded. A value between shutter-open and shutter-close times.
Ray LengthRlFor 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 UVbu, bvFor triangles, barycentric coordinate within the triangle. For curves, parametric coordinate along the curve length and width respectively.
Surface UVu, vUV coordinates typically used as texture coordinates. Same as bu and bv in case no uvlist or uvs parameter was provided.
Shaded AreaareaThe 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 Derivativesdudx, dudy, dvdx, dvdyUV derivative with respect to the XY pixel coordinates. This contains the rate of change of the UV from the current pixel to the neighbouring 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

NameVariableDescription
Raster X / Yx, yRaster-space pixel coordinate the camera ray started from.
Subpixel Sample IndexsiAA sample index, in range [0, AA_samples].
Ray TypeRtRay type of the incoming ray.
Transparency Indextransp_indexNumber of transparent surfaces shaded before current shading point.
Thread IDtidUnique thread ID.
BouncesbouncesNumber of bounces up to the current shading point.
Diffuse Bouncesbounces_diffuseNumber of diffuse bounces.
Specular Bouncesbounces_specularNumber of specular bounces.
Reflection Bouncesbounces_reflectNumber reflection bounces.
Transmission Bouncesbounces_transmitNumber of transmission bounces.
Volume Bouncesbounces_volumeNumber of volume bounces.
Force Hemispherical LightingfhemiForce hemispherical lighting.
Primitive IDfiPrimitive ID (triangle, curve segment, etc) .
Number of Active LightsnlightsNumber of active lights affecting shading point.
Inclusive Tracesetinclusive_tracesetIf a traceset is used, is it inclusive or exclusive?
Skip Shadow Raysskip_shadowIf true, don't trace shadow rays for lighting.
Shading ContextscType of shading context (surface, displacement, volume, background, importance).

Vector

NameVariableDescription
Ray Origin RoFor surfaces, ray origin (camera or previous bounce position). For volumes, start of the volume segment being shaded.
Ray DirectionRdRay direction from ray origin to shading point. For volumes, direction of volume segment being shaded.
Shading Point in Object-SpacePoShading position in object-space.
Shading Point in World-SpacePShading position in world-space.
Surface Derivative wrt Screen XY dPdx, dPdySurface derivative with respect to XY pixel coordinates.
Shading Normal NShading normal, including smooth normals and bump mapping.
Face-Forward Shading Normal NfFace-forward shading normal.
Geometric Normal NgNormal of the actual geometry, without smoothing or bump.
Face-Forward Geometric Normal NgfFace-forward geometric normal.
Smoothed Normal without BumpNsSmoothed normal (same as N but without bump).
Surface Derivative wrt UV dPdu, dPdvSurface 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, dDdyRay direction derivative wrt XY pixel coordinates.
Surface Normal Derivative wrt Screen XY dNdx, dNdyDerivative of surface normal with respect to XY pixel coordinates.

 

Examples
  • No labels