Stochastic texture filtering
Stochastic texture filtering introduces randomness into texel sampling and/or filtering. Instead of computing a closest texel for the texture coordinates, randomness is introduced by stochastic sampling to obtain one texel. Stochastic sampling is also applied for filtering the texels when multiple samples are used and/or to perform temporal filtering. A first technique is used for discrete filters and filter-specific sample weights are generated. In contrast with conventional techniques, the sample weights are not applied directly to the single texel value. The single texel is randomly selected for each pixel, with probability proportional to an associated sample weight. A second technique is used for continuous filters and weights are not generated. Instead, the texture coordinates are perturbed with a random offset, which is drawn from a filter-specific probability distribution. Stochastic texture filtering improves the performance of texture filtering in terms of speed and quality and is compatible with image reconstruction techniques.
1 . A system, comprising:
a memory that stores a texture map comprising texels associated with a plurality of integer texture coordinates; and
a processor that is connected to the memory, wherein the processor is configured to perform stochastic texture filtering by:
obtaining texture coordinates associated with rendered geometry that intersects a pixel;
generating, for a discrete texture filter, sample weight probabilities corresponding to integer texture coordinates that are calculated from the texture coordinates;
selecting a single texel stored in the texture map using a stochastic value and the sample weight probabilities; and
producing a filtered color for the pixel based on the single texel.
2 . The system of claim 1 , further comprising selecting at least one additional texel stored in the texture map using an additional stochastic value.
3 . The system of claim 2 , wherein a number of the at least one additional texel varies based on a frame rate.
4 . The system of claim 2 , wherein the producing comprises averaging the single texel with the at least one additional texel without applying the sample weight probabilities to the single texel or the at least one additional texel.
5 . The system of claim 1 , further comprising:
in response to detecting a disocclusion, selecting an additional texel stored in the texture map using an additional stochastic value; and
combining the additional texel with the texel to produce the filtered color.
6 . The system of claim 1 , further comprising dynamically adjusting, based on a target frame rate, a number of texels selected from the texture map for the pixel using additional stochastic values and the sample weight probabilities.
7 . The system of claim 1 , wherein a driver replaces texture processing code with instructions that cause the processor to perform the stochastic texture filtering.
8 . The system of claim 1 , wherein the stochastic value is a low-discrepancy random number or is selected from a particular distribution.
9 . The system of claim 1 , wherein the stochastic value is provided by a user, hardware-generated, or read from a table.
10 . The system of claim 1 , wherein producing the filtered color comprises combining multiple texels for the pixel over time.
11 . The system of claim 1 , wherein the discrete texture filter comprises one of a cubic B-spline polynomial, Mitchell polynomial, Gaussian, parametric, or program.
12 . The system of claim 1 , wherein at least one of the obtaining, generating, selecting, or producing are performed on a server or in a data center to generate an image, and the image is streamed to a user device.
13 . The system of claim 1 , wherein at least one of the obtaining, generating, selecting, or producing are performed within a cloud computing environment.
14 . The system of claim 1 , wherein at least one of the obtaining, generating, selecting, or producing are performed for training, testing, or certifying a neural network employed in a machine, robot, or autonomous vehicle.
15 . The system of claim 1 , wherein the processor comprises a graphics processing unit and at least one of the obtaining, generating, selecting, or producing are performed on a virtual machine comprising a portion of the processor.
16 . The system of claim 1 , further comprising:
obtaining additional texture coordinates associated with an additional pixel; and
based on a sampling mode, setting a filtered color for the additional pixel to an average value of the texture map.
17 . The system of claim 1 , wherein the filtered color is set to the single texel without applying one or more of the sample weight probabilities or any interpolation weights to the single texel.
18 . A non-transitory computer-readable media storing computer instructions for stochastic texture filtering that, when executed by one or more processors, cause the one or more processors to perform the steps of:
obtaining texture coordinates associated with rendered geometry that intersects a pixel,
generating, for a discrete texture filter, sample weight probabilities corresponding to integer texture coordinates that are calculated from the texture coordinates and that are associated with a texture map comprising texels;
selecting a single texel stored in the texture map using a stochastic value and the sample weight probabilities; and
producing a filtered color for the pixel based on the single texel.
19 . The non-transitory computer-readable media of claim 18 , further comprising:
in response to detecting a disocclusion, selecting an additional texel stored in the texture map using an additional stochastic value, and
combining the additional texel with the texel to produce the filtered color.
20 . The non-transitory computer-readable media of claim 18 , further comprising:
determining that the texture map is designated as safe for stochastic filtering; and
enabling stochastic filtering for the texture map.
21 . The non-transitory computer-readable media of claim 18 , wherein a driver replaces texture processing code with the instructions for stochastic texture filtering.
22 . A method for stochastic texture filtering, comprising:
obtaining texture coordinates associated with rendered geometry that intersects a pixel;
generating, for a discrete texture filter, sample weight probabilities corresponding to integer texture coordinates that are calculated from the texture coordinates and that are associated with a texture map comprising texels;
selecting a single texel stored in the texture map using a stochastic value and the sample weight probabilities; and
producing a filtered color for the pixel based on the single texel.
23 . The method of claim 22 , wherein the filtered color is set to the single texel without applying one or more of the sample weight probabilities to the single texel or any interpolation weights to the single texel.