Adaptive ray tracing suitable for shadow rendering
In examples, the number of rays used to sample lighting conditions of a light source in a virtual environment with respect to particular locations in the virtual environment may be adapted to scene conditions. An additional ray(s) may be used for locations that tend to be associated with visual artifacts in rendered images. A determination may be made on whether to cast an additional ray(s) to a light source for a location and/or a quantity of rays to cast. To make the determination variables such as visibilities and/or hit distances of ray-traced samples of the light source may be analyzed for related locations in the virtual environment, such as those in a region around the location (e.g., within an N-by-N kernel centered at the location). Factors may include variability in visibilities and/or hit distances, differences between visibilities and/or hit distances relative to the location, and magnitudes of hit distances.
1 . A computer-implemented method comprising:
analyzing one or more visibility characteristics corresponding to one or more locations in a scene to determine values of the one or more visibility characteristics for the one or more locations;
based at least on the analyzing indicating a variation in the values of the one or more visibility characteristics, computing one or more statistical measures quantifying one or more magnitudes of variability in the values;
based at least on determining the one or more statistical measures are greater than one or more threshold values, determining a quantity of rays to be cast from at least one location of the one or more locations to generate one or more samples of the scene, the quantity of rays including at least one ray; and
rendering at least a portion of the scene using the one or more samples.
2 . The method of claim 1 , wherein the values of the one or more visibility characteristics comprise at least one of:
visibility values; or
hit distance values.
3 . The method of claim 1 , wherein the determining the quantity of rays includes:
determining to cast one or more first rays of the quantity of rays from the at least one location based at least on the one or more visibility characteristics; and
determining to cast, in addition to the one or more first rays, one or more second rays of the quantity of rays from the at least one location based at least on one or more hit distance characteristics corresponding to the one or more locations.
4 . The method of claim 1 , wherein the values are determined using at least a first ray tracing pass, and the one or more samples are determined using at least a second ray tracing pass.
5 . The method of claim 1 , wherein the determining the quantity of rays includes scaling the quantity of rays in relation to the one or more magnitudes.
6 . The method of claim 1 , wherein the rendering produces a graphical depiction of one or more shadows, and the determining the quantity of rays is based at least on the analyzing indicating the at least one location corresponds to a penumbra of the one or more shadows.
7 . The method of claim 1 , wherein the one or more magnitudes comprise one or more deltas between at least two of the values.
8 . The method of claim 1 , wherein the one or more locations correspond to a group of pixels of a virtual screen and the rendering is of at least a portion of the virtual screen.
9 . The method of claim 1 , wherein the one or more locations include the at least one location and one or more second locations, and the analyzing is based at least on determining the one or more second locations based at least on one or more proximities of the one or more second locations to the at least one location.
10 . A system comprising:
one or more processors to perform operations including:
analyzing one or more hit distance characteristics corresponding to one or more locations in a scene to determine values of the one or more hit distance characteristics for the one or more locations;
based at least on the analyzing indicating a variation in the values of the one or more hit distance characteristics, computing one or more statistical measures quantifying one or more magnitudes of variability in the values;
based at least on determining the one or more statistical measures are greater than one or more threshold values, determining a quantity of rays to be cast from at least one location of the one or more locations to generate one or more samples of the scene, the quantity of rays including at least one ray; and
rendering at least a portion of the scene using the one or more samples.
11 . The system of claim 10 , wherein the one or more magnitudes of the one or more hit distance characteristics comprise hit distance values.
12 . The system of claim 10 , wherein the determining the quantity of rays is based at least on determining to cast one or more rays from the at least one location.
13 . The system of claim 10 , wherein the determining the quantity of rays includes:
determining to cast one or more first rays of the quantity of rays from the at least one location based at least on one or more visibility characteristics corresponding to the one or more locations; and
determining to cast, in addition to the one or more first rays, one or more second rays of the quantity of rays from the at least one location based at least on the one or more hit distance characteristics.
14 . The system of claim 10 , wherein the one or more locations comprise a plurality of locations and each value of the values corresponds to the one or more hit distance characteristics sampled from a respective location of the plurality of locations using a respective ray cast from the respective location.
15 . The system of claim 10 , wherein the rendering produces a graphical depiction of one or more shadows, and the determining the quantity of rays is based at least on the analyzing indicating the at least one location corresponds to a penumbra of the one or more shadows.
16 . At least one processor comprising:
processing circuitry to render at least a portion of a scene using one or more samples generated using a quantity of rays cast from at least one location of one or more locations in a scene based at least on:
an analysis of values of one or more characteristics corresponding to the one or more locations in the scene indicating a variation in the values of the one or more characteristics, computing one or more statistical measures quantifying one or more magnitudes of variability in the values; and
based at least on determining the one or more statistical measures are greater than one or more threshold values, a determination of the quantity of rays.
17 . The at least one processor of claim 16 , wherein the values of the one or more characteristics comprise at least one of:
hit distance values; or
visibility values.
18 . The at least one processor of claim 16 , wherein the one or more magnitudes correspond to one or more deltas between the values.
19 . The at least one processor of claim 16 , wherein the quantity of rays is determined based at least on:
determining to cast one or more first rays of the quantity of rays from the at least one location based at least on one or more visibility characteristics corresponding to the one or more locations; and
determining to cast, in addition to the one or more first rays, one or more second rays of the quantity of rays from the at least one location based at least on one or more hit distance characteristics corresponding to the one or more locations.
20 . The at least one processor of claim 16 , wherein the rendering produces a graphical depiction of one or more shadows, and the quantity of rays is determined based at least on the one or more characteristics indicating the at least one location corresponds to a penumbra of the one or more shadows.