[go: up one dir, main page]

CN109544668B - Texture coordinate processing method, terminal device and computer readable storage medium - Google Patents

Texture coordinate processing method, terminal device and computer readable storage medium Download PDF

Info

Publication number
CN109544668B
CN109544668B CN201710860925.7A CN201710860925A CN109544668B CN 109544668 B CN109544668 B CN 109544668B CN 201710860925 A CN201710860925 A CN 201710860925A CN 109544668 B CN109544668 B CN 109544668B
Authority
CN
China
Prior art keywords
coordinate
tile
coordinates
relative
texture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710860925.7A
Other languages
Chinese (zh)
Other versions
CN109544668A (en
Inventor
李传志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710860925.7A priority Critical patent/CN109544668B/en
Publication of CN109544668A publication Critical patent/CN109544668A/en
Application granted granted Critical
Publication of CN109544668B publication Critical patent/CN109544668B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

A texture coordinate processing method relates to the technical field of graphic drawing and comprises the following steps: taking a vertex of a tile to which each patch belongs in a graph to be drawn as an origin, respectively establishing a corresponding relative coordinate system for each tile, wherein the coordinate range of the relative coordinate system is matched with the precision of a graph processor; converting the coordinates of each vertex of each surface patch into relative coordinates, wherein the relative coordinates are the coordinates of each vertex in the relative coordinate system; and controlling the graphics processor to convert the relative coordinates into texture coordinates by means of linear mapping. In addition, the invention also provides terminal equipment and a computer readable storage medium. The invention can reduce the memory expenditure and avoid the problems of rendering distortion, jitter or distortion of the rendered scene and the like.

Description

Texture coordinate processing method, terminal device and computer readable storage medium
Technical Field
The present invention relates to the field of graphics rendering technologies, and in particular, to a texture coordinate processing method, a terminal device, and a computer-readable storage medium.
Background
In three-dimensional rendering, texture coordinates are typically used. In the prior art, the texture coordinates are usually pre-generated by a CPU (Central Processing Unit) and then transmitted into a GPU (Graphics Processing Unit) along with vertex coordinates and other rendering data in order to render the texture map. However, for a large-area scene such as a map, on one hand, the amount of rendering data is very large, the memory overhead of the application program during running is seriously affected by the size of the GPU data buffer, and the memory occupation is doubled due to texture coordinate data transmitted into the GPU along with vertex coordinates. On the other hand, in a large-area scene, the texture coordinates generated by the current texture coordinate processing method cannot accurately represent the position of an object in the scene, so that rendering distortion, jitter or distortion of the rendered scene and the like are caused.
Disclosure of Invention
In view of this, embodiments of the present invention provide a texture coordinate processing method, a terminal device, and a computer-readable storage medium, which can reduce memory overhead and avoid rendering distortion and jitter or distortion of a rendered scene.
A first aspect of an embodiment of the present invention provides a texture coordinate processing method, including: respectively establishing a corresponding relative coordinate system for each tile by taking one vertex of the tile to which each patch belongs in the graph to be drawn as an origin, wherein the coordinate range of the relative coordinate system is matched with the precision of a graph processor; converting the coordinates of each vertex of each patch into relative coordinates, wherein the relative coordinates are the coordinates of each vertex in the relative coordinate system; and controlling the graphics processor to convert the relative coordinates into texture coordinates in a linear mapping mode.
A second aspect of an embodiment of the present invention provides a terminal device, including: the coordinate system establishing module is used for establishing a corresponding relative coordinate system for each tile by taking one vertex of the tile to which each patch belongs in the graph to be drawn as an origin, and the coordinate range of the relative coordinate system is matched with the precision of the graph processor; the coordinate conversion module is used for converting the coordinates of each vertex of each surface patch into relative coordinates, and the relative coordinates are the coordinates of each vertex in the relative coordinate system; and the control module is used for controlling the graphics processor to convert the relative coordinates into texture coordinates in a linear mapping mode.
A third aspect of the embodiments of the present invention provides a terminal device, including: the texture coordinate processing method provided by the first aspect of the embodiment of the present invention is implemented by a memory, a processor, and a computer program stored in the memory and executable on the processor.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the texture coordinate processing method provided in the first aspect of the embodiments of the present invention.
According to the embodiment of the invention, a relative coordinate system is established for each tile block, the vertex coordinates of each patch in the graph to be drawn are converted into the relative coordinates under the relative coordinate system, then the relative coordinates are transmitted into the GPU, and then the relative coordinates are converted into the texture coordinates by the GPU.
In order to make the aforementioned and other objects, features and advantages of the invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
Fig. 1 is a schematic flow chart illustrating a texture coordinate processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a texture coordinate processing method according to another embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a tile boundary discontinuity problem solved by a texture coordinate processing method according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal device according to another embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the embodiments, structures, features and effects according to the present invention will be made with reference to the accompanying drawings and preferred embodiments.
Referring to fig. 1, fig. 1 is a flowchart illustrating a texture coordinate processing method according to an embodiment of the invention. The texture coordinate processing method provided by the embodiment can be applied to electronic data devices which can be used in moving, such as smart phones, tablet computers, notebook computers and the like, and other electronic data devices which can not be used in moving, and which need to perform three-dimensional graph drawing. As shown in fig. 1, the method mainly includes:
s101, respectively establishing corresponding relative coordinate systems for tiles by taking one vertex of each tile to which each patch belongs in a graph to be drawn as an origin;
the patch is the minimum graphic unit in graphic rendering, is a graphic between two-dimensional and three-dimensional, has a three-dimensional surface but retains a two-dimensional spline curve, and can achieve the effect of a curved surface by adjusting the Betz handle of the patch. In three-dimensional graphic rendering, soft cloth, mountainous regions, water surfaces, polygonal area surfaces, road surfaces and the like are generally rendered by using patches.
Tiles, or grids, are used to distinguish between different data regions. A complete graphic is divided into small blocks, each of which may be considered a tile. A data unit that is usually loaded at one time is a tile. In three-dimensional image rendering, each patch needs to be pasted in a corresponding tile by using texture coordinates.
Selecting a vertex of a tile to which each patch in a graph to be drawn belongs, modifying the coordinate of the vertex into O (0, 0), and establishing a corresponding relative coordinate system for each tile by taking the vertex as an origin, namely, each tile corresponds to a new coordinate system. The coordinate range of the relative coordinate system is matched with the precision of the GPU, so that the precision enough to express the floating point number of the GPU is obtained in the process of graphic rendering.
Step S102, converting the coordinates of each vertex of each surface patch into relative coordinates, wherein the relative coordinates are the coordinates of each vertex in the relative coordinate system;
specifically, the coordinates of each vertex of each patch are converted into coordinates in the relative coordinate system newly created in step S101, that is, relative coordinates. The coordinates before and after conversion are world coordinates, and the positions of the vertexes before and after conversion in the space are not changed.
Step S103, controlling the graphics processor to convert the relative coordinates into texture coordinates by linear mapping.
Specifically, the converted relative coordinates of each vertex of each patch are transmitted into the GPU, the GPU is controlled to call a shader, the transmitted relative coordinates are converted into texture coordinates for graphics rendering by using linear coefficients, and then texture coordinate sampling operation is performed within the GPU precision range according to the converted texture coordinates.
According to the texture coordinate processing method provided by the embodiment of the invention, a relative coordinate system is established for each tile block, the vertex coordinates of each patch in a graph to be drawn are converted into relative coordinates under the relative coordinate system, then the relative coordinates are transmitted into the GPU, and then the transmitted relative coordinates are converted into texture coordinates by the GPU.
Referring to fig. 2, fig. 2 is a flowchart illustrating a texture coordinate processing method according to an embodiment of the invention. The texture coordinate processing method provided by the embodiment can be applied to electronic data devices which can be used in moving, such as smart phones, tablet computers, notebook computers and the like, and other electronic data devices which can not be used in moving, and which need to perform three-dimensional graph drawing. As shown in fig. 2, the method mainly includes:
step S201, taking the top point of the lower left corner of a tile to which each surface patch belongs in a graphic graph to be drawn as an origin, and respectively establishing a corresponding relative coordinate system for each tile;
the patch is the minimum graphic unit in graphic rendering, is a graphic between two-dimensional and three-dimensional, has a three-dimensional surface but retains a two-dimensional spline curve, and can achieve the effect of a curved surface by adjusting the Betz handle of the patch. In three-dimensional graphic rendering, soft cloth, mountainous regions, water surfaces, polygonal area surfaces, road surfaces and the like are generally rendered by using patches.
Tiles, or grids, are used to distinguish between different data regions. A complete graphic is divided into small blocks, each of which may be considered a tile. A data unit that is usually loaded at one time is a tile. In three-dimensional image rendering, each patch needs to be pasted in a corresponding tile by using texture coordinates.
Taking the vertex of the lower left corner of each tile to which each patch in the graph to be drawn belongs as the origin, and establishing a corresponding relative coordinate system for each tile, namely, each tile corresponds to a new coordinate system. The coordinate range of the relative coordinate system is matched with the precision of the GPU, so that the precision enough to express the floating point number of the GPU is obtained in the process of graphic rendering.
Step S202, converting the coordinates of each vertex of each patch into relative coordinates, wherein the relative coordinates are the coordinates of each vertex in the relative coordinate system;
specifically, the coordinates of each vertex of each patch are converted into coordinates in the relative coordinate system newly created in step S201, that is, relative coordinates. The relative coordinate system may be, for example, a two-dimensional cartesian coordinate system. The coordinates before and after conversion are world coordinates, and the positions of the vertexes before and after conversion in the space are not changed.
Step S203, dividing the number of the tiled textures by the length and the width of the tile to obtain a linear coefficient;
specifically, a linear coefficient ratio (ratio X, ratio Y) = (tx/(bx-ax), ty/(by-ay)) is obtained by using a width coefficient ratio X = texWidth/geoWidth and a length coefficient ratio Y = texLength/geoLength;
the width coefficient ratio X is a linear coefficient of the U (column) coordinate components in texture coordinates, where texWidth is an integer multiple of the texture coordinate width range of each tile, and geoWidth is the geographic coordinate width range of each tile.
The length coefficient ratio Y is a linear coefficient of the V (line) coordinate component in texture coordinates, where texLength/is a range of texture coordinate lengths that are integer multiples of each tile, and geoLength is a range of geographic coordinate lengths of each tile. The geographic coordinates are spherical coordinates representing the location of the ground point by latitude and longitude. Texture coordinates are coordinates in texture space.
In practical applications, texture maps typically use a repeat pattern to repeatedly superimpose a preset texture image on the map. The texture coordinate period is typically 0 to 1,0 to 1 and all integer multiples of the texture coordinate sample value are the same. After using the relative coordinate system, since each tile corresponds to a new relative coordinate system, and the coordinate ranges of the relative coordinate systems are discontinuous, in order to avoid the problem of discontinuous tile boundaries as shown in fig. 3, the coordinate ranges of the relative coordinate systems need to be set to be multiples of an integer.
In other words, the texture coordinate corresponding to the starting point of one tile is usually (0, 0), and the starting point is simultaneously the ending point of the previous tile, so that it is required to ensure that the texture coordinate corresponding to the ending point of each tile is an integer. Based on the above requirements, for a tile with a width of geoWidth and a length of geoLength, the seamless continuous tile at the tile boundary can be obtained only by specifying the texture coordinate width and the length ranges texWidth and texLength of the integral multiple corresponding to the tile range, so that the problem of discontinuous tile boundary can be effectively avoided.
Further, assume that the range of texture coordinates corresponding to the distance difference between two adjacent vertices a and b of a patch is (tx, ty);
then, using the width coefficient ratio x = texWidth/geoWidth and the length coefficient ratio y = texLength/geoLength, the linear coefficient is determined as:
ratio(ratioX,ratioY)=(tx/(bx-ax),ty/(by-ay));
ratioX=texWidth/geoWidth=tx/(bx-ax)=(u2-u1)/(bx-ax);
ratioY=texLength/geoLength=ty/(by-ay))=(v2-v1)/(by-ay);
wherein bx is the coordinate value of vertex b on the x-axis of the relative coordinate system, ax is the coordinate value of vertex a on the x-axis of the relative coordinate system, by is the coordinate value of vertex b on the y-axis of the relative coordinate system, and ay is the coordinate value of vertex a on the y-axis of the relative coordinate system.
In practical applications, the texture coordinate range (tx, ty) varies according to design requirements. The shape of the tile may be square, rectangular, or other irregular shape.
Further, in another embodiment of the present invention, the width range and the length range of the texture coordinate of the tile may be determined according to the accuracy of the GPU, and the smaller the accuracy of the GPU is, the smaller the width range and the length range of the texture coordinate of the tile is, so as to further ensure that the coordinate range of the relative coordinate system matches the accuracy of the GPU. Wherein the accuracy of the GPU may include, but is not limited to: 16bit, 10bit and 8bit, corresponding to high, medium and low precision floating point numbers, respectively.
Step S204, the relative coordinate and the linear coefficient are used as coordinate parameters and transmitted into a graphic processor;
specifically, the linear coefficients may be passed into the GPU as uniform parameters. In another embodiment of the present invention, the linear coefficients can also be preset in the GPU.
Step S205, controlling the graphics processor to convert the relative coordinates of each vertex into texture coordinates by multiplying the linear coefficient by the relative coordinates.
Specifically, the GPU invokes a shader, converts the incoming relative coordinates into texture coordinates for graphics rendering by multiplying the relative coordinates of each vertex by a linear coefficient, then performs texture coordinate sampling operation within the GPU precision range according to the converted texture coordinates, and further performs graphics rendering operation.
The generation process of the texture coordinates will be further described below by taking a map rendering scene as an example.
The polygon area faces and road faces in a map-rendered scene are typically composed of a number of triangular patches. For a minimum unit, i.e. triangle ABC, vertex coordinates of three vertices a, B, and C are assumed to be a (10000000, 20000000), B (10000001, 20000000), and C (10000000, 20000001), respectively. The coordinates of the vertex at the lower left corner of tile X to which triangle ABC belongs are T (10000000, 20000000), and the width of tile X is 1024.
In general, a 16-bit high-precision floating point number which can be represented by a GPU of a mobile terminal can only accurately represent 5 to 6 decimal digits. In order to obtain sufficient accuracy of the floating point number of the GPU, the vertex At the lower left corner of tile X is used as an origin, the coordinate T (10000000, 20000000) is modified to O (0, 0), and the coordinate values expressed by the three vertices a, B, and C of triangle ABC are At (0, 0), bt (1, 0), and Ct (0, 1), respectively, in the new coordinate system expressed by T (relative coordinate system).
The positions of the three vertexes a, B and C in the space are not changed, and the change of the coordinate system does not affect the position and relative relationship of the object in the three-dimensional space. In the new coordinate system, the parameters of the Camera (Camera) are also changed, but only the view matrix is affected. Therefore, new coordinate values of the three vertexes A, B and C, which can be accurately expressed by GPU floating point numbers, are obtained.
And then, obtaining texture coordinates of positions of three vertexes A, B and C of the triangle ABC in a texture space through linear mapping. Specifically, if the corresponding texture coordinate range between B and C in the design requirement is (tx, ty), the relative coordinates of vertices a, B, and C and the linear coefficient ratio (ratio x, ratio y) = (tx/(bx-ax), ty/(by-ay)) are transmitted to the GPU as a uniform parameter, and the GPU multiplies the transmitted relative coordinates of each vertex by the linear coefficient to obtain the texture coordinate of each vertex. The above coordinate transformation process can be completed in the vertex or pixel coloring stage. In a practical application, the coordinate transformation can be implemented by the following code of an OpenGL (OpenGL Shading Language) shader.
Figure BDA0001415053860000081
Figure BDA0001415053860000091
According to the texture coordinate processing method provided by the embodiment of the invention, a relative coordinate system is established for each tile block, the vertex coordinates of each patch in a graph to be drawn are converted into relative coordinates under the relative coordinate system, then the relative coordinates are transmitted into the GPU, and then the transmitted relative coordinates are converted into texture coordinates by the GPU.
Fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. The present embodiment is used to implement the texture coordinate processing method in the embodiment shown in fig. 1. As shown in fig. 4, the terminal device provided in this embodiment includes:
a coordinate system establishing module 401, configured to respectively establish a corresponding relative coordinate system for each tile by using a vertex of the tile to which each patch belongs in the graph to be drawn as an origin, where a coordinate range of the relative coordinate system matches with precision of the graph processor;
a coordinate transformation module 402, configured to transform the coordinates of each vertex of each patch into relative coordinates, where the relative coordinates are coordinates of each vertex in the relative coordinate system;
a control module 403, configured to control the graphics processor to convert the relative coordinates into texture coordinates by linear mapping.
For a specific process of each function module in this embodiment to implement each function, please refer to the specific content described in the embodiment shown in fig. 1, which is not described herein again.
In the embodiment of the invention, a relative coordinate system is established for each tile block, the vertex coordinates of each patch in the graph to be drawn are converted into the relative coordinates under the relative coordinate system, then the relative coordinates are transmitted into the GPU, and then the relative coordinates are converted into the texture coordinates by the GPU.
Fig. 5 is a schematic structural diagram of a terminal device according to another embodiment of the present invention. The present embodiment is used to implement the texture coordinate processing method in the embodiment shown in fig. 2. As shown in fig. 5, the terminal device provided in this embodiment includes:
a coordinate system establishing module 401, configured to respectively establish a corresponding relative coordinate system for each tile by using a vertex of the tile to which each patch belongs in the graph to be drawn as an origin, where a coordinate range of the relative coordinate system is matched with the precision of the graph processor;
a coordinate transformation module 402, configured to transform the coordinates of each vertex of each patch into relative coordinates, where the relative coordinates are coordinates of each vertex in the relative coordinate system;
a control module 403, configured to control the graphics processor to convert the relative coordinates into texture coordinates by linear mapping.
Further, the control module 403 is further configured to control the graphics processor to convert the relative coordinates of the vertices into the texture coordinates by multiplying the relative coordinates by a linear coefficient;
if the texture coordinate range corresponding to the distance difference between two adjacent vertices a and b of the patch is (tx, ty), the linear coefficient is:
ratio(ratioX,ratioY)=(tx/(bx-ax),ty/(by-ay)),
wherein, the width coefficient ratio x is a linear coefficient of a U coordinate component in the texture coordinate, the length coefficient ratio y is a linear coefficient of a V coordinate component in the texture coordinate, bx is a coordinate value of the vertex b on the x axis of the relative coordinate system, ax is a coordinate value of the vertex a on the x axis of the relative coordinate system, by is a coordinate value of the vertex b on the y axis of the relative coordinate system, and ay is a coordinate value of the vertex a on the y axis of the relative coordinate system.
Further, the terminal device further includes:
an input module 501, configured to input the relative coordinates and the linear coefficients into the graphics processor as coordinate parameters.
Further, the coordinate system establishing module 401 is specifically configured to establish a corresponding relative coordinate system for each tile by using a vertex of a lower left corner of the tile to which each patch belongs in the graph to be drawn as an origin.
Further, the terminal device further includes:
an obtaining module 502, configured to divide the number of tiled textures by the length and width of the tile to obtain the linear coefficient.
Further, the obtaining module 502 is specifically configured to obtain the linear coefficient ratio (ratio x, ratio y) by using ratio x = texWidth/geoWidth and ratio y = texLength/geoLength; wherein texWidth is a texture coordinate width range of an integer multiple of the tile, geoWidth is a geographic coordinate width range of the tile, texLength is a texture coordinate length range of an integer multiple of the tile, and geoLength is a geographic coordinate length range of the tile.
Further, the terminal device further includes:
a determining module 503, configured to determine the width range and the length range of the texture coordinate of the tile according to the precision of the graphics processor, where the smaller the precision of the graphics processor is, the smaller the width range and the length range of the texture coordinate of the tile is.
For a specific process of each function module in this embodiment to implement each function, please refer to specific contents described in the embodiments shown in fig. 1 to fig. 4, which are not described herein again.
In the embodiment of the invention, a relative coordinate system is established for each tile block, the vertex coordinates of each patch in the graph to be drawn are converted into relative coordinates under the relative coordinate system, then the relative coordinates are transmitted into the GPU, and then the transmitted relative coordinates are converted into texture coordinates by the GPU.
Referring to fig. 6, fig. 6 is a hardware structure diagram of a terminal device according to an embodiment of the present invention.
The terminal device described in this embodiment includes:
a memory 51, a processor 52 and a computer program stored in the memory 51 and capable of running on the processor 52, wherein the processor 52 implements the texture coordinate processing method described in the foregoing embodiments shown in fig. 1 to 3 when executing the computer program.
Further, the terminal device further includes:
at least one input device 53 and at least one output device 54.
The memory 51, the processor 52, the input device 53, and the output device 54 are connected via a bus 55.
The input device 53 may be a camera, a touch panel, a physical button, or a mouse. The output device 54 may specifically be a display screen.
The Memory 51 may be a high-speed Random Access Memory (RAM) Memory or a non-volatile Memory (non-volatile Memory), such as a disk Memory. The memory 51 is used for storing a set of executable program codes, and the processor 52 is coupled to the memory 51.
Further, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be provided in the terminal device in the foregoing embodiments, and the computer-readable storage medium may be the memory in the foregoing embodiment shown in fig. 6. The computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the texture coordinate processing method described in the foregoing embodiments shown in fig. 1 to 3. Further, the computer-readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a RAM, a magnetic disk, or an optical disk, and various media capable of storing program codes.
It should be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk, an optical disk, or the like.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method of texture coordinate processing, the method comprising:
respectively establishing corresponding relative coordinate systems for all tiles by taking one vertex of each tile to which each patch belongs in a graph to be drawn as an origin, wherein the coordinate ranges of the relative coordinate systems are matched with the precision of a graph processor;
converting the coordinates of each vertex of each patch into relative coordinates, wherein the relative coordinates are the coordinates of each vertex in the relative coordinate system;
transmitting the relative coordinate and the linear coefficient into a graphic processor as coordinate parameters;
controlling the graphics processor to convert the relative coordinates to texture coordinates by multiplying the relative coordinates of each of the vertices by the linear coefficients;
if the texture coordinate range corresponding to the distance difference between two adjacent vertices a and b of the patch is (tx, ty), the linear coefficient is:
ratio(ratioX,ratioY)=(tx/(bx-ax),ty/(by-ay)),
wherein, the width coefficient ratio x is a linear coefficient of a U coordinate component in texture coordinates, the length coefficient ratio y is a linear coefficient of a V coordinate component in texture coordinates, bx is a coordinate value of vertex b on an x axis of the relative coordinate system, ax is a coordinate value of vertex a on the x axis of the relative coordinate system, by is a coordinate value of vertex b on a y axis of the relative coordinate system, ay is a coordinate value of vertex a on the y axis of the relative coordinate system, the texture coordinate range is determined based on the precision of the graphics processor, and the smaller the precision of the graphics processor is, the smaller the texture coordinate range is.
2. The method of texture coordinate processing according to claim 1, wherein the controlling the graphics processor to convert the relative coordinates to the texture coordinates by multiplying the relative coordinates of each of the vertices by a linear coefficient further comprises:
dividing the number of tiled textures by the length and width of the tile to obtain the linear coefficient.
3. The texture coordinate processing method according to claim 2, wherein the obtaining the linear coefficient by dividing the number of the tiled textures by the length and the width of the tile comprises:
obtaining the linear coefficient ratio (ratio X, ratio Y) by using ratio X = texWidth/geoWidth and ratio Y = texLength/geoLength;
wherein texWidth is a range of texture coordinate widths that is an integer multiple of the tile, geoWidth is a range of geographic coordinate widths of the tile, texLength is a range of texture coordinate lengths that is an integer multiple of the tile, and geoLength is a range of geographic coordinate lengths of the tile.
4. The texture coordinate processing method according to claim 3, wherein the method further comprises:
and determining the width range and the length range of the texture geographic coordinate of the tile according to the precision of the graphics processor, wherein the smaller the precision of the graphics processor is, the smaller the width range and the length range of the texture coordinate of the tile is.
5. The texture coordinate processing method according to any one of claims 1 to 4, wherein the establishing a corresponding relative coordinate system for each tile by using a vertex of the tile to which each tile belongs in the graph to be rendered as an origin comprises:
and respectively establishing a corresponding relative coordinate system for each tile by taking the vertex of the lower left corner of the tile to which each patch belongs in the graph to be drawn as an origin.
6. A terminal device, comprising:
the coordinate system establishing module is used for establishing a corresponding relative coordinate system for each tile by taking one vertex of the tile to which each patch belongs in the graph to be drawn as an origin, and the coordinate range of the relative coordinate system is matched with the precision of the graph processor;
the coordinate conversion module is used for converting the coordinates of each vertex of each patch into relative coordinates, and the relative coordinates are the coordinates of each vertex in the relative coordinate system;
the transmitting module is used for transmitting the relative coordinates and the linear coefficients into the graphic processor as coordinate parameters;
a control module for controlling the graphics processor to convert the relative coordinates of each vertex into texture coordinates by multiplying the relative coordinates by the linear coefficient;
if the texture coordinate range corresponding to the distance difference between two adjacent vertices a and b of the patch is (tx, ty), the linear coefficient is:
ratio(ratioX,ratioY)=(tx/(bx-ax),ty/(by-ay)),
wherein, the width coefficient ratio x is a linear coefficient of a U coordinate component in a texture coordinate, the length coefficient ratio y is a linear coefficient of a V coordinate component in the texture coordinate, bx is a coordinate value of vertex b on an x axis of the relative coordinate system, ax is a coordinate value of vertex a on the x axis of the relative coordinate system, by is a coordinate value of vertex b on a y axis of the relative coordinate system, ay is a coordinate value of vertex a on the y axis of the relative coordinate system, the texture coordinate range is determined based on the precision of the graphics processor, and the smaller the precision of the graphics processor is, the smaller the texture coordinate range is.
7. The terminal device of claim 6,
the terminal device further includes:
the acquisition module is used for dividing the number of the tiled textures by the length and the width of the tile to obtain the linear coefficient;
the obtaining module is specifically configured to obtain the linear coefficient ratio (ratio x, ratio y) by using ratio x = texWidth/geoWidth and ratio y = texLength/geoLength;
wherein texWidth is a texture coordinate width range of an integer multiple of the tile, geoWidth is a geographic coordinate width range of the tile, texLength is a texture coordinate length range of an integer multiple of the tile, and geoLength is a geographic coordinate length range of the tile;
the terminal device further includes:
and the determining module is used for determining the width range and the length range of the texture coordinate of the tile according to the precision of the graphics processor, wherein the smaller the precision of the graphics processor is, the smaller the width range and the length range of the texture coordinate of the tile are.
8. The terminal device according to any of claims 6 to 7, characterized in that the terminal device further comprises:
the coordinate system establishing module is specifically configured to establish a corresponding relative coordinate system for each tile by using a lower left corner vertex of the tile to which each patch belongs in the graph to be drawn as an origin.
9. A terminal device, comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the texture coordinate processing method according to any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a texture coordinate processing method according to any one of claims 1 to 5.
CN201710860925.7A 2017-09-21 2017-09-21 Texture coordinate processing method, terminal device and computer readable storage medium Active CN109544668B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710860925.7A CN109544668B (en) 2017-09-21 2017-09-21 Texture coordinate processing method, terminal device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710860925.7A CN109544668B (en) 2017-09-21 2017-09-21 Texture coordinate processing method, terminal device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109544668A CN109544668A (en) 2019-03-29
CN109544668B true CN109544668B (en) 2022-10-25

