The shadowmap function will treat the shadow map as if the image were rendered from a light source.
float shadowmap(string filename, vector Pndc, float spread, float bias, float quality)vector shadowmap(string , vector , float , float , float )float shadowmap(string , vector , float , float , float )vector shadowmap(string , vector , float , float , float )vector shadowmap(string , vector , vector , vector , vector , float , float , float )
Note
The shadowmap() operation that takes 4 vectors allow you to specify your own sampling rectangle. If you don’t want any filtering of the shadow map or you are unable to compute your own derivatives, you can just pass in the same vector repeated 4 times to perform no filtering.
Overview
The shadowmap function will treat the shadow map as if the image were
rendered from a light source. You use this to access both depth maps and
deep shadow maps. In both cases it returns a vector where each color
component has the visibility of the light source to the point for that
color.
Pndc is the position of the point being shaded in the NDC space of
the light’s projection. spread is a softness control on the shadow.
bias controls how accurate the depth samples need to be. quality
is a general control to increase/decrease sampling, where 1 is default
quality.
Note
This function returns the fractional amount of illumination which reaches the sample point. For example, if the point is fully in shadow, the return value will be 0, if it is fully illuminated, the return value will be 1.
Deep camera map channels
If the shadow map is an Deep camera map,
shadowmap takes an optional extra argument "channel", followed by the
string name of the channel in the map evaluate.
shadowmap(mapname, pz, spread, bias, quality, "channel", channel);
This uses the same opacity semantics, so the function will return the complement of the actual color. So, to get accurate results, you will usually want to evaluate:
{1,1,1} - shadowmap(...);