rmanwiki.pixar.com will be down for maintenance between 6-7pm Pacific time on 2023-01-30.
Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • eyePath
  • lightPath
  • primaryHit
  • missContext
  • reyesGrid

Accessing RIS builtin Variables

Things that are accessible via the RIS GetBuiltin shading call are exposed in OSL via

getattribute("builtin", "varname", val); 

unless they are already available via standard OSL globals.  The following are available via this call (see the RixShading documentation for their definitions):

  • Po
  • PRadius
  • Non
  • Naon
  • Tn
  • curvature
  • curvatureU
  • curvatureV
  • Id
  • Id2
  • incidentRaySpread
  • incidentRayRadius
  • incidentLobeSampled
  • mpSize
  • motionBack
  • biasR
  • biasT
  • du
  • dv
  • dw
  • dPdu
  • dPdv
  • dPcameradtime
  • outsideIOR
  • wavelength
  • Oi

Note that the du/dv/dw/dPdu/dPdv values obtained this way during ray-traced hit shading will represent radius based differentials as used throughout RIS, instead of the usual diameter based differentials provided in OSL globals and via implicit differentiation via Dx()/Dy() calls.

Implicit Derivatives

OSL uses implicit differentiation to track the derivatives of variable where needed.  RenderMan maps the x and y space of derivatives to the implicit u and v space of the underlying geometry.  Implicit derivatives are used to control texture filtering, and can also be used to create new shading normals for bump-mapping. However, this only works if the original values coming from the renderer are "primed" with derivatives, because they must be computed along with the variables from those initial values, transformed through other mathematical operations, until they are used in a texture() or calculatenormal() call.  The main place these derivatives will come from is the shader global P, and indeed prman primes this shader global with appropriate derivatives.  Additionally, interpolated varying primitive variables on the geometry that are accessed with getattribute("primvar","primvarname",value), or simply just getattribute("primvarname", value)  will have derivatives provided. 

...