6.2 Predefined Shader Variables
For each shader, some predefined variables are provided for input and output purposes. Here are the lists of variables for each shader type.
Variables with a `*' at the end of their description are available only inside illuminance constructs (see The Illuminance Construct) .
6.2.1 Predefined Surface Shader Variables
| Name | Type | Storage | Description
|
| Cs | color | varying
| Surface color.
|
| Os | color | varying
| Surface opacity.
|
| P | point | varying
| Surface position.
|
| dPdu | vector | varying
| Derivative of surface position along u.
|
| dPdv | vector | varying
| Derivative of surface position along v.
|
| N | normal | varying
| Surface shading normal.
|
| Ng | normal | varying
| Surface geometric normal.
|
| u, v | float | varying
| Surface parameters.
|
| du, dv | float | varying
| Change of surface parameters.
|
| s, t | float | varying
| Surface texture coordinates.
|
| E | point | uniform
| Position of the eye.
|
| I | vector | varying
| Incident ray direction.
|
| ncomps | float | uniform
| Number of color components.
|
| time | float | uniform
| Current shutter time, as specified by RiShutter.
|
| dtime | float | uniform
| The amount of time covered by this shading sample.
|
| dPdtime | vector | varying
| How the surface position P is changing per unit time, as described by motion blur in the scene.
|
| Ci | color | varying
| Same as Cs.
|
| Oi | color | varying
| Same as Os.
|
| L | vector | varying
| Incoming light ray direction. *
|
| Cl | color | varying
| Incoming light ray color. *
|
| Ol | color | varying
| Incoming light ray opacity. *
|
| Output
|
| Ci | color | varying
| Incident ray color.
|
| Oi | color | varying
| Incident ray opacity.
|
| P | point | varying
| Displaced surface position.
|
| N | vector | varying
| Displaced surface shading normal.
|
Table 6.5: Predefined Surface Shader Variables. |
6.2.2 Predefined Light Shader Variables
| Name | Type | Storage | Description
|
| P | point | varying
| Surface position on the light.
|
| dPdu | vector | varying
| Derivative of surface position along u.
|
| dPdv | vector | varying
| Derivative of surface position along v.
|
| N | normal | varying
| Surface shading normal on the light.
|
| Ng | normal | varying
| Surface geometric normal on the light.
|
| u, v | float | varying
| Surface parameters.
|
| du, dv
| float
| varying
| Change of surface parameters.
|
| s, t
| float
| varying
| Surface texture coordinates.
|
| L
| vector
| varying
| Outgoing light ray direction. *
|
| Ps
| point
| varying
| Position being illuminated.
|
| E
| point
| uniform
| Position of the eye.
|
| ncomps
| float
| uniform
| Number of color components.
|
| time
| float
| uniform
| Current shutter time, as specified by RiShutter.
|
| dtime
| float
| uniform
| The amount of time covered by this shading sample.
|
| I
| vector
| varying
| Incident ray direction. *
|
| Output
|
| Cl
| color
| varying
| Outgoing light ray color.
|
| Ol
| color
| varying
| Outgoing light ray opacity.
|
Table 6.6: Predefined Light source Variables |
6.2.3 Predefined Volume Shader Variables
| Name | Type | Storage | Description
|
| P | point | varying
| Light ray endpoint.
|
| I | vector | varying
| Ray direction (pointing toward P).
|
| E | point | uniform
| Position of the eye.
|
| Ci | color | varying
| Ray color.
|
| Oi | color | varying
| Ray opacity.
|
| ncomps | float | uniform
| Number of color components.
|
| time | float | uniform
| Current shutter time, as specified by RiShutter.
|
| dtime | float | uniform
| The amount of time covered by this shading sample.
|
| dPdu | vector | varying
| Derivative of surface position along u.
|
| dPdv | vector | varying
| Derivative of surface position along v.
|
| N | normal | varying
| Surface shading normal.
|
| Ng | normal | varying
| Surface geometric normal.
|
| u, v | float | varying
| Surface parameters.
|
| du, dv | float | varying
| Change of surface parameters.
|
| s, t | float | varying
| Surface texture coordinates.
|
| Cs | color | varying
| Same as Ci.
|
| Os | color | varying
| Same as Oi.
|
| Output
|
| Ci | color | varying
| Attenuated ray color.
|
| Oi | color | varying
| Attenuated ray opacity.
|
Table 6.7: Predefined Volume Shader Variables |
6.2.4 Predefined Displacement Shader Variables
| Name | Type | Storage | Description
|
| P | point | varying
| Surface position.
|
| dPdu | vector | varying
| Derivative of surface position along u.
|
| dPdv | vector | varying
| Derivative of surface position along v.
|
| N | normal | varying
| Surface shading normal.
|
| Ng | normal | varying
| Surface geometric normal.
|
| I | vector | varying
| Incident ray direction.
|
| E | point | uniform
| Position of the eye.
|
| u, v | float | varying
| Surface parameters.
|
| du, dv | float | varying
| Change of surface parameters.
|
| s, t | float | varying
| Surface texture coordinates.
|
| ncomps | float | uniform
| Number of color components.
|
| time | float | uniform
| Current shutter time, as specified by RiShutter.
|
| dtime | float | uniform
| The amount of time covered by this shading sample.
|
| dPdtime | vector | varying
| How the surface position P is changing per unit time, as described by motionblur in the scene.
|
| Output
|
| P | point | varying
| Displaced surface position.
|
| N | normal | varying
| Displaced surface shading normal.
|
Table 6.8: Predefined Displacement Shader Variables |
6.2.5 Predefined Imager Shader Variables
| Name | Type | Storage | Description
|
| P | point | varying
| Pixel raster position.
|
| Ci | color | varying
| Pixel color.
|
| Oi | color | varying
| Pixel opacity.
|
| u, v | float | varying
| Surface parameters. Set to pixel's raster coordinates.
|
| s, t | float | varying
| Surface texture coordinate. Set to pixel's raster coordinates.
|
| du, dv | float | varying
| Change of surface parameters. (du = 1.0 / x resolution, dv = 1.0f / y resolution ).
|
| alpha | float | uniform
| Fractional pixel coverage.
|
| ncomps | float | uniform
| Number of color components.
|
| time | float | uniform
| Shutter open time.
|
| dtime | float | uniform
| The amount of time the shutter was open.
|
| Output
|
| Ci | color | varying
| Output pixel color.
|
| Oi | color | varying
| Output pixel opacity.
|
| alpha | float | uniform
| Output pixel coverage.
|
Table 6.9: Predefined Imager Shader Variables |
3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.