vector filter_remap(vector2 uv, string filter, float width, ...)
This function maps a uv coordinate to a pixel offset based on the importance sampling of the filter.
Components should be in the range
1. The function remaps these coordinates into a point in the filter’s kernel, mapping more points to areas with higher weights. The returned points will be in a box of given width centered around
The type of filter to use.
Bartlett filter (Cone filter)
The filter width.
A unit box filter will map the input values to the range
0.5. Changing the
2.0 will result in returned values in the range
-1.0 to 1.0.
For a Gaussian filter, for example, a
2.0 is more appropriate.
When building lookup tables for importance sampling, the filter is sampled radially at this resolution.
The returned vector’s
y components are the given uv coordinate remapped to pixel coordinates (centered around zero). The
z component is the approximate weight of the kernel at the returned sample.
Note that some filters (
"catrom"), have negative weights in some areas. When importance sampling, you cannot use negative values, so you should use the absolute value of the weight (using abs). However, some applications need to know whether the returned sample had a negative weight.