|On this page|
vector occlusion(vector P, vector N, ...)
Computes ambient occlusion at the point P with the normal N. Just as in the irradiance function, the hemisphere is sampled. However, unlike irradiance, surfaces intersected during the hemisphere sampling are not shaded. For this function to work properly, either a constant background color or an environment map must be specified in the optional scope parameters.
void occlusion(float &coverage, vector &missed_direction, vector P, vector N, ...)
Instead of computing color information from ambient occlusion, this form computes the coverage (the percentage of occlusion) and the average direction of empty space. The average direction can be used to look up the color in a pre-blurred environment map.
Sample adaptation options
0. Turns on an automatic optimization that will reduce the
number of samples when there is little variation in occlusion
above the sample point. This can improve performance at the
expense of some possible flickering or additional noise.
When you specify a texture, such as with the
you can also use the image filtering keyword arguments. See environment
for a listing of the image filter keyword arguments.
A list of objects which can be hit by the rays. When specified,
scope overrides the default scope that would have been selected for the given
"scope:default" value will cause the
scope argument to use the default scope for the current context - as if the argument were not specified.
Allows an override of the scope for ray-intersections.
A special scope argument,
scope:self, will match the currently
The maximum distance to search for objects. This can be used to limit the search of objects to nearby objects only. If the
maxdist given is negative, then it will act as if there is no maximum distance.
Allows an override of the maximum distance the ray can travel when testing for intersections. Some functions (such as fastshadow) have the maximum distance implicitly defined (by the length of the ray) and should probably avoid using this option. However, this option can be used effectively when computing reflections, global illumination, refraction etc.
The name of a VEX export variable to use for variance anti-aliasing. The renderer compares the value with adjacent micropolygons in micropolygon rendering to decide what shading points need additional samples (using
vm_variance property as a threshold). If more samples are required, the algorithm takes samples up to the specified maximum ray samples.
This variable must be imported from the hit surface, so it must be in the list of imported names (see "importing information back from the ray" below). If the named variable is not imported, this option will be ignored.
Variance antialiasing puts more samples in areas of the image with high variance, for example a sharp shadow edge. It is only used when
vm_dorayvariance is enabled. Otherwise, only the min ray samples (or an explicitly supplied
"samples" value) are used for antialiasing of the gather loop.
Overrides the global variance control (mantra’s -v option) which is used to determine anti-aliasing quality of ray tracing. For more information please refer to the documentation on mantra.
The distribution angle (specified in radians). For gather(), rays will be distributed over this angle. For trace(), the angle is used to indicate the rate at which the filter width should increase with increasing intersection distance. Larger angles will cause farther hit surfaces to use larger derivatives, leading to improved texturing and displacement performance.
To be effective, the samples parameter should also be specified.
How many samples should be sent out to filter rays. For the irradiance and occlusion functions, specifying a samples parameter will override the default irradiance sampling.
If the ray sent out to the scene misses everything, then it’s possible to specify an environment map to evaluate.
Using the ray’s direction, the environment map specified will be evaluated and the resulting color will be returned. Most likely, it will be necessary to specify a transform space for the environment map evaluations.
In the case of refractlight and trace the Of and Af variables will be set to 0 regardless of the background color specified. the resulting color.
When an environment map is specified, the filtering options from texture() are also supported.
If an environment map is used, the orientation of the environment map can be specified by transforming the ray into the space of another object, light or fog object in the scene. In Houdini, null objects can be used to specify the orientation. For example:
Cf = R*reflectlight(bias, max(R), "environment", "map.rat", "envobject", "null_object_name");
If an environment map is used, the orientation of the environment map can be specified by transforming the ray into the space of a light in the scene.
If an environment map is used, tint it with this color.
If a ray misses all objects, use this as the background color of the scene. In the case of refractlight and trace the Of and Af variables will be set to 0 regardless of the background color specified.