A method for hardware-implemented level of detail gradient precision optimization

By adding specific operations to the formula for calculating LOD values ​​of hardware, the problem of large errors in calculating LOD values ​​of existing hardware algorithms is solved, and the calculation accuracy and texture level accuracy of map refinement are improved.

CN114419236BActive Publication Date: 2025-02-11SHENZHEN ZHONGWEIDIAN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210077482.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2025-02-11
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

Existing hardware algorithms have large errors when calculating LOD values, especially when du and dv are close to each other, the absolute error can reach a maximum of 0.5.

Method used

By adding an addition, a multiplication and a comparison operation to the formula for calculating the LOD value in hardware, adjusting Equation 3 to be closer to the calculation result of the real LOD value.

Benefits of technology

The calculation accuracy of LOD values ​​is improved, and the texture level obtained by the map refinement function is more accurate, and the error rate is significantly reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419236B_ABST
    Figure CN114419236B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of graphics processing technology, and in particular to a method for optimizing the accuracy of detail level gradient by hardware. The method comprises S1. In OpenGL, specifying a required mapping object and specifying a plurality of vertex coordinates required for the mapping object ( x , y ) and texture coordinates between multiple vertices ( u , v ); S2. For multiple vertex coordinates, take the absolute value of the difference between the coordinates of two vertices and sum them up to get dx and you ; S3. For multiple texture coordinates, take the absolute value of the difference between the two texture coordinates and sum them up to get you and dv ; S4. By dx , you, you , dv Perform addition, multiplication, logarithm, and comparison operations LOD Value; S5. Calculate based on the obtained LOD The value determines the texture level of the map refinement. By adding an addition operation, a multiplication operation and a comparison operation, the calculated LOD value is closer to the actual LOD value. The calculated LOD value is more accurate, and the texture level obtained by the map refinement function is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of graphics processing technology, and in particular to a method for optimizing the accuracy of detail level gradients achieved by hardware. Background Art

[0002] Multi-level texture detail LOD (level of details), the texture unit uses this parameter to determine which level of mipmap to use. The application scenario is to switch objects with different detail levels according to the distance between the camera and the object, so that the nearby objects have rich details and the distant objects ignore many details, thereby reducing rendering calculations and improving smoothness.

[0003] In OpenGL, the formula for calculating the LOD value is shown in Formula 1. The actual LOD value is used below to refer to the LOD value calculation result of Formula 1.

[0004]

[0005] However, this calculation method is very expensive for hardware, so the hardware usually uses Formula 2 to calculate the LOD value. The following text uses the hardware-calculated LOD value to refer to the calculation result of Formula 2.

[0006]

[0007] Obviously, there is a certain error between the calculation results of formula 1 and formula 2. When du and dv are close, the maximum absolute error of formula 2 can reach 0.5. Summary of the invention

[0008] The present invention provides a method for optimizing the accuracy of detail level gradient by hardware, aiming to solve the problem that the error of LOD value calculation results of existing algorithms is large.

[0009] The present invention provides a method for optimizing the accuracy of detail level gradient by hardware, comprising the following steps:

[0010] S1. In OpenGL, specify the required mapping object, and specify the multiple vertex coordinates (x, y) and the texture coordinates (u, v) between the multiple vertices required for the mapping object;

[0011] S2. For multiple vertex coordinates, take the absolute value of the difference between the coordinates of two vertices and sum them to obtain dx and dy;

[0012] S3. For multiple texture coordinates, the absolute values ​​of the differences between the two texture coordinates are taken and summed to obtain du and dv;

[0013] S4. Perform addition, multiplication, logarithm and comparison operations on dx, dy, du and dv to obtain the LOD value:

[0014]

[0015] S5. Determine the texture level of the map refinement according to the calculated LOD value obtained from Formula 3.

[0016] As a further improvement of the present invention, the step S5 is specifically as follows: rounding the calculated LOD value obtained by formula 3 to zero to obtain an integer LOD value for use.

[0017] As a further improvement of the present invention, in step S2, the value of dx is defined as:

[0018] dx=|x0-x1|+|x1-x2|+|x2-x0|;

[0019] The value of dy is defined as:

[0020] dy=|y0-y1|+|y1-y2|+|y2-y0|;

[0021] Among them, x0~x2, y0~y2 are the coordinate values ​​of the three vertices.

[0022] As a further improvement of the present invention, in step S3, the value of du is defined as:

[0023] du=|u0-u1|+|u1-u2|+|u2-u0|;

[0024] The value of dv is defined as:

[0025] dv=|v0-v1|+|v1-v2|+|v2-v0|;

[0026] Among them, u0~u3, v0~v3 are the coordinate values ​​of three texture coordinates.

[0027] The beneficial effects of the present invention are: by adding an addition operation, a multiplication operation and a comparison operation, the calculated LOD value is closer to the real LOD value, the accuracy of the calculated LOD value is improved, and the texture level obtained by the mipmap function is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a comparison diagram of the hardware LOD value calculation formula 2 of the present invention and the actual LOD value;

[0029] Figure 2 It is a comparison chart of the LOD value calculated by formula 4 of the present invention and the actual LOD value;

[0030] Figure 3 It is a comparison chart between the LOD value calculated by formula 3 of the present invention and the actual LOD value. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0032] A method for optimizing the accuracy of detail level gradient by hardware is provided in the present invention, characterized by comprising the following steps:

