CN107958484B - Texture coordinate calculation method and device - Google Patents

Texture coordinate calculation method and device Download PDF

Info

Publication number
CN107958484B
CN107958484B CN201711276374.6A CN201711276374A CN107958484B CN 107958484 B CN107958484 B CN 107958484B CN 201711276374 A CN201711276374 A CN 201711276374A CN 107958484 B CN107958484 B CN 107958484B
Authority
CN
China
Prior art keywords
texture
coordinate
coordinates
road
grid
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
CN201711276374.6A
Other languages
Chinese (zh)
Other versions
CN107958484A (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.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology 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 Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201711276374.6A priority Critical patent/CN107958484B/en
Publication of CN107958484A publication Critical patent/CN107958484A/en
Application granted granted Critical
Publication of CN107958484B publication Critical patent/CN107958484B/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
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/30Polynomial surface description
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program

Abstract

The embodiment of the invention provides a texture coordinate calculation method and device. The method comprises the following steps: acquiring the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene; calculating conversion coefficients of the distribution points in a conversion equation between the space coordinates and texture coordinates based on the space coordinates of each vertex and each distribution point in the same grid quadrangle; and calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation. The texture coordinate calculation method is high in calculation precision, and can accurately calculate the texture coordinates of different points in the grid quadrangle in any shape, reduce the mapping error rate and improve the sensory experience of players.

Description

Texture coordinate calculation method and device
Technical Field
The invention relates to the technical field of game scene processing, in particular to a texture coordinate calculation method and device.
Background
In a three-dimensional game, a road is an important component in a game scene, and the generation of the road needs to acquire texture coordinate data of a road model on a corresponding road texture map so as to map each texel in the road texture map to a corresponding position on the road model, thereby completing a road generation process. Among them, how to obtain high-precision texture coordinate data is a very important issue.
In the prior art, a commonly used texture coordinate calculation method is to calculate texture coordinates according to distances from points on a grid to surrounding tangent planes when a road model is subjected to grid division, the calculation precision of the calculation method is not high, the overall shape of the grid needing to be divided is in a very regular state, otherwise, the texture coordinates of different points in the grid cannot be calculated, and mapping errors are prone to occur during texture mapping, so that the sensory experience of a player is affected.
Disclosure of Invention
In order to overcome the above-mentioned deficiencies in the prior art, the present invention aims to provide a texture coordinate calculation method and device, wherein the texture coordinate calculation method has high calculation precision, can accurately calculate texture coordinates of different points in a grid quadrangle with any shape, reduces mapping error rate, and improves sensory experience of players.
As for a method, a preferred embodiment of the present invention provides a texture coordinate calculation method, including:
acquiring the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene;
calculating conversion coefficients of the distribution points in a conversion equation between the space coordinates and texture coordinates based on the space coordinates of each vertex and each distribution point in the same grid quadrangle;
and calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation.
As for a device, a preferred embodiment of the present invention provides a texture coordinate calculation device, the device comprising:
the spatial coordinate acquisition module is used for acquiring the spatial coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene;
the conversion coefficient calculation module is used for calculating the conversion coefficient of each distribution point in the conversion equation between the space coordinate and the texture coordinate based on the space coordinates of each vertex and each distribution point in the same grid quadrangle;
and the texture coordinate calculation module is used for calculating and obtaining the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation.
Compared with the prior art, the texture coordinate calculation method and the texture coordinate calculation device provided by the preferred embodiment of the invention have the following beneficial effects: the texture coordinate calculation method is high in calculation precision, and can accurately calculate the texture coordinates of different points in the grid quadrangle in any shape, reduce the mapping error rate and improve the sensory experience of players. Firstly, the method obtains the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene; then, the method calculates the conversion coefficient of each distribution point in the conversion equation between the space coordinate and the texture coordinate based on the space coordinates of each vertex and each distribution point in the same grid quadrangle; and finally, calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation, thereby accurately calculating the texture coordinates of each point in the grid quadrangle in any shape, reducing the mapping error rate of the texture map and improving the sensory experience of the player.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments are briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention, and therefore should not be considered as limiting the scope of the claims of the present invention, and it is obvious for those skilled in the art that other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a block diagram of a computing device according to a preferred embodiment of the present invention.
Fig. 2 is a flowchart illustrating a texture coordinate calculating method according to a preferred embodiment of the invention.
Fig. 3 is a flowchart illustrating sub-steps included in step S210 shown in fig. 2.
Fig. 4 is a schematic flow chart illustrating a texture coordinate calculating method according to a preferred embodiment of the invention.
Fig. 5 is a flowchart illustrating the sub-steps included in step S209 shown in fig. 4.
FIG. 6 is a block diagram of the texture coordinate calculation apparatus shown in FIG. 1 according to a preferred embodiment of the present invention.
Fig. 7 is a block diagram of the spatial coordinate acquisition module shown in fig. 6.
FIG. 8 is a block diagram of another block diagram of the texture coordinate calculating apparatus shown in FIG. 1 according to the preferred embodiment of the present invention.
Icon: 10-a computing device; 11-a memory; 12-a processor; 13-a communication unit; 14-a graphics card unit; 100-texture coordinate calculation means; 110-a spatial coordinate acquisition module; 120-conversion coefficient calculation module; 130-texture coordinate calculation module; 111-meshing sub-modules; 112-triangularization processing submodule; 140-conversion equation configuration module; 150-map mapping module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Fig. 1 is a block diagram of a computing device 10 according to a preferred embodiment of the invention. In the embodiment of the present invention, the computing device 10 can accurately calculate texture coordinates corresponding to any grid quadrangle in any shape obtained by dividing a road model during a road construction process of a three-dimensional game, and reduce a mapping error rate when a road texture map is mapped onto the road model, thereby enhancing a sensory experience of a player when the player participates in the three-dimensional game. The texture coordinates corresponding to the grid quadrangle comprise texture coordinates corresponding to four vertexes forming the grid quadrangle and texture coordinates corresponding to points with different distribution positions in the grid quadrangle. In the present embodiment, the computing device 10 may be, but is not limited to, a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a server with an image processing function, or the like.
In this embodiment, the computing device 10 may include a texture coordinate calculation apparatus 100, a memory 11, a processor 12, a communication unit 13, and a graphics card unit 14. The memory 11, the processor 12, the communication unit 13 and the display card unit 14 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The texture coordinate calculation apparatus 100 includes at least one software functional module that may be stored in the memory 11 in the form of software or firmware (firmware), and the processor 12 executes various functional applications and data processing by running software programs and modules stored in the memory 11.
In this embodiment, the Memory 11 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an electrically Erasable Programmable Read-Only Memory (EEPROM), and the like. The memory 11 is used for storing a program, and the processor 12 executes the program after receiving an execution instruction. Further, the software programs and modules in the memory 11 may also include an operating system, which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
In this embodiment, the processor 12 may be an integrated circuit chip having signal processing capabilities. The Processor 12 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In this embodiment, the communication unit 13 is configured to establish a communication connection between the computing device 10 and another external device through a network, and perform data transmission through the network.
In this embodiment, the graphics card unit 14 is used for performing operation processing on the graphics data to relieve the operation pressure of the processor 12. The core component of the Graphics card Unit 14 is a GPU (Graphics Processing Unit), and is configured to convert and drive Graphics data information required by the computing device 10, and control a display to display the Graphics data information.
In this embodiment, the computing device 10 calculates the texture coordinates of each point in each grid quadrangle corresponding to the road model by the texture coordinate calculating device 100 stored in the memory 11 to obtain high-precision texture coordinates, so that the mapping error rate of the road texture map in the road generation process is increased, the sensory experience of the player when the player participates in the game is enhanced, and the game comfort of the player is improved.
It will be appreciated that the configuration shown in FIG. 1 is merely a structural schematic of computing device 10, and that computing device 10 may include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Fig. 2 is a schematic flow chart of a texture coordinate calculation method according to a preferred embodiment of the invention. In the embodiment of the present invention, the texture coordinate calculation method is applied to the above-mentioned computing device 10, and the specific flow and steps of the texture coordinate calculation method shown in fig. 2 are described in detail below.
In an embodiment of the present invention, the texture coordinate calculation method includes the following steps:
step S210, obtaining the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene.
In this embodiment, the computing device 10 may obtain, through a network, spatial coordinates of vertices and distribution points in each mesh quadrangle corresponding to the road model from other electronic devices in communication with the computing device 10; the computing device 10 may also receive the spatial coordinates of the vertices and distribution points in each grid quadrilateral input by the game designer by providing an external input device; the computing device 10 may also obtain the spatial coordinates of each vertex and each distribution point in each divided mesh quadrangle by directly performing mesh division processing and coordinate identification processing on the road model. The distribution points are points which are randomly or regularly distributed in the corresponding grid quadrangle, and the grid quadrangle can be a parallelogram, a rectangle or a trapezoid.
Optionally, please refer to fig. 3, which is a flowchart illustrating the sub-steps included in step S210 shown in fig. 2. In an embodiment of the present invention, the step S210 may include a sub-step S211 and a sub-step S212, where the sub-step S211 and the sub-step S212 are as follows:
and a substep S2111 of performing mesh division on the road model in the current game scene to obtain each mesh quadrangle in different shapes.
In this embodiment, the step of performing mesh division on the road model in the current game scene by the computing device 10 to obtain each mesh quadrangle with different shapes may include:
sampling a road curve in the road model according to a preset interval to obtain each sampling point on the road curve;
and drawing a line segment which is perpendicular to the connecting line between the adjacent sampling points and has the length equal to the road width of the road model by taking each sampling point as a center, and forming a grid quadrangle with a corresponding shape based on four vertexes of the drawn adjacent line segment.
And each drawn line segment is vertical to a connecting line between a sampling point passed by the line segment and a previous sampling point of the sampling point, and the sampling point passed by the line segment is the midpoint of the line segment. The mesh quadrangle formed by four vertexes of adjacent line segments has different shapes according to the bending degree of the road curve and the distribution condition of each sampling point.
In the substep S212, triangularization processing is performed on each grid quadrangle to obtain the spatial coordinates of each vertex and each distribution point in the corresponding grid quadrangle.
In this embodiment, the computing device 10 may perform triangulation on each mesh quadrangle, so that each mesh quadrangle may be formed by splicing a plurality of triangles. During the process of triangularization of each mesh quadrangle, the computing device 10 sequentially obtains the spatial coordinates of the four vertices of each mesh quadrangle in the whole spatial coordinate system and the spatial coordinates of the branch points of each mesh quadrangle for dividing the triangles.
Step S220, calculating a conversion coefficient of each distribution point in a conversion equation between the spatial coordinates and the texture coordinates based on the spatial coordinates of each vertex and each distribution point in the same grid quadrangle.
In this embodiment, the transformation equation may represent a transformation relationship between spatial coordinates and texture coordinates, the transformation coefficient may represent a transformation ratio of each distribution point in the corresponding grid quadrangle in the transformation equation, and the computing device 10 may generate different transformation coefficients for different distribution points in the same grid quadrangle.
In this embodiment, the spatial coordinates of four vertices of a mesh quadrilateral may be respectively represented as p0, p1, p2 and p3, the texture coordinates of p0 in the corresponding road texture map are (0,0), the texture coordinates of p1 in the corresponding road texture map are (1,0), the texture coordinates of p2 in the corresponding road texture map are (1,1), the texture coordinates of p3 in the corresponding road texture map are (0,1), and the texture coordinates of a distribution point in the mesh quadrilateral corresponding to the spatial coordinates p are (x, y), so that the conversion equation may be represented by the following formula:
Figure BDA0001496643610000081
and if x and y are horizontal coordinate values and vertical coordinate values of texture coordinates corresponding to the distribution points, ac ═ F (a, C), bc ═ F (B, C), cd ═ F (C, D), ab ═ F (a, B), and bd ═ F (B, D). Wherein a is p0-p, B is p1-p0, C is p3-p0, D is p2+ p0-p1-p3, F ((x1, y1), (x2, y2)) isx 1 y2-x2 y1, and the computing device 10 can obtain corresponding conversion coefficients ac, bc, cd, ab and bd of each distribution point in the conversion equation between the space coordinates and the texture coordinates according to the space coordinates of each vertex in the same grid quadrilateral and the space coordinates of each distribution point.
And step S230, calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation.
In this embodiment, after obtaining the conversion coefficients ac, bc, cd, ab, and bd corresponding to each distribution point in the same grid quadrilateral, the computing device 10 calculates, in the above conversion equation, texture coordinates of the distribution point in the corresponding road texture map based on the conversion coefficients ac, bc, cd, ab, and bd.
Fig. 4 is a schematic flow chart of a texture coordinate calculation method according to a preferred embodiment of the invention. In this embodiment of the present invention, before the step S210, the method may further include:
in step S209, a conversion equation between the spatial coordinates and the texture coordinates is configured.
Optionally, please refer to fig. 5, which is a flowchart illustrating the sub-steps included in step S209 shown in fig. 4. In this embodiment, the step S209 may include a sub-step S201 and a sub-step S202, where the sub-step S201 and the sub-step S202 are as follows:
in the substep S201, a conversion relationship between the spatial coordinates and the texture coordinates of each mapping point is established according to the position information of the mapping points on the four sides of the distribution points in the grid quadrangle and the texture coordinates of the corresponding mapping points on the road texture map.
In this embodiment, when the texture coordinate in the corresponding road texture map is (x, y), the distribution point must map a mapping point with x coordinate of texture abscissa or a mapping point with y coordinate of texture ordinate on four sides of the grid quadrangle, for example, a mapping point with x coordinate of texture abscissa corresponding to p4 exists on the side p0p1, a mapping point with x coordinate of texture abscissa corresponding to p5 exists on the side p3p2, and the distribution point is on the connection line of the two mapping points, the transformation relationship between the space coordinates and the texture coordinates of the two mapping points can be expressed as p4 (p1-p0) x + p0, p5 (1-x) p3+ p2, p (p5-p4) y + p4, then p ═ 1-y [ (1-x) × p0+ x × p1] + y [ (1-x) × p3+ x × p2] can be obtained.
And a substep S202, generating a conversion equation between the space coordinate and the texture coordinate of the grid quadrangle according to the conversion relation of each mapping point on the space coordinate and the texture coordinate.
In this embodiment, the computing device 10 may transform the equation p ═ 1-y [ (1-x) × p0+ x × p1] + y [ (1-x) × p3+ x × p2] by a ═ p0-p, B ═ p1-p0, C ═ p3-p0, and D ═ p2+ p0-p1-p3, resulting in the equation (0,0) ═ a + x × B + y + C + x × y × D. The computing device 10 obtains the above-described conversion equation by performing a cancel C operation and a cancel B operation on both ends of equation (0,0) ═ a + x × B + y × C + x × y × D as a function of F ((x1, y1), (x2, y2)) -x 1 × y2-x2 × y 1.
In this embodiment of the present invention, after step S230, the method may further include:
step S240, according to the texture coordinates corresponding to each vertex and each distribution point in each grid quadrangle, the texels corresponding to each texture coordinate in the road texture mapping map are mapped to the corresponding positions on the road model.
In this embodiment, after obtaining texture coordinates of each distribution point in each grid quadrangle in the corresponding road texture map, the computing device 10 maps texels corresponding to each texture coordinate in the road texture map to corresponding positions on the road model based on each obtained texture coordinate, so as to generate a complete road in the current game scene.
Fig. 6 is a block diagram of the texture coordinate calculation apparatus 100 shown in fig. 1 according to a preferred embodiment of the present invention. In the embodiment of the present invention, the texture coordinate calculation device 100 includes a spatial coordinate obtaining module 110, a transformation coefficient calculation module 120, and a texture coordinate calculation module 130.
The spatial coordinate obtaining module 110 is configured to obtain spatial coordinates of vertices and distribution points in each grid quadrilateral corresponding to the road model in the current game scene.
In this embodiment, the spatial coordinate acquiring module 110 may perform step S210 in fig. 2, and the description about the spatial coordinate acquiring module 110 may refer to the description about step S210 above.
Optionally, please refer to fig. 7, which is a block diagram of the spatial coordinate obtaining module 110 shown in fig. 6. In this embodiment, the spatial coordinate obtaining module 110 may include a mesh division sub-module 111 and a triangulation sub-module 112.
And the mesh division submodule 111 is used for carrying out mesh division on the road model in the current game scene to obtain each mesh quadrangle in different shapes.
In this embodiment, the mesh division submodule 111 performs mesh division on the road model in the current game scene, and the manner of obtaining each mesh quadrangle in different shapes includes:
sampling a road curve in the road model according to a preset interval to obtain each sampling point on the road curve;
and drawing a line segment which is perpendicular to the connecting line between the adjacent sampling points and has the length equal to the road width of the road model by taking each sampling point as a center, and forming a grid quadrangle with a corresponding shape based on four vertexes of the drawn adjacent line segment.
In this embodiment, the mesh division sub-module 111 may perform the sub-step S211 in fig. 3, and the detailed description may refer to the above detailed description of the sub-step S211.
The triangularization processing submodule 112 is configured to triangulate each grid quadrangle to obtain a spatial coordinate of each vertex in the corresponding grid quadrangle and a spatial coordinate of each distribution point.
In this embodiment, the triangularization sub-module 112 may perform the sub-step S212 in fig. 3, and the detailed description may refer to the above detailed description of the sub-step S212.
The conversion coefficient calculation module 120 is configured to calculate a conversion coefficient of each distribution point in a conversion equation between the spatial coordinate and the texture coordinate based on the spatial coordinates of each vertex and each distribution point in the same grid quadrangle.
In this embodiment, the conversion coefficient calculating module 120 may execute step S220 in fig. 2, and the detailed description may refer to the above detailed description of step S220.
The texture coordinate calculation module 130 is configured to calculate, according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained through calculation, a texture coordinate corresponding to each distribution point in the road texture map.
In this embodiment, the texture coordinate calculating module 130 may execute step S230 in fig. 2, and the detailed description may refer to the above detailed description of step S230.
Fig. 8 is a block diagram of another texture coordinate calculating apparatus 100 shown in fig. 1 according to a preferred embodiment of the present invention. In the embodiment of the present invention, the texture coordinate calculation apparatus 100 may further include a conversion equation configuration module 140 and a map mapping module 150.
The conversion equation configuration module 140 is configured to configure a conversion equation between the spatial coordinates and the texture coordinates.
In this embodiment, the method for configuring the conversion equation between the spatial coordinate and the texture coordinate by the conversion equation configuration module 140 includes:
establishing a conversion relation between the space coordinate and the texture coordinate of each mapping point according to the position information of the mapping points of the distribution points on the four sides in the grid quadrangle and the texture coordinate of the corresponding mapping point on the road texture map;
and generating a conversion equation between the space coordinate and the texture coordinate of the grid quadrangle according to the conversion relation of each mapping point on the space coordinate and the texture coordinate.
The map mapping module 150 is configured to map texels corresponding to texture coordinates in the road texture map to corresponding positions on the road model according to texture coordinates corresponding to vertices and distribution points in each grid quadrilateral.
In this embodiment, the map mapping module 150 may execute step S240 in fig. 4, and the specific description may refer to the description of step S240 above.
In summary, in the texture coordinate calculation method and the texture coordinate calculation device provided in the preferred embodiments of the present invention, the texture coordinate calculation method has high calculation accuracy, and can accurately calculate the texture coordinates of different points in a grid quadrilateral with an arbitrary shape, thereby reducing the mapping error rate and improving the sensory experience of the player. Firstly, the method obtains the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene; then, the method calculates the conversion coefficient of each distribution point in the conversion equation between the space coordinate and the texture coordinate based on the space coordinates of each vertex and each distribution point in the same grid quadrangle; and finally, calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation, thereby accurately calculating the texture coordinates of each point in the grid quadrangle in any shape, reducing the mapping error rate of the texture map and improving the sensory experience of the player.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A texture coordinate calculation method, the method comprising:
configuring a conversion equation between the space coordinate and the texture coordinate;
acquiring the space coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene;
calculating conversion coefficients of the distribution points in a conversion equation between the space coordinates and texture coordinates based on the space coordinates of each vertex and each distribution point in the same grid quadrangle;
calculating to obtain the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained by calculation;
wherein the step of configuring the conversion equation between the spatial coordinates and the texture coordinates comprises:
establishing a conversion relation between the space coordinate and the texture coordinate of each mapping point according to the position information of the mapping points of the distribution points on the four sides in the grid quadrangle and the texture coordinate of the corresponding mapping point on the road texture map;
and generating a conversion equation between the space coordinate and the texture coordinate of the grid quadrangle according to the conversion relation of each mapping point on the space coordinate and the texture coordinate.
2. The method according to claim 1, wherein the step of obtaining the spatial coordinates of each vertex and each distribution point in each mesh quadrangle corresponding to the road model in the current game scene comprises:
carrying out grid division on a road model in the current game scene to obtain grid quadrangles in different shapes;
and triangularizing each grid quadrangle to obtain the spatial coordinates of each vertex in the corresponding grid quadrangle and the spatial coordinates of each distribution point.
3. The method of claim 2, wherein the step of meshing the road model in the current game scene to obtain mesh quadrilaterals of different shapes comprises:
sampling a road curve in the road model according to a preset interval to obtain each sampling point on the road curve;
and drawing a line segment which is perpendicular to the connecting line between the adjacent sampling points and has the length equal to the road width of the road model by taking each sampling point as a center, and forming a grid quadrangle with a corresponding shape based on four vertexes of the drawn adjacent line segment.
4. The method according to any one of claims 1 to 3, wherein after the step of calculating the texture coordinates corresponding to each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each calculated distribution point, the method further comprises:
and mapping texels corresponding to all texture coordinates in the road texture mapping to corresponding positions on the road model according to texture coordinates corresponding to all vertexes and distribution points in all grid quadrilaterals.
5. A texture coordinate calculation apparatus, characterized in that the apparatus comprises:
the conversion equation configuration module is used for configuring the conversion equation between the space coordinate and the texture coordinate;
the spatial coordinate acquisition module is used for acquiring the spatial coordinates of each vertex and each distribution point in each grid quadrangle corresponding to the road model in the current game scene;
the conversion coefficient calculation module is used for calculating the conversion coefficient of each distribution point in the conversion equation between the space coordinate and the texture coordinate based on the space coordinates of each vertex and each distribution point in the same grid quadrangle;
the texture coordinate calculation module is used for calculating and obtaining the corresponding texture coordinates of each distribution point in the road texture map according to the conversion equation and the conversion coefficient corresponding to each distribution point obtained through calculation;
the method for configuring the conversion equation between the spatial coordinate and the texture coordinate by the conversion equation configuration module comprises the following steps:
establishing a conversion relation between the space coordinate and the texture coordinate of each mapping point according to the position information of the mapping points of the distribution points on the four sides in the grid quadrangle and the texture coordinate of the corresponding mapping point on the road texture map;
and generating a conversion equation between the space coordinate and the texture coordinate of the grid quadrangle according to the conversion relation of each mapping point on the space coordinate and the texture coordinate.
6. The apparatus of claim 5, wherein the spatial coordinate acquisition module comprises:
the grid division submodule is used for carrying out grid division on the road model in the current game scene to obtain grid quadrangles in different shapes;
and the triangulation processing submodule is used for performing triangulation processing on each grid quadrangle to obtain the spatial coordinates of each vertex in the corresponding grid quadrangle and the spatial coordinates of each distribution point.
7. The apparatus of claim 6, wherein the gridding module gridding the road model in the current game scene to obtain different shapes of grid quadrangles comprises:
sampling a road curve in the road model according to a preset interval to obtain each sampling point on the road curve;
and drawing a line segment which is perpendicular to the connecting line between the adjacent sampling points and has the length equal to the road width of the road model by taking each sampling point as a center, and forming a grid quadrangle with a corresponding shape based on four vertexes of the drawn adjacent line segment.
8. The apparatus of any one of claims 5-7, further comprising:
and the map mapping module is used for mapping texels corresponding to all texture coordinates in the road texture map to corresponding positions on the road model according to the texture coordinates corresponding to all vertexes and all distribution points in all grid quadrilaterals.
CN201711276374.6A 2017-12-06 2017-12-06 Texture coordinate calculation method and device Active CN107958484B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711276374.6A CN107958484B (en) 2017-12-06 2017-12-06 Texture coordinate calculation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711276374.6A CN107958484B (en) 2017-12-06 2017-12-06 Texture coordinate calculation method and device

Publications (2)

Publication Number Publication Date
CN107958484A CN107958484A (en) 2018-04-24
CN107958484B true CN107958484B (en) 2021-03-30

Family

ID=61958013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711276374.6A Active CN107958484B (en) 2017-12-06 2017-12-06 Texture coordinate calculation method and device

Country Status (1)

Country Link
CN (1) CN107958484B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109448095A (en) * 2018-10-17 2019-03-08 北京新能源汽车股份有限公司 Acquisition methods, device and the terminal of buildings model in a kind of navigation map
CN109754450B (en) * 2018-12-29 2022-12-20 深圳市创梦天地科技有限公司 Method, device and equipment for generating track
CN109741420B (en) * 2018-12-29 2023-06-27 北京金山安全软件有限公司 Region filling method and device, electronic equipment and storage medium
WO2022116012A1 (en) * 2020-12-01 2022-06-09 华为技术有限公司 Texture processing method and apparatus
CN112819939B (en) * 2021-03-08 2023-07-07 网易(杭州)网络有限公司 Method, apparatus, device and computer readable storage medium for correcting UV coordinates
CN113144614A (en) * 2021-05-21 2021-07-23 苏州仙峰网络科技股份有限公司 Texture sampling Map computing method and device based on Tiled Map
CN116048531B (en) * 2023-03-30 2023-08-08 南京砺算科技有限公司 Instruction compiling method, graphic processing device, storage medium and terminal equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1395222A (en) * 2001-06-29 2003-02-05 三星电子株式会社 Representation and diawing method of three-D target and method for imaging movable three-D target
CN101872492A (en) * 2010-06-09 2010-10-27 中国科学院深圳先进技术研究院 Multi-angle map implementation method of three-dimensional simulation city
CN104637089A (en) * 2015-02-15 2015-05-20 腾讯科技(深圳)有限公司 Three-dimensional model data processing method and device
CN104680573A (en) * 2015-01-20 2015-06-03 西安科技大学 Texture mapping method based on triangular mesh simplification
CN106327566A (en) * 2016-08-30 2017-01-11 北京像素软件科技股份有限公司 Method for generating virtual-reality three dimensional road

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040196282A1 (en) * 2003-02-14 2004-10-07 Oh Byong Mok Modeling and editing image panoramas

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1395222A (en) * 2001-06-29 2003-02-05 三星电子株式会社 Representation and diawing method of three-D target and method for imaging movable three-D target
CN101872492A (en) * 2010-06-09 2010-10-27 中国科学院深圳先进技术研究院 Multi-angle map implementation method of three-dimensional simulation city
CN104680573A (en) * 2015-01-20 2015-06-03 西安科技大学 Texture mapping method based on triangular mesh simplification
CN104637089A (en) * 2015-02-15 2015-05-20 腾讯科技(深圳)有限公司 Three-dimensional model data processing method and device
CN106327566A (en) * 2016-08-30 2017-01-11 北京像素软件科技股份有限公司 Method for generating virtual-reality three dimensional road

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
MAPPPING DIGITAL IMAGE TEXTURE ONTO 3D MODEL FROM LIDAR DATA;Chunmei Hu 等;《ISPRS Congress(2008)》;20080131;第611-614页 *
基于体绘制的三维数据场可视化技术研究;田玲;《中国优秀硕士学位论文全文数据库 信息科技辑》;20071015(第4期);第I138-733页 *
路面三维模型真实感显示技术研究;顾海燕;《中国优秀硕士学位论文全文数据库 信息科技辑》;20160215(第2期);第I138-1506页 *

Also Published As

Publication number Publication date
CN107958484A (en) 2018-04-24

Similar Documents

Publication Publication Date Title
CN107958484B (en) Texture coordinate calculation method and device
CN108038897B (en) Shadow map generation method and device
US8456470B2 (en) Lighting environment simulation system and method
CN109979013B (en) Three-dimensional face mapping method and terminal equipment
US8471852B1 (en) Method and system for tessellation of subdivision surfaces
CN111598986B (en) Virtual fluid surface rendering method, device, equipment and storage medium
CN113077548B (en) Collision detection method, device, equipment and storage medium for object
US11238645B2 (en) Method and system for computer graphics rendering
TWI475511B (en) System and method for meshing curved surface
CN112489213A (en) Three-dimensional terrain model generation method and device, electronic equipment and storage medium
CN109887063B (en) Method and device for realizing virtual fluid in three-dimensional space, medium and electronic equipment
CN111383311B (en) Normal map generation method, device, equipment and storage medium
CN111339599A (en) Conversion method from BIM model to GIS model
CN111127612A (en) Game scene node updating method and device, storage medium and electronic equipment
CN111243085B (en) Training method and device for image reconstruction network model and electronic equipment
CN109697748A (en) Model compression processing method, model pinup picture processing method device, storage medium
CN109493423B (en) Method and device for calculating midpoint positions of two points on surface of three-dimensional earth model
CN111127590A (en) Second-order Bezier curve drawing method and device
CN103412973B (en) The generation method and system of three-dimensional artificial
CN114329868A (en) Substation equipment safety distance checking method and device and computer equipment
CN114119831A (en) Snow accumulation model rendering method and device, electronic equipment and readable medium
US10902675B2 (en) Graphical modelling by smoothing polyhedral meshes with multi-sided patches
CN115099025A (en) Method for calculating fluid flow speed in fluid model, electronic device and storage medium
JP3064799B2 (en) Texture mapping device
CN114036721A (en) Method and device for constructing three-dimensional temperature cloud field of micro-module

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