[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
illuminate()
or solar()
statement.
uniform float __nondiffuse
will ony be evaluated if the parameter is set to 0.
uniform float __nonspecular
will ony be evaluated if the parameter is set to 0.
specular()
but receives a L variable (incoming light vector) enabling it to run in custom illuminance()
loops.
specular
, we
provide this function in case you need the standard specular model described in all graphic books. specularstd()
is implemented as follows:
color specularstd( normal N; vector V; float roughness ) { extern point P; color C = 0; point Nn = normalize(N); point Vn = normalize(V); illuminance(P, Nn, PI/2) { extern vector L; extern color Cl; vector H = normalize(normalize(L)+Vn); C += Cl * pow(max(0.0, Nn.H), 1/roughness); } return C; } |
specular()
, this function is also sensitive to the __nonspecular
light shader parameter.
Attribute "visibility" "trace"
, section 4.2 Attributes). If the optional dist parameter is specified, it will contain the distance to the intersection point or a very large number (> 1e30) if no intersections found. Note that Pt and R must lie in `current' space.
trace()
since it might avoid costly shading operations. Pt and R must lie in `current' space.
color 1
if unoccluded and color 0
if totally occluded. Inbetween values indicate the presence of a translucent surface between Pt1 and Pt2. Only objects tagged as visible to transmission/shadow rays will be considered during the operation (using Attribute "visibility" "transmission"
, section 4.2 Attributes). Pt1 and Pt2 must lie in `current' space.
Attribute "irradiance" "nsamples"
, see section 4.2 Attributes. occlusion()
accepts optional token/value pairs, those are explained in the table below. Pt and R must lie in `current' space.
EXAMPLE
/* Returns the amount of occlusion using default number of samples */ float hemi_occ = occlusion( P, Ng ); /* Returns the amount of occlusion for the hemisphere surrounding P, uses a rough approximation with 8 samples */ hemi_occ = occlusion( P, Ng, 8 ); /* Same as above, but only consider objects closer than 10 units and in a solid angle of Pi/2 */ hemi_occ = occlusion( P, Ng, 8, "maxdist", 10, "angle", PI/4 ); /* Same as above, but only consider light coming from an hemisphere oriented toward (0,1,0) */ uniform vector sky = vector (0, 1, 0); hemi_occ = occlusion( P, Ng, 8, "maxdist", 10, "angle", PI/4, "axis", sky ); |
"environmentmap"
parameter as shown in the table below. Computing the occlusion while calling this function is also possible (through the occlusion
parameter), with the following two restrictions:
axis
parameter to indirectdiffuse()
as with occlusion()
;
indirectdiffuse()
only sees geometry tagged as visible to reflections, as opposed to occlusion()
which sees geometry visible to shadows. For more informations about visibility attributes refer to section 4.2 Attributes.
Name | Type | Default | Description |
"angle" | uniform float
| PI/2 | Controls the solid angle considered, default covers the entire hemisphere; |
"axis" | uniform vector
| -- | If specified, and different from vector 0 , indicates the direction of the light casting hemisphere. Rays that are not directed toward this axis will not be considered. This is useful for specifying skylights. This has not effect on indirect diffusion computations, only occlusion() shadeop uses this parameter. axis doesn't have to be of unit length;
|
"bias" | uniform float
| 0.01 | Bias to add when intersecting surfaces to avoid precision related self-intersections. Default value taken from Attribute "trace" "bias" , see section 4.2 Attributes;
|
"maxdist" | uniform float
| 1e38 | Only consider intersections closer than this distance; |
"environmentmap" | uniform string
| "" | Specifies an environment map to lookup when a sampled ray doesn't hit any geometry. Only available in the indirectdiffuse() shadeop;
|
"environmentdir" | output varying vector
| -- | If specified, will be set to the averange un-occluded direction, which is the average of all sampled directions that did not hit any geometry. Note that this vector is defined in `current' space, so it is necessary to transform it to `world' space if an environment() lookup is intended.
|
occlusion()
and indirectdiffuse()
optional parameters.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |