photonmap VEX function

The photonmap function will evaluate a photon map and return the resulting color information.

Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex

  1. vector photonmap(string mapname, vector P, vector N)

The photonmap function will evaluate a photon map and return the resulting color information.

You can specify additional keyword,value argument pairs to set the behavior of the evaluation. These arguments must be defined at load time (literals or parameters).

To specify one of the additional arguments, pass the keyword as a string, with the next argument being the value for the keyword. For example ..., "wrap", "clamp", "border", {.1,1,1}).

Keyword Value

nphotons

Specifies the number of photons to use in the filtering process. This specifies the maximum number of photons which will be filtered to produce the final color.

The default is 50 photons.

type

This parameter specifies how the photons should be interpreted. There are two possibilities for the type of photon filtering:

diffuse (default)

Each photon will be scaled by the Lambertian cosine law.

irradiance

The raw energy of each photon will be used (without any filtering).

error

Specifies the “accuracy” for the lookup of photons in the photon map. This parameter determines the search radius to find photons in the map. Larger numbers will result in less accurate evaluations (i.e. smaller areas of the map will be scanned), while smaller number will result in larger areas of the map being scanned. The cost of filtering goes up as the error tolerance is decreased (meaning renders will take longer).

The default 0.001.

filter

Specifies the “filter” for computing the irradiance from photons. When evaluating photon contributions, the incoming radiance is divided by the area that the photons cover (to determine the flux). The area can be computed in three different fashions:

sphere (default)

The minimum bounding sphere of all photons will be used to estimate the area. This estimator will result in soft “blobby” looking photon evaluation. It can be inaccurate near edges of primitives.

convex

The convex hull of all photons is used to estimate the area. This estimator will result in slightly “sharper” edges in the photon evaluation, and can be more accurate near edges of primitives. However, since there are sharper edges, this estimator can produce very noisy evaluations.

direct

When evaluating direct illumination, the projected area of each photon is used independently of all other photons. This method causes very little blending and should only be used when evaluating direct illumination from photon maps.

Example:

Cf = photonmap(map, P, normalize(frontface(N, I)),
        "nphotons", 100,
        "type", "diffuse",
        "error", 0.05,
        "filter", "convex);