Primitive adaptive variable rate shading
Patent Information
- Authority / Receiving Office
- TW · TW
- Patent Type
- Applications
- Current Assignee / Owner
- MEDIATEK INC
- Filing Date
- 2025-02-25
- Publication Date
- 2026-07-16
AI Technical Summary
Variable rate shading (VRS) improves performance in 3D applications but leads to jagged edges, necessitating a solution that enhances performance without these side effects.
An adaptive variable rate shading method that adjusts shading rates based on depth differences in the x and y directions, using thresholds to determine optimal shading rates for sensitive and non-sensitive regions.
The method efficiently maintains visual fidelity by adaptively selecting shading rates, reducing jagged edges and optimizing GPU performance.
Smart Images

Figure TWG2TA001068187_001 
Figure TWG2TA001068187_002 
Figure TWG2TA001068187_003
Abstract
Description
[Technical Field]
[0001] This disclosure generally relates to fragment shader techniques in multi-video game environments, and more specifically, to techniques using variable rate shading (VRS).
[0002] Variable rate shading (VRS) is a mechanism that enables segmented shading of different regions in a rendered image at different rates. With VRS, a group of pixels can be shaded as a unit, and the result is then broadcast to all samples in that group. VRS can significantly reduce the call rate of segmented shaders and improve the performance of 3D applications. However, VRS reduces the shading rate of segmented shaders, leading to jagged edges. Therefore, a solution is needed that can both benefit from VRS and avoid its side effects. [Previous Technology]
[0003] In the world of modern video games, creating complex and visually stunning scenes often requires the use of sophisticated fragment shader techniques. These techniques include shadows, lighting, and post-processing, and these elaborate effects increase GPU power consumption. Therefore, developers must find ways to optimize performance while maintaining the game's visual fidelity. To achieve this, developers typically employ various methods to reduce the cost of complex fragment shading. [Summary of the Invention]
[0004] A primitive adaptive variable rate shading method includes generating a first absolute difference value of depth of field in the x-direction, generating a second absolute difference value of depth of field in the y-direction, adding the first absolute difference value to the second absolute difference value to generate a third absolute difference value, and setting a variable shading rate based on at least a plurality of thresholds and the third absolute difference value.
[0005] These and other objectives of the present invention will undoubtedly become apparent to those skilled in the art after reading the following detailed description of the preferred embodiments depicted in various figures and diagrams.
Implementation Method
[0006] Figure 1 shows a helmet image with a sensitive region 102 and a non-sensitive region 104 according to an embodiment of the present invention. In a three-dimensional (3D) application, the pixels in the non-sensitive region 104 of the helmet are similar in color, so a higher variable shading rate (e.g., 4 pixels by 4 pixels) should be applied, meaning that the same color can be applied to a larger area. This allows for more efficient rendering of a helmet in a single color. Furthermore, the sensitive region 102 should be rendered pixel-by-pixel because it includes both the background (e.g., sky or walls) and the helmet, so a lower variable shading rate (e.g., 1 pixel by 1 pixel or 1 pixel by 2 pixels) should be applied, meaning that the same color can only be applied to a small area. The sensitive region 102 is more sensitive in the horizontal direction (x-axis) than in the vertical direction (y-axis) because the depth difference in the horizontal direction is more significant. Therefore, the variable shading rate can be 1 pixel by 1 pixel or 1 pixel by 2 pixels (more sensitive in the horizontal direction). By applying an adaptive variable shading rate, the characteristics of the sensitive region 102 can be preserved.
[0007] Figure 2 is a flowchart 200 of the original adaptive variable shading rate method according to an embodiment of the present invention.
[0008] Step S202: Generate the first absolute value of the depth difference in the x-direction;
[0009] Step S204: Generate the second absolute value of the depth difference in the y-direction;
[0010] Step S206: Add the first absolute value of the difference to the second absolute value of the difference to generate a third direction;
[0011] Step S208: Set a variable coloring rate based on at least a plurality of thresholds and the third difference absolute value.
[0012] In one embodiment, the plurality of thresholds may include a 2-pixel multiplied by 1-pixel threshold, a 2-pixel multiplied by 2-pixel threshold, a 4-pixel multiplied by 2-pixel threshold, and a 4-pixel multiplied by 4-pixel threshold. First, the final variable shading rate is set to 4-pixel multiplied by 4-pixel, 4-pixel multiplied by 2-pixel, 2-pixel multiplied by 2-pixel, or 2-pixel multiplied by 1-pixel.
[0013] In one embodiment, the final variable shading rate is set to 4 pixels multiplied by 4 pixels, and a third absolute difference value is compared with a plurality of thresholds. If the third absolute difference value is greater than the 2 pixels multiplied by 1 pixel threshold, the variable shading rate is set to 1 pixel multiplied by 1 pixel. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 1 pixel multiplied by 2 pixels. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 1 pixel. If the third absolute difference value is between the 4 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 2 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 4 pixels. If the third absolute difference value is between the 4-pixel multiplied by 4-pixel threshold and the 4-pixel multiplied by 2-pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 4-pixel multiplied by 2-pixel. If the third absolute difference value is less than the 4-pixel multiplied by 4-pixel threshold, then the variable shading rate is set to 4-pixel multiplied by 4-pixel.
[0014] In another embodiment, the final variable shading rate is set to 4 pixels multiplied by 2 pixels, and a third absolute difference value is compared with a plurality of thresholds. If the third absolute difference value is greater than the 2 pixels multiplied by 1 pixel threshold, the variable shading rate is set to 1 pixel multiplied by 1 pixel. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 1 pixel multiplied by 2 pixels. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 1 pixel. If the third absolute difference value is between the 4 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 2 pixel threshold, the variable shading rate is set to 2 pixels multiplied by 2 pixels. If the third absolute difference value is less than the 4 pixels multiplied by 2 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 4 pixels. If the third absolute difference value is less than 4 pixels multiplied by 2 pixels threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 4 pixels multiplied by 2 pixels.
[0015] In another embodiment, the final variable shading rate is set to 2 pixels multiplied by 2 pixels, and a third absolute difference value is compared with a plurality of thresholds. If the third absolute difference value is greater than the 2 pixels multiplied by 1 pixel threshold, the variable shading rate is set to 1 pixel multiplied by 1 pixel. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 1 pixel multiplied by 2 pixels. If the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 1 pixel. If the third absolute difference value is less than the 2 pixels multiplied by 2 pixel threshold, the variable shading rate is set to 2 pixels multiplied by 2 pixels.
[0016] In another embodiment, the final variable shading rate is set to 2 pixels multiplied by 1 pixel, and a third absolute difference value is compared with a plurality of thresholds. If the third absolute difference value is greater than the 2 pixels multiplied by 1 pixel threshold, the variable shading rate is set to 1 pixel multiplied by 1 pixel. If the third absolute difference value is less than the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, the variable shading rate is set to 1 pixel multiplied by 2 pixels. If the third absolute difference value is less than the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, the variable shading rate is set to 2 pixels multiplied by 1 pixel.
[0017] The conditions range from 1 pixel multiplied by 1 pixel to 4 pixels multiplied by 4 pixels. However, step S208 is not limited to 1 pixel multiplied by 1 pixel to 4 pixels multiplied by 4 pixels, and can be applied in a general manner.
[0018] In summary, the original adaptive variable rate shading method can be performed efficiently while avoiding the side effects of variable rate shading because the variable shading rate is adaptively selected. That is, a color can be drawn in a small area like 1 pixel by 2 pixels or in a large area like 4 pixels by 4 pixels.
[0019] Those skilled in the art will readily observe that, while retaining the teachings of the invention, numerous modifications and alterations can be made to the apparatus and methods. Therefore, the above disclosure should be interpreted only within the scope of the appended claims. The above description is merely a preferred embodiment of the invention, and all equivalent variations and modifications made within the scope of the claims should fall within the scope of this invention. [Simplified Explanation of the Diagram]
[0020] Figure 1 shows an image of a helmeted figure according to an embodiment of the present invention, the image having sensitive and non-sensitive regions. Figure 2 is a flowchart of a primitive adaptive variable rate shading method according to an embodiment of the present invention.
Claims
1. A primitive adaptive variable rate coloring method, comprising: Generates the first absolute value of the depth difference in the x-direction; This generates the second absolute value of the depth difference in the y-direction; The first absolute value of difference is added to the second absolute value of difference to generate a third absolute value of difference; and a variable coloring rate is set based on at least a plurality of thresholds and the third absolute value of difference.
2. The original adaptive variable rate coloring method as described in claim 1, wherein the plurality of thresholds includes: A 2-pixel multiplied by 1-pixel threshold, a 2-pixel multiplied by 2-pixel threshold, a 4-pixel multiplied by 2-pixel threshold, and a 4-pixel multiplied by 4-pixel threshold.
3. The original adaptive variable rate coloring method as described in claim 2, further comprising: Set the final variable shading rate to 4 pixels by 4 pixels, 4 pixels by 2 pixels, 2 pixels by 2 pixels, or 2 pixels by 1 pixel.
4. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels and the third absolute difference value is greater than the 2 pixels by 1 pixel threshold, then the variable shading rate is set to 1 pixel by 1 pixel.
5. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels, the third absolute difference value is between a 2-pixel-by-2-pixel threshold and a 2-pixel-by-1-pixel threshold, and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 1 pixel by 2 pixels.
6. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels, the third absolute difference value is between a 2-pixel-by-2-pixel threshold and a 2-pixel-by-1-pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 2 pixels by 1 pixel.
7. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels and the third absolute difference value is between the 4 pixels by 2 pixel threshold and the 2 pixels by 2 pixel threshold, then the variable shading rate is set to 2 pixels by 2 pixels.
8. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels, the third absolute difference value is between the 4 pixels by 4 pixel threshold and the 4 pixels by 2 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 2 pixels by 4 pixels.
9. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels, the third absolute difference value is between the 4 pixels by 4 pixel threshold and the 4 pixels by 2 pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 4 pixels by 2 pixels.
10. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set based on at least a plurality of thresholds and a third absolute difference value, and if the final variable shading rate is set to 4 pixels by 4 pixels and the third absolute difference value is less than the 4 pixels by 4 pixel threshold, then the variable shading rate is set to 4 pixels by 4 pixels.
11. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, and the third difference absolute value is greater than the 2 pixels multiplied by 1 pixel threshold, then the variable shading rate is set to 1 pixel multiplied by 1 pixel.
12. The original adaptive variable rate shading method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 1 pixel multiplied by 2 pixels.
13. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 2 pixels multiplied by 1 pixel.
14. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, and the third difference absolute value is between the 4 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 2 pixel threshold, then the variable shading rate is set to 2 pixels multiplied by 2 pixels.
15. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, the third absolute difference value is less than the 4 pixels multiplied by 2 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 2 pixels multiplied by 4 pixels.
16. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 4 pixels multiplied by 2 pixels, the third absolute difference value is less than the 4 pixels multiplied by 2 pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 4 pixels multiplied by 2 pixels.
17. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 2 pixels multiplied by 2 pixels, and the third difference absolute value is greater than the 2 pixels multiplied by 1 pixel threshold, then the variable shading rate is set to 1 pixel multiplied by 1 pixel.
18. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 2 pixels multiplied by 2 pixels, the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 1 pixel multiplied by 2 pixels.
19. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least the plurality of thresholds, and if the final variable shading rate is set to 2 pixels multiplied by 2 pixels, the third absolute difference value is between the 2 pixels multiplied by 2 pixel threshold and the 2 pixels multiplied by 1 pixel threshold, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 2 pixels multiplied by 1 pixel.
20. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least one threshold, and when the final variable shading rate is set to 2 pixels by 2 pixels, if the third absolute difference value is less than the threshold of 2 pixels by 2 pixels, the variable shading rate is set to 2 pixels by 2 pixels.
21. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least one threshold, and when the final variable shading rate is set to 2 pixels multiplied by 1 pixel, if the third absolute value of the difference is greater than the threshold of 2 pixels multiplied by 1 pixel, the variable shading rate is set to 1 pixel multiplied by 1 pixel.
22. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least one threshold, and when the final variable shading rate is set to 2 pixels multiplied by 1 pixel, if the third absolute difference value is less than the threshold of 2 pixels multiplied by 1 pixel and the first absolute difference value is greater than the second absolute difference value, then the variable shading rate is set to 1 pixel multiplied by 2 pixels.
23. The original adaptive variable shading rate method as described in claim 3, wherein the variable shading rate is set according to at least one threshold, and when the final variable shading rate is set to 2 pixels multiplied by 1 pixel, if the third absolute difference value is less than the threshold of 2 pixels multiplied by 1 pixel, and the first absolute difference value is less than the second absolute difference value, then the variable shading rate is set to 2 pixels multiplied by 1 pixel.