Family

ID=65828266

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710860925.7A Active CN109544668B (en) 2017-09-21 2017-09-21 Texture coordinate processing method, terminal device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109544668B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287431B (en) * 2019-06-27 2021-08-24 北京金山安全软件有限公司 Image file loading method and device, electronic equipment and storage medium
CN112307139A (en) * 2019-07-30 2021-02-02 阿里巴巴集团控股有限公司 Data processing method, device, server and storage medium
CN112819939B (en) * 2021-03-08 2023-07-07 网易(杭州)网络有限公司 Method, apparatus, device and computer readable storage medium for correcting UV coordinates
CN114529706B (en) * 2022-04-22 2022-07-08 三一筑工科技股份有限公司 Method, device, equipment and medium for splitting target object in three-dimensional model
CN116048531B (en) * 2023-03-30 2023-08-08 南京砺算科技有限公司 Instruction compiling method, graphic processing device, storage medium and terminal equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6744442B1 (en) * 2000-08-29 2004-06-01 Harris Corporation Texture mapping system used for creating three-dimensional urban models
WO2005101321A2 (en) * 2004-04-05 2005-10-27 Actuality Systems, Inc. Processing three dimensional data for spatial three dimensional displays
US7659893B1 (en) * 2006-10-02 2010-02-09 Nvidia Corporation Method and apparatus to ensure consistency of depth values computed in different sections of a graphics processor
US8818773B2 (en) * 2010-10-25 2014-08-26 Vistaprint Schweiz Gmbh Embroidery image rendering using parametric texture mapping
CN102147930B (en) * 2011-04-13 2012-09-05 北京农业信息技术研究中心 Texture mapping method for three-dimensional curved surface of irregular plant leaf
US8736603B2 (en) * 2011-11-02 2014-05-27 Visual Technology Services Limited Compression of texture rendered wire mesh models
CN102426712B (en) * 2011-11-03 2014-07-16 中国科学院自动化研究所 Three-dimensional head modeling method based on two images
CN103021013A (en) * 2012-11-28 2013-04-03 无锡羿飞科技有限公司 High-efficiency processing method for spherical display and rotary output image of projector