[0033] S1. In OpenGL, specify the required mapping object, and specify the multiple vertex coordinates (x, y) and the texture coordinates (u, v) between the multiple vertices required for the mapping object;

[0034] S2. For multiple vertex coordinates, take the absolute value of the difference between the coordinates of two vertices and sum them to obtain dx and dy;

[0035] S3. For multiple texture coordinates, the absolute values ​​of the differences between the two texture coordinates are taken and summed to obtain du and dv;

[0036] S4. Perform addition, multiplication and comparison operations on dx, dy, du and dv to obtain the LOD value:

[0037]

[0038] S5. Determine the texture level of the map refinement according to the calculated LOD value obtained by Formula 3. Specifically, the calculated LOD value obtained by Formula 3 is rounded to zero to obtain an integer LOD value for use.

[0039] In step S2, the value of dx is defined as:

[0040] dx=|x0-x1|+|x1-x2|+|x2-x0|;

[0041] The value of dy is defined as:

[0042] dy=|y0-y1|+|y1-y2|+|y2-y0|;

[0043] Among them, x0~x2, y0~y2 are the coordinate values ​​of the three vertices.

[0044] In step S3, the value of du is defined as:

[0045] du=|u0-u1|+|u1-u2|+|u2-u0|;

[0046] The value of dv is defined as:

[0047] dv=|v0-v1|+|v1-v2|+|v2-v0|;

[0048] Among them, u0~u3, v0~v3 are the coordinate values ​​of three texture coordinates.

[0049] The present invention optimizes the level of detail accuracy based on hardware algorithm implementation and optimizes the existing hardware calculation formula 2. By adding an addition operation, a multiplication operation and a comparison operation, such as formula 3, the calculated LOD value is closer to the calculation result of formula 1.

[0050] like Figure 1 As shown, for the hardware calculation formula 2, when the difference between du and dv is large, the hardware-calculated LOD value has a better fitting effect on the true LOD value; when du and dv are close, the hardware-calculated LOD value has a poor fitting effect on the true LOD value.

[0051] Therefore, if Figure 2 As shown, the true LOD value is fitted using Formula 4.

[0052]

[0053] in, Yes The largest difference between the two is Therefore, the second term of Formula 4 is needed as a fitting error correction. When the difference between du and dv is large, the fitting effect of Formula 4 on the actual LOD value is poor; when du and dv are close, the fitting effect of the hardware-calculated LOD value on the actual LOD value is better.

[0054] like Figure 3 As shown, by combining the advantages of the two formulas, the larger result value in Formula 2 and Formula 4 is selected as the final LOD value, and finally the calculation process of the optimized formula 3 is obtained.

[0055] The optimization effect is verified with specific parameter values ​​below.

[0056] Apply a texture with a width and height of 800x600 to the triangle, using a common set of vertex coordinates and texture coordinates, see formula 5.

[0057]

[0058] By changing the triangle angle, a set of lod value calculation results are compared as follows:

[0059]

[0060] For the texture coordinates of Formula 5, du is equal to dv. At this time, the actual value obtained by the hardware algorithm Formula 2 and the OpenGL algorithm has a stable error of 0.5.

[0061] Since the LOD value calculated by the formula is rounded to zero to get an integer LOD value before using the mipmap in actual use, the error rate is used as the standard for algorithm comparison. The different LOD values ​​obtained by the algorithm and the OpenGL algorithm after rounding to zero are counted as one error. Compared with the hardware algorithm (Formula 2), the optimized algorithm (Formula 3) and the OpenGL implementation algorithm (Formula 1) have a lower error rate from 25.87% to 5.73%, and the accuracy has been improved.

[0062] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A method for hardware-implemented detail level gradient precision optimization, characterized in that: The following steps are involved: S1. In OpenGL, specify the required mapping object, and specify the multiple vertex coordinates (x, y) and the texture coordinates (u, v) between the multiple vertices required for the mapping object; S2. For multiple vertex coordinates, take the absolute value of the difference between the coordinates of two vertices and sum them to obtain dx and dy; S3. For multiple texture coordinates, the absolute values ​​of the differences between the two texture coordinates are taken and summed to obtain du and dv; S4. Perform addition, multiplication, logarithm and comparison operations on dx, dy, du and dv to obtain the LOD value: S5. Determine the texture level of the map refinement according to the LOD value calculated by formula 3; The step S5 specifically includes: rounding the LOD value calculated by formula 3 to zero to obtain an integer LOD value for use.

2. The method for optimizing the accuracy of detail level gradient by hardware according to claim 1, characterized in that: In step S2, the value of dx is defined as: dx=|x0-x1|+|x1-x2|+|x2-x0|; The value of dy is defined as: dy=|y0-y1|+|y1-y2|+|y2-y0|; Among them, x0~x2, y0~y2 are the coordinate values ​​of the three vertices.

3. The method for optimizing the accuracy of detail level gradient by hardware according to claim 1, characterized in that: In step S3, the value of du is defined as: du=|u0-u1|+|u1-u2|+|u2-u0|; The value of dv is defined as: dv=|v0-v1|+|v1-v2|+|v2-v0|; Among them, u0~u3, v0~v3 are the coordinate values ​​of three texture coordinates.

Citation Information

Patent Citations

  • Method and device for zooming image in level-of-detail model

    CN103077497A

  • Three-dimensional model texture map conversion method and device

    CN108062784A