A multi-dimensional texture compatible addressing system
By designing a multi-dimensional texture compatible addressing system in graphic rendering technology, and using texture coordinates and texture details to divide texture data arrays hierarchically, the problem of incompatibility between two-dimensional and three-dimensional texture storage is solved, and the texture mapping efficiency is improved.
Patent Information
- Application Number
- CN202311624897.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2043-11-29
AI Technical Summary
In the prior art, two-dimensional textures and three-dimensional textures are incompatible in storage architecture, resulting in complex hardware design and low texture mapping efficiency, making it difficult to achieve compatible addressing of multi-dimensional textures.
Design a multi-dimensional texture compatible addressing system. Through the database and processor, the texture coordinates and texture detail hierarchy MIP1 are used to divide the texture data array to realize compatible storage and addressing of two-dimensional and three-dimensional textures. The specific steps include based on the waiting time. The address texture coordinate determines the array identity and texture layer, and finds the target array and the target texture layer to obtain texture data.
It effectively improves the addressing efficiency of multi-dimensional textures and realizes compatible storage of two-dimensional and three-dimensional textures. Although it sacrifices part of the storage space utilization, it greatly improves the efficiency of texture mapping.
Smart Images

Figure CN117576296B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graphics rendering technology, and in particular to a multi-dimensional texture compatible addressing system. Background Art
[0002] In a graphics rendering scenario, it is necessary to map a corresponding texture to each pixel in the screen image to provide the color value of the corresponding pixel for image rendering. The texture is usually a two-dimensional or three-dimensional texture image. When a two-dimensional texture image is applied, the texture image usually adopts a multi-level detail representation method to adapt to screen images of different sizes, thereby improving the accuracy of texture mapping. Accordingly, when storing a two-dimensional texture image, it is usually stored in the form of a texture data array, that is, each two-dimensional texture image corresponds to a texture data array, and a single texture data array includes texture images at multiple detail levels of the two-dimensional texture image.
[0003] However, when the texture image is in three-dimensional form, the three-dimensional texture image can be regarded as multiple two-dimensional texture images spliced along the Z axis. Then, each detail level of the three-dimensional texture image needs to store the two-dimensional texture images corresponding to each Z-axis coordinate under the detail level. Obviously, the storage form of the three-dimensional texture image is different from the storage form of the two-dimensional texture image. Therefore, when the processing object of the image rendering scene includes a two-dimensional screen image and a three-dimensional screen image, the prior art usually needs to set storage architectures for the three-dimensional texture image and the two-dimensional texture image respectively.
[0004] Obviously, the incompatibility between three-dimensional texture images and two-dimensional texture images in storage architecture will make the hardware design more complicated and will also reduce the efficiency of texture addressing during texture mapping. Therefore, how to achieve compatible addressing of multi-dimensional textures and thereby improve the efficiency of texture mapping has become a problem that needs to be solved urgently. Summary of the invention
[0005] In view of the above technical problems, the technical solution adopted by the present invention is:
[0006] A multi-dimensional texture compatible addressing system, the system comprising: a database, a processor and a memory storing a computer program, wherein the database includes texture coordinates to be addressed and their corresponding array identifiers Array ij and texture level of detail MIP l, and N+1+M*(z0+1) texture data arrays, a single texture data array includes L+1 texture layers, i is an integer in the range of [0, M], when i=0, j is an integer in the range of [0, N], when i is not equal to 0, j is an integer in the range of [0, z0], l is an integer in the range of [0, L], N+1 is the number of two-dimensional texture images, M is the number of three-dimensional texture images, L+1 is the number of layers of texture details, when the computer program is executed by a processor, the following steps are implemented:
[0007] S101, when the number of dimensions of the texture coordinates to be addressed is 2, determine that the array identifier is Array 0j .
[0008] S102, according to Array 0j , search the j+1th texture data array in the database as the first target array.
[0009] S103, according to MIP l , determining the l+1th texture layer in the first target array as the first target texture layer.
[0010] S104, determining a first target texture in the first target texture layer according to the texture coordinates to be addressed, and taking the first target texture as an addressing result.
[0011] S105: When the number of dimensions of the texture coordinates to be addressed is 3, determine that the array identifier is Array ij .
[0012] S106, according to Array ij , search the N+i+j+i*z0-z0+1th texture data array in the database as the second target array.
[0013] S107, according to MIP l , determining the l+1th texture layer in the second target array as the second target texture layer.
[0014] S108, determining a second target texture in the second target texture layer according to the texture coordinates to be addressed, and taking the second target texture as an addressing result.
[0015] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, the multi-dimensional texture compatible addressing system provided by the present invention can achieve considerable technical advancement and practicality, and has wide industrial utilization value, and has at least the following beneficial effects:
[0016] The present invention provides a multi-dimensional texture compatible addressing system, the system comprising: a database, a processor and a memory storing a computer program, wherein the database includes texture coordinates to be addressed and their corresponding array identifiers Array ij and texture level of detail MIP l , and N+1+M*(z0+1) texture data arrays, a single texture data array includes L+1 texture layers, i is an integer in the range of [0,M], when i=0, j is an integer in the range of [0,N], when i is not equal to 0, j is an integer in the range of [0,z0], l is an integer in the range of [0,L], N+1 is the number of two-dimensional texture images, M is the number of three-dimensional texture images, L+1 is the number of layers of texture details, when the computer program is executed by a processor, the following steps are implemented: when the number of dimensions of the texture coordinates to be addressed is 2, determine that the array identifier is Array 0j , according to Array 0j , search the j+1th texture data array in the database as the first target array, according to MIP l , determining the l+1th texture layer as the first target texture layer in the first target array, determining the first target texture in the first target texture layer according to the texture coordinates to be addressed, taking the first target texture as the addressing result, and when the number of dimensions of the texture coordinates to be addressed is 3, determining the array identifier as Array ij , according to Array ij , search the N+i+j+i*z0-z0+1 texture data array in the database as the second target array, according to MIP l , determine the l+1th texture layer in the second target array as the second target texture layer, determine the second target texture in the second target texture layer according to the texture coordinates to be addressed, and use the second target texture as the addressing result.
[0017] It can be seen that dividing the three-dimensional texture image into multiple texture data arrays according to the Z-axis coordinate allows the three-dimensional texture image to be stored in the storage form of the two-dimensional texture image, sacrificing the utilization of part of the storage space in exchange for compatible storage and addressing of the two-dimensional texture image and the three-dimensional texture image, which can effectively improve the efficiency of multi-dimensional texture addressing. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 A flowchart of a computer program executed by a processor in a multi-dimensional texture compatible addressing system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0021] This embodiment provides a multi-dimensional texture compatible addressing system, characterized in that the system comprises: a database, a processor and a memory storing a computer program, wherein the database includes texture coordinates to be addressed and their corresponding array identifiers Array ij and texture level of detail MIP l , and N+1+M*(z0+1) texture data arrays, a single texture data array includes L+1 texture layers, i is an integer in the range [0,M], when i=0, j is an integer in the range [0,N], when i is not equal to 0, j is an integer in the range [0,z0], l is an integer in the range [0,L], N+1 is the number of two-dimensional texture images, M is the number of three-dimensional texture images, L+1 is the number of layers of texture details, see Figure 1 , is a flowchart of a computer program executed by a processor in a multi-dimensional texture compatible addressing system provided by an embodiment of the present invention. When the computer program is executed by the processor, the following steps are implemented:
[0022] S101, when the number of dimensions of the texture coordinates to be addressed is 2, determine that the array identifier is Array 0j .
[0023] S102, according to Array 0j , search the j+1th texture data array in the database as the first target array.
[0024] S103, according to MIP l , determining the l+1th texture layer in the first target array as the first target texture layer.
[0025] S104, determining a first target texture in the first target texture layer according to the texture coordinates to be addressed, and taking the first target texture as an addressing result.
[0026] S105: When the number of dimensions of the texture coordinates to be addressed is 3, determine that the array identifier is Arrayij .
[0027] S106, according to Array ij , search the N+i*L+i+j+2th texture data array in the database as the second target array.
[0028] S107, according to MIP l , determining the l+1th texture layer in the second target array as the second target texture layer.
[0029] S108, determining a second target texture in the second target texture layer according to the texture coordinates to be addressed, and taking the second target texture as an addressing result.
[0030] Among them, the texture coordinates to be addressed can be two-dimensional texture coordinates or three-dimensional texture coordinates, that is, when the number of dimensions of the texture coordinates to be addressed is 2, the texture coordinates to be addressed are two-dimensional texture coordinates, and when the number of dimensions of the texture coordinates to be addressed is 3, the texture coordinates to be addressed are three-dimensional texture coordinates.
[0031] Array ij Can be used to determine the texture data array to be searched for the texture coordinates to be addressed, texture detail level MIP l After determining the texture data array to be searched for the texture coordinates to be addressed, the texture layer to be searched in the texture data array may be further determined.
[0032] Specifically, when i=0, it means that the texture coordinate to be addressed is a two-dimensional texture coordinate, j is an integer in the range of [0, N], and j is used to represent the j+1th texture data array. Since j starts from 0, N+1 is the number of two-dimensional texture images.
[0033] When i≠0, i can be used to represent the z0+1 texture data array corresponding to the i-th three-dimensional texture image, and j is an integer in the range of [0, z0]. At this time, j is used to represent the j+1-th texture data array in the z0+1 texture data array.
[0034] In this embodiment, the texture layer can be regarded as a texture image. Therefore, when the texture coordinates to be addressed are known, the texture corresponding to the texture coordinates to be addressed can be determined in the texture layer. The texture may include color value, transparency, etc.
[0035] When i≠0, since the database contains N+1 texture data arrays corresponding to two-dimensional texture images, and a single three-dimensional texture image corresponds to z0+1 texture data arrays, according to Array ij, which corresponds to the N+1+(i-1)*(z0+1)+j+1th texture data array in the database, that is, the N+i+j+i*z0-z0+1th texture data array.
[0036] Optionally, the texture coordinates to be addressed include an X-axis coordinate x and a Y-axis coordinate y, a maximum value of x is x0, and a maximum value of y is y0.
[0037] Among them, when the texture coordinates to be addressed are two-dimensional texture coordinates, they are expressed as (x, y), max(x)=x0, max(y)=y0, then when the texture detail level division is not performed, the maximum coordinates of the two-dimensional texture image are expressed as (x0, y0).
[0038] Optionally, when the number of dimensions of the texture coordinates to be addressed is 3, the texture coordinates to be addressed further include a Z-axis coordinate z, and the maximum value of z is z0.
[0039] When the texture coordinates to be addressed are three-dimensional texture coordinates, represented by (x, y, z), max(z) = z0, then when texture detail level division is not performed, the maximum coordinates of the three-dimensional texture image are represented by (x0, y0, z0).
[0040] Optionally, the method for obtaining L includes:
[0041] Step S201, determine the reference target value a=max(x0, y0).
[0042] Step S202, initializing the number of iterations b to 0.
[0043] Step S203, updating the reference target value a=f(a / 2), and updating b=b+1, where f is a floor function.
[0044] Step S204, when a≠1, return to execute step S203 until a=1, so that L=b.
[0045] In this embodiment, the size of the two-dimensional texture image at the highest level in the default texture detail level is 1*1, so the larger value of x0 and y0, that is, the reference target value, is used to perform scaling and rounding operations to determine the number of iterations required to reduce it to 1, as L.
[0046] It should be noted that the reference target value is updated in a manner of a=f(a / 2). In actual application, the implementer may adopt a=f(a / r) according to actual conditions, wherein r is greater than 1, so as to flexibly control the number of texture layers. In this embodiment, the scaling and rounding operations may adopt the form of a=f(a / r), which will not be elaborated later.
[0047] Optionally, the sizes corresponding to the L+1 texture layers in the texture data array are obtained in the following manners:
[0048] S301, initialize the size of the first texture layer to x0*y0, and set c=x0, d=y0.
[0049] S302, initialization l=1.
[0050] S303, when f(c / 2)>1, update c=f(c / 2), otherwise, update c=1, where f is a floor function.
[0051] S304, when f(d / 2)>1, update d=f(d / 2), otherwise, update d=1.
[0052] S305, determining the size of the (l+1)th texture layer to be c*d.
[0053] S306, if c*d≠1, update l=l+1, and return to execute steps S303 to S305 until l=L.
[0054] Among them, the first texture layer is the texture image when the texture detail level division is not performed, and because the three-dimensional texture image in this embodiment is stored in different texture data arrays according to the Z-axis coordinates, in a single texture data array, the three-dimensional texture image exists in a two-dimensional form like the two-dimensional texture image, and can be stored using the same texture layer size.
[0055] Optionally, when the texture data array corresponds to three-dimensional texture data, the storage content determination process of the texture data array includes:
[0056] S401, initialize q = 1, set z q =f(z0 / 2), where f is the floor function.
[0057] S402, if z q ≠1, so that p = z q , update q = q + 1, let z q =f(p / 2).
[0058] S403, return to step S402, until z q = 1, we get the number of iterations w = q, and z in the iteration process u , u is an integer in the range [1, w].
[0059] S404, for Array ij Corresponding texture data array, when j>z1, the 2nd to L+1th texture layers are vacant.
[0060] S405, when z u+1 <j≤z u , the u+2th to L+1th texture layers are vacant.
[0061] S406, when j=0, all texture layers are not vacant.
[0062] When the texture data array corresponds to three-dimensional texture data, the Z-axis size needs to be scaled and rounded to obtain the z-axis size corresponding to each iteration. u .
[0063] Specifically, since the storage is performed according to the Z-axis coordinate, it is obvious that for the texture data array corresponding to z0, all texture layers are not empty, and in the texture data array corresponding to z0, the texture layer size gradually decreases from the 1st texture layer to the L+1th texture layer.
[0064] When j>z1, it means that the current Z-axis coordinate can only correspond to the unscaled texture layer size, so the 2nd to L+1th texture layers are vacant.
[0065] Similarly, when z u+1 <j≤z u As the value of u increases, z u The corresponding number of scaling times gradually decreases, and the number of vacant texture layers also gradually decreases, with the u+2th to L+1th texture layers being vacant.
[0066] Optionally, when the texture data array corresponds to three-dimensional texture data, the space utilization rate of the texture data array is α=(∑ w v=0 z v +L-w+1) / ((L+1)*(z0+1)).
[0067] The size of the texture data array corresponding to the three-dimensional texture data is (L+1)*(z0+1), that is, there are z0+1 texture data arrays in total, and each texture data array contains L+1 layers.
[0068] When storing three-dimensional texture data in the existing manner, it can be known that for the first texture layer, z0 texture data are stored, for the second texture layer, z1 texture data are stored, and so on, until the w+1th texture layer, the stored texture data is reduced to a single one, and in the subsequent texture layers, the number of texture data remains 1. Under the premise that the number of texture layers is known to be L+1, except for the wth texture layer, the w+1th texture layer to the L+1th texture layer are all single texture data, that is, there are L-w+1 in total. Therefore, the total number of texture layers used is ∑ w v=0 zv + L-w+1, thus obtaining the space utilization rate of the texture data array α = (∑ w v=0 z v +L-w+1) / ((L+1)*(z0+1)).
[0069] It should be noted that, since the space utilization rate of the texture data array corresponding to the three-dimensional texture data is related to z0 and L, and L is related to x0 and y0, the implementer can interchangeably adjust the initial X-axis, initial Y-axis and initial Z-axis of the three-dimensional texture data according to the condition min(α) when entering the three-dimensional texture data. At this time, since the data corresponding to the X-axis and the Y-axis are interchangeable in the formula, it is only necessary to select the initial direction to be changed to the Z-axis, and then adjust the other axes to the axes that satisfy the right-hand rule of the coordinate system.
[0070] Optionally, the proportion of three-dimensional coordinates in the target texture coordinate set to be addressed is set to β, then the overall space utilization of all texture data arrays γ=α*β-β+1.
[0071] Among them, the proportion of three-dimensional coordinates is set to β, the value range of β is [0,1], and the proportion of two-dimensional coordinates is correspondingly 1-β. Since the space utilization rate of the texture data array corresponding to the two-dimensional coordinates is 1, the overall space utilization rate of all texture data arrays γ = [α*β+(1-β)] / 1 = α*β-β+1.
[0072] The present invention provides a multi-dimensional texture compatible addressing system, the system comprising: a database, a processor and a memory storing a computer program, wherein the database includes texture coordinates to be addressed and their corresponding array identifiers Array ij and texture level of detail MIP l , and N+1+M*(z0+1) texture data arrays, a single texture data array includes L+1 texture layers, i is an integer in the range of [0,M], when i=0, j is an integer in the range of [0,N], when i is not equal to 0, j is an integer in the range of [0,z0], l is an integer in the range of [0,L], N+1 is the number of two-dimensional texture images, M is the number of three-dimensional texture images, L+1 is the number of layers of texture details, when the computer program is executed by a processor, the following steps are implemented: when the number of dimensions of the texture coordinates to be addressed is 2, determine that the array identifier is Array 0j , according to Array 0j , search the j+1th texture data array in the database as the first target array, according to MIP l, determining the l+1th texture layer as the first target texture layer in the first target array, determining the first target texture in the first target texture layer according to the texture coordinates to be addressed, taking the first target texture as the addressing result, and when the number of dimensions of the texture coordinates to be addressed is 3, determining the array identifier as Array ij , according to Array ij , search the N+i+j+i*z0-z0+1 texture data array in the database as the second target array, according to MIP l , determine the l+1th texture layer in the second target array as the second target texture layer, determine the second target texture in the second target texture layer according to the texture coordinates to be addressed, and use the second target texture as the addressing result.
[0073] It can be seen that dividing the three-dimensional texture image into multiple texture data arrays according to the Z-axis coordinate allows the three-dimensional texture image to be stored in the storage form of the two-dimensional texture image, sacrificing the utilization of part of the storage space in exchange for compatible storage and addressing of the two-dimensional texture image and the three-dimensional texture image, which can effectively improve the efficiency of multi-dimensional texture addressing.
[0074] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A multi-dimensional texture compatible addressing system, It is characterized in that The system comprises: a database, a processor and a memory storing a computer program, wherein the database comprises texture coordinates to be addressed and their corresponding array identifiers Array ij and texture detail level MIP l , and N+1+M×(z 0 +1) texture data arrays, a single texture data array includes L+1 texture layers, i is an integer in the range [0, M], when i=0, j is an integer in the range [0, N], when i is not equal to 0, j is an integer in the range [0, z 0 ], l is an integer in the range of [0, L], N+1 is the number of two-dimensional texture images, M is the number of three-dimensional texture images, L+1 is the number of layers of texture details, and the texture coordinates to be addressed include the X-axis coordinate x and the Y-axis coordinate y, and the maximum value of x is x 0 , the maximum value of y is y 0 When the number of dimensions of the texture coordinates to be addressed is 3, the texture coordinates to be addressed also include a Z-axis coordinate z, and the maximum value of z is z 0 , when the computer program is executed by a processor, the following steps are implemented: S101, when the number of dimensions of the texture coordinates to be addressed is 2, determine that the array identifier is Array 0j ; S102, according to Array 0j , searching the j+1th texture data array in the database as the first target array; S103, according to MIP l , determining the l+1th texture layer in the first target array as the first target texture layer; S104, determining a first target texture in the first target texture layer according to the texture coordinates to be addressed, and taking the first target texture as an addressing result; S105: When the number of dimensions of the texture coordinates to be addressed is 3, determine that the array identifier is Array ij ; S106, according to Array ij , find the N+i+j+i×zth 0 -z 0 +1 texture data array as the second target array; S107, according to MIP l , determining the l+1th texture layer in the second target array as the second target texture layer; S108, determining a second target texture in the second target texture layer according to the texture coordinates to be addressed, and taking the second target texture as an addressing result; The methods for obtaining L include: Step S201, determine the reference target value a=max(x 0 ,y 0 ); Step S202, initializing the number of iterations b to 0; Step S203, updating the reference target value a=f(a / 2), and updating b=b+1, where f is a floor rounding function; Step S204, when a≠1, return to execute step S203 until a=1, so that L=b.
2. The multi-dimensional texture compatible addressing system according to claim 1, It is characterized in that The method for obtaining the sizes corresponding to the L+1 texture layers in the texture data array includes: S301, initialize the size of the first texture layer to x 0 ×y 0 , and c=x 0 , d = y 0 ; S302, initialization l=1; S303, when f(c / 2)>1, update c=f(c / 2), otherwise, update c=1, where f is a floor function; S304, when f(d / 2)>1, update d=f(d / 2), otherwise, update d=1; S305, determining the size of the l+1th texture layer to be c×d; S306: If c×d≠1, update l=l+1 and return to execute steps S303 to S305 until l=L.
3. The multi-dimensional texture compatible addressing system according to claim 1, It is characterized in that When the texture data array corresponds to three-dimensional texture data, the storage content determination process of the texture data array includes: S401, initialize q=1, let z q =f(z 0 / 2), f is the floor rounding function; S402, if z q ≠1, so that p=z q , update q=q+1, let z q =f(p / 2); S403, return to step S402, until z q =1, we get the number of iterations w=q, and z in the iteration process u , u is an integer in the range [1, w]; S404, for Array ij The corresponding texture data array, when j>z 1 When , the 2nd to L+1th texture layers are vacant; S405, when z u+1 <j≤z u When , the u+2th to L+1th texture layers are vacant; S406, when j=0, all texture layers are not vacant.
4. The multi-dimensional texture compatible addressing system according to claim 3, It is characterized in that When the texture data array corresponds to three-dimensional texture data, the space utilization rate α of the texture data array is: 。 5. The multi-dimensional texture compatible addressing system according to claim 4, It is characterized in that The proportion of three-dimensional coordinates in the target texture coordinate set to be addressed is set to β, then the overall space utilization of all texture data arrays γ=α×β-β+1.
Citation Information
Patent Citations
CUDA-based digital image geometric transformation method and device, equipment and medium
CN111507891A
Techniques for preloading textures in rendering graphics
CN112288619A
Three-dimensional rendering method and device of labeled object, computer equipment and storage medium
CN116109765A
Dynamic programmable texture sampler for flexible filtering of graphical texture data
US20150187089A1
Using indirection maps for rendering texture space effects
US20150187126A1