Also Published As

Publication number Publication date
CN109544668A (en) 2019-03-29

Similar Documents

Publication Publication Date Title
CN109544668B (en) Texture coordinate processing method, terminal device and computer readable storage medium
CN111402390B (en) Model rendering method, device, equipment and storage medium
JP6712366B2 (en) Change in effective resolution based on screen position in graphics processing by approximating projection of vertices on curved viewport
TWI552109B (en) A method, a non-transitory computer-readable storage medium and a system for conservative rasterization of primitives using an error term
US9811940B2 (en) Bandwidth reduction using vertex shader
KR20170012201A (en) Varying effective resolution by screen location by changing active color sample count within multiple render targets
KR102048885B1 (en) Graphic processing unit, graphic processing system comprising the same, rendering method using the same
JP2008165760A (en) Method and apparatus for processing graphics
US10019802B2 (en) Graphics processing unit
US10540789B2 (en) Line stylization through graphics processor unit (GPU) textures
KR102066659B1 (en) A graphic processing unit, a graphic processing system including the same, and a method of operating the same
US9955065B2 (en) Dynamic motion path blur user interface
CN105550973B (en) Graphics processing unit, graphics processing system and anti-aliasing processing method
CN105574931A (en) Electronic map road drawing method and device
US9779484B2 (en) Dynamic motion path blur techniques
US20160063670A1 (en) Dynamic Motion Path Blur Kernel
US20200020139A1 (en) Rendering of Graphic Objects With Pattern Paint Using A Graphics Processing Unit
CN114820972A (en) Contour line and/or contour surface generation method, system, device and storage medium
CN110502305B (en) Method and device for realizing dynamic interface and related equipment
US9911205B1 (en) Visual continuity for arbitrary length stipple patterns
CN111047666B (en) Unified digital content selection system for vector graphics and grid graphics
US11017505B2 (en) System and method for applying antialiasing to images
US20140354627A1 (en) Rendering a 3d shape
US12131418B2 (en) Graphics processing unit instancing control
CN116824104B (en) Plotting graph drawing method, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant