User's Reference - Shade

### Shade

Category

Rendering

Function

Specifies the shading attributes of an object.

Syntax

    output = Shade(input, shade, how, specular, shininess, diffuse,
                   ambient);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`input` | object | none | object to be shaded
`shade` | flag | 1 | 0: object not shaded 1: object shaded
`how` | string | none | ("smooth" or "faceted")
`specular` | scalar | none | specular coefficient (standard = 0.5)
`shininess` | integer | none | shininess exponent (standard = 10)
`diffuse` | scalar | none | diffuse coefficient (standard = 0.7)
`ambient` | scalar | none | ambient coefficient (standard = 1.0)

Outputs

Name | Type | Description
--- | --- | ---
`output` | field | shaded object

Functional Details

This module is applicable only to surface objects (i.e., objects with connections of type "triangle" or "quad").

`input` | specifies the object whose shading attributes are to be modified.
`shade` | turns shading on or off. By default, the module turns shading on.
`how` | specifies whether the shading is to be smooth or faceted. If this parameter is not set, and: if the input object is already shaded, the shading method is not changed. if the object is not shaded, the choice between smooth and faceted shading is determined by the dependency of the "data" component, if it has a data dependency: smooth shading is used for position-dependent data. faceted shading is used for connection-dependent data. if no data are present, smooth shading is used. An explicit specification of "smooth" or "faceted" shading will apply to all objects. However, if a "normals" component of the requested type ("dep" "positions" or "dep" "connections") is already present, the normals are not recomputed.

The next four parameters specify the particular shading attributes of the object. If any of these parameters are not explicitly set, the corresponding attributes remain unchanged.

`specular` | specifies the amount of light reflected by the object (as from a very smooth, highly reflective surface). The specified value must be between 0 and 1. The default is 0.5.
`shininess` | specifies how sharp the specular highlight is. The specified value must be an integer. Larger numbers result in a smaller, sharper, specular highlight. The default is 10.
`diffuse` | specifies how much light is diffused by the object (as from a rough non-reflective surface). The specified value must be between 0 and 1. The default is 1 (one).
`ambient` | specifies how much light is reflected equally in all directions. The specified value must be between 0 and 1.

Notes:

1. The Shade module will also check whether the orientation of the "connections" component is consistent with the directions of the "normals". If they are not consistent, it will modify the directions of the normals.

2. Smooth shading is not supported for faces, loops, and edges data. However, faces, loops, and edges can be converted to triangles using Refine, and can then be smooth-shaded.

Components

May add or modify the "normals" component. All other components are unchanged.

Example Visual Programs

    AlternateVisualizations.net
    Imide_potential.net
    UsingShade.net

See Also

Render, Display, Image

[ OpenDX Home at IBM | OpenDX.org ]